1. You could be the same
test_prediction = svc.predict (hog_features.reshape) modified before
modification
2. This possibility
Import NumPy as NP
import Matplotlib.pyplot as plt from
matplotlib import style
style.use ("Ggplot")
From Sklearn import SVM
x = [1, 5, 1.5, 8, 1, 9]
y = [2, 8, 1.8, 8, 0.6, one]
plt.scatter (x,y)
plt.show () C11/>x = Np.array ([[[1,2],
[5,8],
[1.5,1.8],
[8,8],
[1,0.6],
[9,11]])
y = [ 0,1,0,1,0,1]
x.reshape (1,-1)
CLF = SVM. SVC (kernel= ' linear ', C = 1.0)
clf.fit (x,y)
print (Clf.predict ([0.58,0.76])
is not meet the 2D does not involve reshape
Amended to
Print (Clf.predict ([[0.58,0.76]]))
3. The situation you have encountered. Fit_transform (Dataset3_preds.label) error
: reference
Mainly is the package version of the update caused by the above problem, we according to the above error prompts corresponding to find the line of error code:
#修改前
Dataset3_preds.label = Minmaxscaler (copy=true,feature_range= (0,1)). Fit_transform (Dataset3_preds.label)
For example, a data format of [1, 2, 3, 4] would be an error, if this line of data is converted to [[1], [2], [3], [4]]
Dataset3_preds.label = Minmaxscaler (copy=true,feature_range= (0,1)). Fit_transform (Dataset3_preds.label.reshape (- 1,1) #修改后
Run the program again, error elimination.