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

value index 0 out of range (0 - -1) at attribute no 4 (d) #54

Open
ziqilau opened this issue Sep 5, 2017 · 3 comments
Open

value index 0 out of range (0 - -1) at attribute no 4 (d) #54

ziqilau opened this issue Sep 5, 2017 · 3 comments

Comments

@ziqilau
Copy link

ziqilau commented Sep 5, 2017

I am dealing with continuous features and discrete class_var, i.e.

atts = ['a','b','c','d']
domain = Orange.data.Domain([Orange.feature.Continuous(x) for x in atts[:-1]] +
                            [Orange.feature.Discrete(atts[-1])])
data = Orange.data.Table(domain)
data.append([1,2,3,0])

However, it said "value index 0 out of range (0 - -1) at attribute no 4 (d)". Please help!

@kernc
Copy link

kernc commented Sep 5, 2017

Don't know whether .append() will work, but if atts[-1] is class, you want to construct your domain like so:

domain = Orange.data.Domain([Orange.feature.Continuous(x) for x in atts[:-1]],
                            [Orange.feature.Discrete(atts[-1])])

@kernc
Copy link

kernc commented Sep 6, 2017

And if you're actually working with the current Orange 3 version, its repository is here: https://github.com/biolab/orange3

@ales-erjavec
Copy link
Contributor

You need to pass a list of values the discrete variable can represent. i.e. Orange.feature.Discrete("Name", values=["First", "Second", "Third"])

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

3 participants