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?
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.