yoonkim / CNN_sentence

CNNs for sentence classification
2.05k stars 826 forks source link

Getting class probablitly vectors from the intermediate layers #24

Closed rohitiyer91 closed 8 years ago

rohitiyer91 commented 8 years ago

Hi, I am trying to use CNN_sentence to classify tweets into one of the K predefined topics. Although I am able to get the final ouput class for each tweet, I am more interested in the probability vector in the layer right before the ouput layer based on which its decided which class the tweet should belong to. eg. If I have 3 classes and the output class for a given tweet is [2], the I assume the previous layer would be dealing with a class-wise probability which could be something like [0.3 , 0.78, 0.1] for class 1, 2, 3 respectively(just an example).

[test_loss,y_pred] = test_model_all(test_set_x,test_set_y) the variable "y_pred" gives me the final output but not the class probabilities but not class probabilities. Can you suggest a way to get these probs ?