Reputation: 3895
Im doing outlier detection with Python
's Scikit-Learn
lib. Im using OneClassSVM
.
I have a problem with that because when ever I run my code (I do not get error), it prints [LibSVM].
I do not know why am I getting this, I do not have print function anywhere in my code.
out_cls = [['One class SVM',OneClassSVM(cache_size=80, coef0=0.5, gamma ='auto', kernel = 'poly', random_state= None, shrinking=True, tol = 0.1, verbose = True, nu = 0.2)],
['Isolation Forest', IsolationForest(behaviour='new', contamination='auto',max_features=4, max_samples=2, n_estimators= 90, random_state=1)]]
r = df
for out in out_cls:
cls = out[1]
model = cls.fit(x)
prediction = model.predict(x)
# print(model.best_params_)
result = []
for i in prediction:
if i == -1:
result.append('BOT')
else:
result.append('good')
r[out[0]] = result
Upvotes: 0
Views: 234
Reputation: 60370
All underlying SVM functionality in scikit-learn is actually based on LibSVM; from the docs of OneClassSVM
:
The implementation is based on libsvm.
See also the numerous references of this in the source code.
This console output is just an artifact of setting verbose=True
in the model definition; adapting the simple example from the docs:
from sklearn.svm import OneClassSVM
X=[[0], [0.44], [0.45], [0.46], [1]]
clf = OneClassSVM(gamma='auto', verbose=True)
clf.fit(X)
The display output is:
[LibSVM]
OneClassSVM(cache_size=200, coef0=0.0, degree=3, gamma='auto', kernel='rbf',
max_iter=-1, nu=0.5, random_state=None, shrinking=True, tol=0.001,
verbose=True)
Setting verbose=False
dismisses the [LibSVM]
indication, which, in any case, is not a problem, as it does not affect your code in any way.
Upvotes: 1