How To Resolve This Valueerror: Only 2 Non-keyword Arguments Accepted Sklearn Python
hello i am new to sklearn in python and iam trying to learn it and use this module to predict some numbers based on two features here is the error i am getting: ValueError: only
Solution 1:
I am not sure what you are trying to do here, but change this line:
trainingScores = np.array([11,18,23,33,34,6],[10,19,21,33,34,1], [14,18,22,23,31,6],[16,22,29,31,33,10],[21,24,27,30,31,6],[1,14,15,20,27,7],[1,9,10,11,15,8],[2,9,27,31,35,1],[7,13,18,22,33,2])
to this (Notice the extra square brackets around your data):
trainingScores = np.array([[11,18,23,33,34,6],[10,19,21,33,34,1], [14,18,22,23,31,6],[16,22,29,31,33,10],[21,24,27,30,31,6],[1,14,15,20,27,7],[1,9,10,11,15,8],[2,9,27,31,35,1],[7,13,18,22,33,2]])
Then change the order of params in fit() like this:
clf.fit(trainingData,trainingScores)
And finally change prediction data like this (again look at the extra square brackets):
predictionData = np.array([[862, 19012018]])
After that your code will run.
Solution 2:
You are doing a linear regression code in ML and try to change this line with
trainingScores = np.array(
[11,18,23,33,34,6],
[10,19,21,33,34,1],
[14,18,22,23,31,6],
[16,22,29,31,33,10],
[21,24,27,30,31,6],
[1,14,15,20,27,7],
[1,9,10,11,15,8],
[2,9,27,31,35,1],
[7,13,18,22,33,2]
)
Post a Comment for "How To Resolve This Valueerror: Only 2 Non-keyword Arguments Accepted Sklearn Python"