![]() |
python code will not interpret - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: python code will not interpret (/thread-38397.html) |
python code will not interpret - Led_Zeppelin - Oct-07-2022 The following code generates an error when I try to interpret it with python. svm_c = GridSearchCV( cv=TimeSeriesSplit(gap=0, max_train_size=None, n_splits=5, test_size=None), estimator=SGDClassifier(n_jobs=-1, random_stat=21), n_jobs=-1, param_grid={"alpha": [0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000]}, return_train_score=True, scoring="f1_macro", )The error is: TypeError Traceback (most recent call last) Input In [187], in <cell line: 1>() 1 svm_c = GridSearchCV( 2 cv=TimeSeriesSplit(gap=0, max_train_size=None, n_splits=5, test_size=None), ----> 3 estimator=SGDClassifier(n_jobs=-1, random_stat=21), 4 n_jobs=-1, 5 param_grid={"alpha": [0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000]}, 6 return_train_score=True, 7 scoring="f1_macro", 8 ) TypeError: SGDClassifier.__init__() got an unexpected keyword argument 'random_stat'I am not sure why. I googled the error, and it claimed that scikit-learn was the problem. I have version 1.1.1. It says that I need version 0.18. I upgraded scikit-learn to 1.1.2 and got the same error when I tried to interpret it. I should emphasize that I am only running this code snippet. It is part of a larger program, but I am just working it this piece now. I cannot upgrade scikit-learn to version 0.18. That is impossible. I used the command pip install scikit-learn==0.18 --force upgradeand all it did was give a lot of errors. Why is this error that I discussed above happening? I am using python 3.10.4. I suspect it has to do with a specific version of scikit-learn. Respectfully, Led_Zepplin RE: python code will not interpret - perfringo - Oct-08-2022 SGDClassifier expects random_state but you gave random_stat |