0
$\begingroup$

I have a dataset consisting only of the positive class, and I want to train a model to identify this data. Is it possible to use one-class classification models for this task? Additionally, how can I calculate accuracy, precision,recall... when there are no negative examples in the dataset?

$\endgroup$

1 Answer 1

1
$\begingroup$

Sure, you can use a OneClassSVM model or an IsolationForest (read also this). Basically, you feed them the data you have (regardless of the class label) and the model scores your data (according to an anomaly score defined by the author of the method): this if you use the .score_samples(x) method, otherwise the .predict(x) method returns you either $1$ or $-1$ label.

Indeed, to evaluate the trained model you should to collect at least a small validation set, in which there are both classes (inliers and outliers, or normal samples and anomalies) to compute the usual classification metrics.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.