Using MLJ’s NearestNeighbors KNNRegressor and attempted to use BruteTree algorithm. Get the following error when attempting to use predict: ERROR: LoadError: type BruteTree has no field indices followed by usual stack trace.
Simple code showcasing the problem (same code example works fine for kdtree or balltree):
using DataFrames
using MLJ
X_rand = rand(50,3)
coef = [1; 0; 1]
y_rand = X_rand*coef + rand(50,1)
#convert to dataframe for MLJ inputs
X_rand_df = DataFrames.DataFrame(X_rand, :auto)
y_rand_df = DataFrames.DataFrame(y_rand, :auto)
train_idx, test_idx = partition(eachindex(y_rand_df[:,1]), 0.7, shuffle=true)
Tree = @load KNNRegressor
tree =Tree(algorithm=:brutetree)
mach = machine(tree, X_rand_df[train_idx, :], y_rand_df[train_idx, 1])
MLJ.fit!(mach)
MLJ.predict(mach, X_rand_df[test_idx,:])
I can provide the error stack I’m seeing if desired.