1

I want to do SVM classification (i.e. OneClassSVM) with sklearn.svm.OneClassSVM on physical states that come from a different library (tenpy). I'd define a custom kernel

def overlap(X,Y):
    return np.array([[x.overlap(y) for y in Y] for x in X])

where overlap() is a defined function in said library to calculate the overlap between states. When I try to fit with my data

clf = OneClassSVM(kernel=overlap)
clf.fit(states)

where states is a list of such state objects, I get the error

TypeError: float() argument must be a string or a number, not 'MPS'

Is there a way to tell sklearn to ignore this test (w/o editing the source code)?

To my understanding the nature of the data and how it's processed is in principal not essential to the algorithm as long as there is a well-defined kernel for the objects.

Korbinian
  • 43
  • 4

0 Answers0