Skip to content

a-ro/watson-certification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

watson-certification

Practical examples for Watson Certification

I created this project to study before the Watson certification exam. I was following this guide released by IBM which details the exam objectives. Note that these answers are my own and have not been validated by IBM.

Due to a lack of time, I only coded examples with Watson Services I've never used before. I already passed my certification so I won't add anything more.

Check the project of Jeronimo De Leon for a more complete Watson certification study guide.

Installation

pip install -r requirements.txt

For seaborn to work, you need to install tkinter

sudo apt-get install python3-tk

Examples

To run the examples, you need to change the credentials in config.py with your own credentials.

Personality Insights

Run the example to analyze Trump personality with the following command:

python section3/personality/personality_insights_example.py

Trump Personality Analysis

The code uses this Donald Trump's speech in text format as input.

We can obtain the results in a CSV format that shows a percentage for each personality trait:

big5_agreeableness facet_altruism facet_cooperation facet_modesty facet_morality facet_sympathy facet_trust big5_conscientiousness facet_achievement_striving facet_cautiousness facet_dutifulness facet_orderliness facet_self_discipline facet_self_efficacy big5_extraversion facet_activity_level facet_assertiveness facet_cheerfulness facet_excitement_seeking facet_friendliness facet_gregariousness big5_neuroticism facet_anger facet_anxiety facet_depression facet_immoderation facet_self_consciousness facet_vulnerability big5_openness facet_adventurousness facet_artistic_interests facet_emotionality facet_imagination facet_intellect facet_liberalism need_liberty need_ideal need_love need_practicality need_self_expression need_stability need_structure need_challenge need_closeness need_curiosity need_excitement need_harmony value_conservation value_hedonism value_openness_to_change value_self_enhancement value_self_transcendence behavior_sunday behavior_monday behavior_tuesday behavior_wednesday behavior_thursday behavior_friday behavior_saturday behavior_0000 behavior_0100 behavior_0200 behavior_0300 behavior_0400 behavior_0500 behavior_0600 behavior_0700 behavior_0800 behavior_0900 behavior_1000 behavior_1100 behavior_1200 behavior_1300 behavior_1400 behavior_1500 behavior_1600 behavior_1700 behavior_1800 behavior_1900 behavior_2000 behavior_2100 behavior_2200 behavior_2300 word_count processed_language
0.4268979029309932 0.8588535687537024 0.7044867158268264 0.5960736895707534 0.9676444453908276 0.9965335147666688 0.3998040334289172 0.9797657117581102 0.9070143051529225 0.9869915635122488 0.873983697434251 0.5488031217574947 0.9124250982342645 0.8090432365930695 0.6096825298389489 0.8828473589475007 0.9857260415356135 0.11637254228155247 0.01331810918980908 0.5959055919648221 0.16756739770553347 0.9505346628850558 0.02812768408642924 0.02455406377266378 0.168454469161186 0.05865378787277559 0.05754389444307567 0.015989819272919148 0.975519694665306 0.8328642953776038 0.654203608334551 0.24646836689211954 0.05370347126940961 0.9915865625089948 0.7792134600310711 0.01694074812415025 0.04771121338963841 0.0030600042610637868 0.023556425868524244 0.05084809704946042 0.23156088075382475 0.6470820764350991 0.028222045621644876 0.15436495592219218 0.3881229129662421 0.03816743693922564 0.035899020822038996 0.11167207177920224 0.01957680225835251 0.37441584209106304 6.717299135493016E-4 0.11547777255812258 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6832 en

With a bit of seaborn magic, we can visualize Trump's personality results a bit more clearly:

Trump Personality

According to the Personality Insights documentation, people who score high on Sympathy are tender-hearted and compassionate. Seriously Watson, Trump's highest personality trait is SYMPATHY? ;) But hey, I do agree he clearly doesn't need love.

Tone Analyzer

Run the example to analyze the tone of a text with the following command:

python section3/tone/tone_analyzer_example.py

Angry Sarcastic Text Analysis

The example analyzes this customer complaint.

The Tone Analyzer will return a percentage value for each tone analyzed per sentence:

The text is divided into the following sentences:

Dear Birmingham Airport Authority

Would it be possible to install a louder, more annoying warning siren for the baggage carousels?

The Martian ray-gun sound that you have installed at present is almost, but not quite, enough to induce insanity in arriving passengers as they await their luggage.

When it fails to stop sounding, it comes very close.

Such as last night, when it went off for about 15 minutes straight (all the while the ground crew failed to push the "deliver bags" button to operate the conveyor).

We obtain the following results:

Sentence Emotion Tone:Anger Emotion Tone:Disgust Emotion Tone:Fear Emotion Tone:Joy Emotion Tone:Sadness Language Tone:Analytical Language Tone:Confident Language Tone:Tentative Social Tone:Agreeableness Social Tone:Conscientiousness Social Tone:Emotional Range Social Tone:Extraversion Social Tone:Openness
0 0.174853 0.045767 0.203073 0.363684 0.288548 0.0 0.0 0.0 0.601976 0.274405 0.287173 0.549738 0.192534
1 0.413234 0.332002 0.11745 0.09863 0.157501 0.029341 0.0 0.615352 0.092194 0.01064 0.289132 0.227488 0.732911
2 0.103462 0.261834 0.461912 0.015445 0.308681 0.403089 0.0 0.5538 0.408464 0.509407 0.664799 0.305697 0.814446
3 0.240445 0.10141 0.188986 0.049759 0.529359 0.0 0.849827 0.0 0.620178 0.041014 0.039034 0.312732 0.112508
4 0.24863 0.144169 0.370541 0.075804 0.290018 0.85019 0.204269 0.0 0.002668 0.907311 0.915778 0.457429 0.078753

Tone Results

Well he's clearly open to change the Martian Ray-Gun alarm so I'm guessing that openness is right. It seems the results are a bit like the horoscope, you can pretty much find a reason why they fit for whatever gets predicted.

Visual Recognition

Classify images with the default ibm classifier:

python section3/vision/predict_ibm_classifier.py 

Train a custom fruit classifier.

python section3/vision/train_fruit_classifier.py 

Use your custom fruit classifier to classify images. You must add the classifier_id in the config.py file.

python section3/vision/predict_custom_classifier.py 

Is Chuck Norris a Fruit?

Spoiler: he's not.

The classifiers are tested on the following images: Fruit Man Chuck Norris Grumpy Cat Unicorn Man

IBM Pre-Trained classifier results

image classes score
FruitMan vegetation, food 0.73, 0.57
ChuckNorris person 0.83
GrumpyCat animal, mammal, cat 1.00, 1.00, 0.98
UnicornMan person 0.99

Custom Fruit Classifier results

image class score
FruitMan fruit 0.53
ChuckNorris not a fruit
GrumpyCat not a fruit
UnicornMan not a fruit

Sections

Similar Projects

Check the project of Jeronimo De Leon for a more complete Watson certification study guide.

About

Study Guide for Watson Certification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages