Jacarthy Mack
Jacarthy Mack

Reputation: 11

Name 'model' is not defined

When I input this code

print(cross_val_score(model, X, y, cv=3)) 

An error comes back that reads name 'model' is not defined:

print(cross_val_score(model, X, y, cv=3))

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/var/folders/b7/ltdcsdbx0ds1pftc_qmt_k900000gn/T/ipykernel_32984/4204694188.py in <module>
----> 1 print(cross_val_score(model, X, y, cv=3))

NameError: name 'model' is not defined

Upvotes: 1

Views: 1137

Answers (1)

Red
Red

Reputation: 27547

If you're running your code cell-by-cell in an editor like Jupyter, you'll need to make sure that you run all the cells needed to define each element that you will be using in the line that you are trying to run.

Upvotes: 1

Related Questions