TypeError: train_test_split() got an unexpected keyword argument 'randon_state'
时间: 2023-11-02 11:33:07 浏览: 65
TypeError: Unexpected keyword argument passed to optimizer: learning_rate 解决方法
The error message indicates that there is a typo in the argument name "randon_state" which should be "random_state" instead. "random_state" is used to set a seed value for the random number generator used by the train_test_split function in scikit-learn. Here is an example of how to correctly use random_state:
```
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
```
In this example, the seed value is set to 42.
阅读全文