jkwieser / personality-prediction-from-text

Predicting big five personality traits from a given text.
MIT License
146 stars 46 forks source link

I don't understand the .score meaning #9

Open JeromeHdz opened 2 years ago

JeromeHdz commented 2 years ago

Hello !

First of all, thank you for your great work it really useful !

I wanted to ask you what your score is meaning

And how can I calculate an F1-Score from model_bow.ipynb for example?

I'm a little bit lost about how you create your training and test set as there is train_x_vectors.

I'm not sure I understand what is a x_vector & train_y_cEXT.

JeromeHdz commented 2 years ago

Ok I find the solution, I was a little bit perturbated by the different names of your variable but for people who want to have an example of how you can have different metrics this is it:

print("training Extraversion cEXT using SVM...")
clf_svm_cEXT = svm.SVC(kernel='linear')
clf_svm_cEXT = clf_svm_cEXT.fit(train_x_vectors, train_y_cEXT)
evaluation.append([data, vec_name, name, "cEXT", clf_svm_cEXT.score(test_x_vectors, test_y_cEXT)])
print("cEXT score: ", clf_svm_cEXT.score(test_x_vectors, test_y_cEXT))

predicted = clf_svm_cEXT.predict(test_x_vectors)
print("accuracy",metrics.accuracy_score(test_y_cEXT, predicted))
print("f1 score macro",metrics.f1_score(test_y_cEXT, predicted, average='macro') )
print("f1 score micro",metrics.f1_score(test_y_cEXT, predicted, average='micro') )
print("precision score",metrics.precision_score(test_y_cEXT, predicted, average='macro') )
print("recall score",metrics.recall_score(test_y_cEXT, predicted, average='macro') )
print("hamming_loss",metrics.hamming_loss(test_y_cEXT, predicted))
print("classification_report", metrics.classification_report(test_y_cEXT, predicted))
jkwieser commented 2 years ago

Hi Jeroma, thank you very much for contacting me. I'm super happy for the feedback. If you found the solution already that's even better, as I'm out of the code since more than a year. Hope the project still helps - if you like it, I'd appreciate a "Star" on github for the project! =) Best Johannes

On Wed, Mar 2, 2022 at 3:24 PM Jerome Hernandez @.***> wrote:

Ok I find the solution, I was a little bit perturbated by the different names of your variable but for people who want to have an example of how you can have different metrics this is it: `print("training Extraversion cEXT using SVM...") clf_svm_cEXT = svm.SVC(kernel='linear') clf_svm_cEXT = clf_svm_cEXT.fit(train_x_vectors, train_y_cEXT) evaluation.append([data, vec_name, name, "cEXT", clf_svm_cEXT.score(test_x_vectors, test_y_cEXT)]) print("cEXT score: ", clf_svm_cEXT.score(test_x_vectors, test_y_cEXT))

predicted = clf_svm_cEXT.predict(test_x_vectors) print("accuracy",metrics.accuracy_score(test_y_cEXT, predicted)) print("f1 score macro",metrics.f1_score(test_y_cEXT, predicted, average='macro') ) print("f1 score micro",metrics.f1_score(test_y_cEXT, predicted, average='micro') ) print("precision score",metrics.precision_score(test_y_cEXT, predicted, average='macro') ) print("recall score",metrics.recall_score(test_y_cEXT, predicted, average='macro') ) print("hamming_loss",metrics.hamming_loss(test_y_cEXT, predicted)) print("classification_report", metrics.classification_report(test_y_cEXT, predicted))`

— Reply to this email directly, view it on GitHub https://github.com/jkwieser/personality-detection-text/issues/9#issuecomment-1056985942, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMOQS4FITIMVMCRRZ6B4U3U552ZBANCNFSM5PXRGK4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

JeromeHdz commented 2 years ago

For sure !

Thanks for you work ! <3