SVM回归

from sklearn.svm import SVR
import numpy as np
n_samples, n_features = 10, 5
np.random.seed(0)
y = np.random.randn(n_samples)
x= np.random.randn(n_samples, n_features)
clf = SVR(gamma='scale', C=1.0, epsilon=0.2)
clf.fit(x, y) 
print clf.predict(x)

[0.8867917 0.60015717 0.98330982 1.84870095 0.91180516 0.37960652
1.03115487 0.04864277 0.33332094 0.33921419]

from sklearn.svm import SVR
import numpy as np
n_samples, n_features = 10, 5
np.random.seed(0)
y = np.random.randn(n_samples)
X = np.random.randn(n_samples, n_features)
clf = SVR(kernel="poly",degree=3,gamma="scale",C=0.8)
clf.fit(X, y) 
clf.predict(X)

你可能感兴趣的:(AI)