Skip to content

Cross Validation or Optimization for EquivalentSources #543

@mdtanker

Description

@mdtanker

Description of the desired feature:

Is there a reason there is no cross-validation equivalent for harmonica.EquivalentSources like there is for verde.SplineCV? I find myself quite often manually running cross-validations for the equivalent source parameters as shown in the Estimating damping and depth parameters user guide:

dampings = [0.01, 0.1, 1, 10,]
depths = [5e3, 10e3, 20e3, 50e3]

equivalent_sources = hm.EquivalentSources()

scores = []
for params in parameter_sets:
    equivalent_sources.set_params(**params)
    score = np.mean(
        vd.cross_val_score(
            equivalent_sources,
            coordinates,
            data.gravity_disturbance_mgal,
        )
    )
    scores.append(score)

It would be great to be able to instead use

eqs = hm.EquivalentSourcesCV(
    dampings=[0.01, 0.1, 1, 10,], 
    depths=[5e3, 10e3, 20e3, 50e3],
)

eqs.fit(coordinates, data.gravity_disturbance_mgal,)

Also, related to this verde issue; I have an equivalent function for performing an optimization for the optimal equivalent source parameters, instead of a grid-search which would be done with the above cross-validation.

Are you willing to help implement and maintain this feature?

Yes if there is enough interest to justify doing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIdea or request for a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions