Hi
I am trying to fit MulticlassLDA
on the iris
dataset. The predict
is throwing an error. I was wondering if you can help me to figure out what mistakes I am making.
using MultivariateStats, RDatasets;
iris = dataset("datasets", "iris");
X = Matrix(iris[1:1:end,1:4])
X_labels = Vector(iris[1:1:end,5])
X1 = Matrix(X')
y =X_labels
labels = repeat([3],length(y))
for (idx,X_labels) in enumerate(y)
if X_labels =="virginica"
labels[idx] = 1
elseif X_labels == "setosa"
labels[idx] = 2
end
end
y = labels;
y = vec(y')
lda = fit(MulticlassLDA, 3, X1, y);
Up to fitting, everything is perfect. Now I am facing the problem.
predict(lda, X1)
MethodError: no method matching predict(::MulticlassLDA{Float64}, ::Matrix{Float64})
Closest candidates are:
predict(::Discriminant, ::AbstractMatrix{T} where T) at /Users/sourishdas/.julia/packages/MultivariateStats/HTpHt/src/lda.jl:26
Thanks and regards,
Sourish