Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

predict for MulticlassLDA is throwing error #204

Closed
sourish-cmi opened this issue Sep 24, 2022 · 1 comment
Closed

predict for MulticlassLDA is throwing error #204

sourish-cmi opened this issue Sep 24, 2022 · 1 comment

Comments

@sourish-cmi
Copy link

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

Any help would be greatly appreciated.

@sourish-cmi
Copy link
Author

Hi

I asked the same question in Julia Discourse and got a reply. I had a lower version. Here is the discussion.

Once I update the version. It got fixed. Hence closing the issue.

Best regards,
Sourish

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant