Closed JeffFessler closed 1 year ago
I'm not a maintainer of this package, but here's an update to the example in the readme that works for me:
using MLJBase, RDatasets, MLJModels
PLSRegressor = @load PLSRegressor pkg=PartialLeastSquaresRegressor
# loading data and selecting some features
data = dataset("datasets", "longley")[:, 2:5]
# unpacking the target
y, X = unpack(data, ==(:GNP))
# loading the model
regressor = PLSRegressor(n_factors=2)
# building a pipeline with scaling on data
pipe = Standardizer |> regressor
model = TransformedTargetModel(pipe, transformer=Standardizer())
# a simple hould out
(Xtrain, Xtest), (ytrain, ytest) = partition((X, y), 0.7, rng=123, multi=true)
mach = machine(model, Xtest, ytest)
fit!(mach)
yhat = predict(mach, Xtest)
mae(yhat, ytest) |> mean
Note you need PartialLeastSquaresRegressor in your environment.
Thanks @ablaom .
Now it is ok @JeffFessler ?
I am a little away from package maintenance due to other work tasks.
Yes, that version ran fine for me. Thanks @ablaom! I guess I'll leave the issue open and someone can close it after the readme gets updated...
Readme updated.
The example 1 in the readme has issues:
This is easily fixed by adding
using PartialLeastSquaresRegressor: PLSRegressor
but maybe you really shouldexport
that type from the package?Then a bit later this happens:
We would love to use the package, but we need a working example.
In the long term, I recommend using Literate.jl, to show working examples because then they are tested as part of CI, whereas examples in a README are not. But in the short run could you please fix the readme? Here is one Literate example: https://jefffessler.github.io/ScoreMatching.jl/dev/generated/examples/01-overview/