Hi, I have a setup like this:
dftrain, dftest = partition(df, 0.7, shuffle=true, rng=123)
datapipe = ContinuousEncoder() |> Standardizer()
datatrans_mach = machine(datapipe, dftrain) |> fit!
normalized_train = MLJ.transform(datatrans_mach, dftrain)
normalized_test = MLJ.transform(datatrans_mach, dftest)
normalizer = fitted_params(datatrans_mach).machines[2]
ytrain, Xtrain = normalized_train.target, select(normalized_train, Not(target))
ytest, Xtest = normalized_test.target, select(normalized_test, Not(target))
knn = KNNRegressor()
knnM = machine(knn, Xtrain, ytrain) |> fit!
All well and good, but when I do
predict(knn, inverse_transform(normalizer, Xtest))
I get
ERROR: Attempting to transform data with incompatible feature labels.
So I thought that since Standardizer
was trained on dftrain
which includes the target
I tried
predict(knn, inverse_transform(normalizer, hcat(Xtest, ytest)))
But that is evidently not it, since I get a more fundamental incompatibility ERROR: ArgumentError: dimension of input points:44 and tree data:43 must agree
And if I first predict and then inverse transform i.e.
inverse_transform(normalizer, predict(knn, Xtest))
I get ERROR: type Nothing has no field names
So, how can I get the predictions on the original scale?