Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Error resolving Attribute CategoricalAttribute #253

Open
thaitanloi365 opened this issue Oct 4, 2020 · 1 comment
Open

Error resolving Attribute CategoricalAttribute #253

thaitanloi365 opened this issue Oct 4, 2020 · 1 comment

Comments

@thaitanloi365
Copy link

thaitanloi365 commented Oct 4, 2020

Hello,

I'm trying to use Random Forest to classify item's category (either Drink or Food) based on item's name. But I got this error Error resolving Attribute CategoricalAttribute

Here is my example:
https://github.com/thaitanloi365/golearn-example

Please help me to resolve it.
Thanks

@Sentimentron
Copy link
Collaborator

Hi thaitanloi365 (apologies that I've haven't been very responsive this project recently, things have been busy).

Running your example, I can see that your testing data does not have all of the categorical labels that your training data does, which is why resolving the categorical attribute fails: everything has to have the same type and that includes all the labels.

To resolve it, I'd use https://godoc.org/github.com/sjwhitworth/golearn/base#ParseCSVToTemplatedInstancesFromReader, which will parse your training data using the attributes from your training data, then everything should line up.

Happy to help further if you run into difficulty.

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

No branches or pull requests

2 participants