MethodError: No Method Matching Learning Curve

Hello Everyone:

I am attempting to run:

    curve_clf = MLJ.learning_curve(r_clf, feat, targ,
					   range=r_clf,
					   resampling=MLJ.Holdout(fraction_train=0.8),
					   measure=MLJ.cross_entropy)

But am encountering the following error:

MethodError: no method matching learning_curve(::MLJBase.NumericRange{Int64, MLJBase.Bounded, Symbol}, ::DataFrames.DataFrame, ::CategoricalArrays.CategoricalVector{Float64, UInt32, Float64, CategoricalArrays.CategoricalValue{Float64, UInt32}, Union{}}; rng=NumericRange{Int64,…} @983, resampling=Holdout @695, measure=LogLoss{Float64} @702)

The system suggestion is:

learning_curve(!Matched::MLJModelInterface.Supervised, ::Any...; resolution, resampling, weights, measures, measure, rows, operation, ranges, range, repeats, acceleration, acceleration_grid, verbosity, rngs, rng_name, check_measure) 

Any suggestions out there?

Answer:

Make sure the parameters fit are correctly
oriented.

In this case, r_clf is you range, and you would
benefit from using your model (i.e. clf for NNC)
to run the module correctly.

1 Like

Thanks @YummyPampers2 for posting your MLJ query on Discourse.

Yes, it looks like your first argument is a ParamRange object (as constructed with range(model/or/type, :hyperparameter_name, ...)) instead an MLJ model.

There are two possible signatures for learning_curve, either learning_curve(model, X, y; kwargs...) or learning_curve(machine; kwargs...). Here X is the training features (generally a table, such as a DataFrame) and y the training target (generally a vector - categorical in the case of classification models). There is no need to include the exclamation point (now deprecated).

Here’s more help on learning curves.

1 Like

@ablaom Thank you for your insightful reply.

When you say - (!) is deprecated, are you referring
to the system suggestion: ‘learning_curve(!Matched::MLJModelInterface.Supervised, …’

Or from the original code suggestion?