I am looking to output the parameters associated with a OneClassSVM fit in Python. More specifically, the parameters from the original source paper:
Here is a minimal example in code:
import numpy as np
from sklearn.svm import OneClassSVM
X = np.random.multivariate_normal(np.ones(2), np.eye(2), 100)
method = OneClassSVM(nu=0.1)
method.fit(X)
So I would like to access w
, xi
, rho
, as well as the kernel function which makes Phi
. I have learned that I can get rho
by using method.offset_
, but do not know which elements of method
will give me the other parameters. The reason I need these parameters is because I wish to differentiate the decision function outputted by One Class SVM, without using finite differencing. My ideal output would be a function f(method)
which outputs all parameters, or outputs the decision function evaluations and its derivative with respect to the input data x
.
Attempted Solution
I have managed to implement a One Class SVM solution manually, using scipy
's constrained optimisation, but it is far slower than the sklearn
implementation, so I would like to use the sklearn
version directly.