I used VGG16 as feature extractor on a dataset with 9 classes and trained the Random Forest Classifier on the feature vector. I tried to make prediction on the test feature vector but the prediction is an array of zeroes. What am i doing wrong ?
-
$\begingroup$ What is the accuracy of your model? It might simply be that your current model doesn't fit the data very well and therefore always predict zero. $\endgroup$– OxbowerceJan 4 at 11:34
-
$\begingroup$ @Oxbowerce The accuracy is 0. I tried fitting the RandomForestClassifier on test_feature_vector and tried to predict it on part of train_feature_vector and still got all zero array. $\endgroup$– grayJan 4 at 11:40
-
$\begingroup$ Then it simply means that your model is unable to fit the data well. This can be caused by the fact that your model is too simple or your features are simply not predictive. Try changing the hyperparameters of your model to see if it improves the performance. $\endgroup$– OxbowerceJan 4 at 11:42
-
$\begingroup$ I looked at the notebook. You are using VGG models, which were built for detecting objects like car etc. Using that as a feature extraction layer for cancer detection is not going to work well. You can try other feature extraction methods or fit custom layers! $\endgroup$– hssayJan 4 at 13:11
-
1$\begingroup$ @hssay Im trying to recreate the architecture from this paper igi-global.com/gateway/article/full-text-html/… $\endgroup$– grayJan 4 at 13:56
1 Answer
Your model is not learning. The result is constant predictions on the test dataset.
There could be many reasons for not learning. A couple of the most common reasons:
- Not enough data
- Not expressive enough machine learning algorithm
- Incorrect hyperparameter choices
- Not training long enough