I recently started playing with SVMs for a one class classification, I was able to get some reasonable classifications from real data and but was trying to optimize the nu and gamma parameters when I came across this example:
In the code below, I train an SVM with an array of ones, then I present the same array of ones for classification and it classifies all ones as outliers.
import pandas as pd
from sklearn import svm
import numpy as np
nu = 0.01
gamma = 1
ones = pd.DataFrame(np.ones(100))
clf = svm.OneClassSVM(nu=nu, kernel="rbf", gamma=gamma)
clf.fit(ones)
ones["predicted"] = clf.predict(ones)
#Returns -1 for all entries
My question is: why does this happen? I thought this data would be trivial for any parameter configuration.