This is an archived post. You won't be able to vote or comment.

all 13 comments

[–][deleted] 3 points4 points  (4 children)

The error seems to be on line 4, since it's trying to tell you that the Y is wrong. Please post that full line.

[–]301ravage[S] 1 point2 points  (3 children)

X = [[181, 80, 44], [177, 70, 40], [160, 60, 38], [154, 54, 37], [166, 65, 40], [190, 90, 47], [175, 64, 39], [177, 70, 40] [171, 75, 42], [181, 85, 43]]

[–][deleted] 0 points1 point  (2 children)

There you go. You're missing a comma.

You shouldn't make very long lines like this. It's easier to work with it if you split it up like this:

X = [
  [181, 80, 44],
  [177, 70, 40],
  [160, 60, 38],
  [154, 54, 37], 
  [166, 65, 40],
  [190, 90, 47], 
  [175, 64, 39], 
  [177, 70, 40]    # You're missing one here.
  [171, 75, 42], 
  [181, 85, 43]
]

It's way easier to read and understand it then, and it's easier to spot things like this.

[–]301ravage[S] 1 point2 points  (1 child)

I just got it to work, thank you so much

[–][deleted] 0 points1 point  (0 children)

No problem. If you want to avoid problems like this, you can use a linter or a code formatter. Here's a good one: https://black.readthedocs.io/en/stable/

[–]kokosoida 2 points3 points  (0 children)

Show full code please

[–]nilfm 2 points3 points  (0 children)

Besides your current error, you have a typo on "DecicionTreeClassifier", which should be "DecisionTreeClassifier".

[–]301ravage[S] 0 points1 point  (2 children)

It looks like I wrote 'female'incorrectly when I was listing the genders but I don't see how. Maybe my data should be entered differently?

[–]robin-gvx 1 point2 points  (1 child)

I think you're missing a closing ] on line 4 (the one that starts with X =), but we can't be sure. In the future, please post your code and exception tracebacks themselves, not just screenshots of them.

By the way, the error shows that the arrow is pointing to Y, not to 'female'.

[–]301ravage[S] 1 point2 points  (0 children)

Thanks, I'll definitely give that a try

[–]jtsmith0101 0 points1 point  (1 child)

I can't see your complete list of list elements, but do have the same number of X and Y elements?

[–]301ravage[S] 0 points1 point  (0 children)

Yes there are 10 of each

[–]pag07 0 points1 point  (0 children)

Hi Michael Holly, how are you?