Skip to content

Should predict be robust to changes in column order? #59

@elipivo

Description

@elipivo

A quick test seemed to show that the predict method is not robust to reordering the column order, which was a bit surprising.

using DataFrames
using MLJ
import MLJDecisionTreeInterface.DecisionTreeClassifier as Tree

iris = DataFrame(load_iris());
y, X = unpack(iris, ==(:target); rng=123)

tree = Tree()
mach = machine(tree, X, y)
train, test = partition(eachindex(y), 0.7)
fit!(mach, rows=train)

# Returns false
predict(mach, X[test,[3,2,1,4]]) == predict(mach, X[test,[1,2,3,4]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions