Seeking Advises on how to perform One Class classification on a text data

3 views (last 30 days)
Hi
I have some doubts on implementation of one class classifier . This question is trying to explain how am I implementing the one class classifier and I hope you will advice me whether I am approaching right way or not.
I am experimenting on applying one class classification upon a text dataset with 2 classes (class 1 and class 0).It is a balanced dataset. Intially my train matrix is of size 3000x100. After eliminating a class for the purpose of training my model for one class, it's reduced to 1500x100 (contains only class 1). And the test/validation matrix is of size 2000x100 where data of 2 classes exists (contains data for class 1 and for class 0).
To train the model, I am applying the following codeblock upon train data and have tried to calculate the precision, recall and F1:
model=fitcsvm(ReducedDataset,ReducedClassSet,'Standardize',true,'OutlierFraction',0.05);
predTrain = predict(model,ReducedDataset);
[recall,precision,f1]= scores(ReducedClassSet,predTrain);
where, ReducedDataset and ReducedClassSet represents the train matrix and classes. The scores I have achieved are 1, 1 and 1. After applying the model on the test data
prediction= predict(model,ReducedTestDataset);
[recall,precision,F1]= scores(classTest, prediction);
I get the scores of 1,0.5004 and NaN( which seems illogical to me).
My question is am I following the proper way of applying one class classifier? If am not, what should be the right approach then?
I am looking for your advice, in this regard.
Thanks,

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!