Skip to content

predict errors for KNNRegressor when algorithm = :brutetree . #45

@OkonSamuel

Description

@OkonSamuel

A user on julia discourse, recently reported that the code below fails during the prediction phase.

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,:])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions