# MethodError: No Method Matching Learning Curve

**URL:** https://discourse.julialang.org/t/methoderror-no-method-matching-learning-curve/65046
**Category:** Machine Learning
**Tags:** question, mlj
**Created:** [July 21, 2021, 4:04pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-learning-curve/65046 "2021-07-21T16:04:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)
#### Post date: [July 21, 2021, 4:04pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-learning-curve/65046/1 "2021-07-21T16:04:31Z")

</div>

Hello Everyone:

I am attempting to run:

```julia
    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:

```julia
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:

```julia
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?

---

<div class="post-metadata">

### Author: ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)
#### Post date: [July 21, 2021, 4:07pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-learning-curve/65046/2 "2021-07-21T16:07:03Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)
#### Post date: [July 22, 2021, 4:12am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-learning-curve/65046/3 "2021-07-22T04:12:14Z")

</div>

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.

- [MLJ Manual entry, including example](https://alan-turing-institute.github.io/MLJ.jl/dev/learning_curves/)
- [XGBoost/Crabs dataset example](https://alan-turing-institute.github.io/DataScienceTutorials.jl/end-to-end/crabs-xgb/#xgboost_machine)
- [JuliaCon 2020 Workshop example](https://github.com/ablaom/MachineLearningInJulia2020/blob/master/tutorials.md#on-learning-curves)
- [MLJFlux (neural network) example](https://github.com/FluxML/MLJFlux.jl#evolution-of-out-of-sample-performance) or [this notebook](https://github.com/FluxML/MLJFlux.jl/blob/dev/examples/iris/iris.ipynb)

---

<div class="post-metadata">

### Author: ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)
#### Post date: [July 22, 2021, 10:33pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-learning-curve/65046/4 "2021-07-22T22:33:32Z")

</div>

@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?
