'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
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ann Zen |
