Retrieving relevant paintings based on emotion of the answer.
moods = ['anger', 'anticipation', 'disgust', 'fear', 'joy', 'negative', 'positive', 'sadness', 'surprise', 'trust']
final_emotions
anger | anticipation | disgust | fear | joy | negative | positive | sadness | surprise | trust | |
---|---|---|---|---|---|---|---|---|---|---|
0 | ||||||||||
abacus | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
abandon | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
abandoned | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
abandonment | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
abba | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
abbot | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
abduction | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
aberrant | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
aberration | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
abhor | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
6468 rows × 10 columns
paintings = pd.read_csv('WikiArt-Emotions/WikiArt-Emotions-All.tsv', delimiter='\t')
filter_col = ['Image URL', 'Art (image+title): anger', 'Art (image+title): anticipation', 'Art (image+title): disgust', 'Art (image+title): fear', 'Art (image+title): happiness', 'Art (image+title): pessimism', 'Art (image+title): optimism', 'Art (image+title): sadness', 'Art (image+title): surprise', 'Art (image+title): trust']
filtered_paintings = paintings[filter_col]
Image URL | Art (image+title): anger | Art (image+title): anticipation | Art (image+title): disgust | Art (image+title): fear | Art (image+title): happiness | Art (image+title): pessimism | Art (image+title): optimism | Art (image+title): sadness | Art (image+title): surprise | Art (image+title): trust | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | https://use2-uploads3.wikiart.org/00123/images... | 0.012 | 0.071 | 0.000 | 0.036 | 0.750 | 0.048 | 0.333 | 0.131 | 0.048 | 0.274 |
1 | https://use2-uploads1.wikiart.org/images/keith... | 0.000 | 0.500 | 0.100 | 0.300 | 0.100 | 0.200 | 0.100 | 0.100 | 0.500 | 0.100 |
2 | https://use2-uploads3.wikiart.org/images/j-zse... | 0.000 | 0.200 | 0.000 | 0.000 | 0.500 | 0.000 | 0.300 | 0.000 | 0.100 | 0.300 |
3 | https://use2-uploads2.wikiart.org/00124/images... | 0.000 | 0.091 | 0.091 | 0.091 | 0.091 | 0.091 | 0.091 | 0.273 | 0.182 | 0.000 |
4 | https://use2-uploads6.wikiart.org/images/david... | 0.231 | 0.154 | 0.231 | 0.308 | 0.154 | 0.154 | 0.231 | 0.231 | 0.077 | 0.538 |
5 | https://use2-uploads4.wikiart.org/images/lyone... | 0.000 | 0.134 | 0.030 | 0.134 | 0.358 | 0.104 | 0.134 | 0.090 | 0.224 | 0.090 |
6 | https://use2-uploads1.wikiart.org/images/nikol... | 0.000 | 0.100 | 0.000 | 0.600 | 0.100 | 0.100 | 0.000 | 0.300 | 0.000 | 0.100 |
7 | https://use2-uploads7.wikiart.org/images/charl... | 0.000 | 0.000 | 0.000 | 0.000 | 0.700 | 0.100 | 0.400 | 0.100 | 0.000 | 0.200 |
8 | https://use2-uploads7.wikiart.org/images/rober... | 0.000 | 0.417 | 0.083 | 0.083 | 0.000 | 0.083 | 0.000 | 0.167 | 0.500 | 0.000 |
9 | https://use2-uploads7.wikiart.org/images/richa... | 0.000 | 0.100 | 0.200 | 0.000 | 0.000 | 0.000 | 0.000 | 0.100 | 0.400 | 0.000 |
10 | https://use2-uploads8.wikiart.org/images/patri... | 0.000 | 0.091 | 0.091 | 0.000 | 0.636 | 0.000 | 0.182 | 0.000 | 0.091 | 0.182 |
4105 rows × 11 columns
from sklearn.neighbors import NearestNeighbors
nn = NearestNeighbors(1).fit(all_paintings)
dists, idxs = nn.kneighbors(person3.reshape(1,10))
filtered_paintings.iloc[idxs[0][0]]
Art (image+title): anger 0.1
Art (image+title): anticipation 0.1
Art (image+title): disgust 0.0
Art (image+title): fear 0.0
Art (image+title): happiness 0.6
Art (image+title): pessimism 0.0
Art (image+title): optimism 0.6
Art (image+title): sadness 0.0
Art (image+title): surprise 0.1
Art (image+title): trust 0.8
Name: https://use2-uploads7.wikiart.org/images/eduardo-arroyo/winston-churchill-1970.jpg, dtype: float64
['I am a feminist, a student, and a homosexual.', 'I am kind, nurturing, caring, and genuine.', ' My honesty, my loyalty, and my generosity make me me.']
['feminist', 'genuine', 'generosity']
["I'm a boring person", "I'm quiet and introspective.", ' I have deep wells of sorrow.']
['boring', 'introspective', 'sorrow']
['I am a licensed counselor.', "I'm silly and funny.", " I'm fun and sarcastic a lot of the time."]
['licensed', 'silly', 'sarcastic']
["I'm Jim, a 53 year old american man", "I'm forceful, happy, calm and occasionally grumpy with a touch of sarcasm.", " I'm a drivan dominant at work and play. My wife is essential to my life. I'd be lost without her grounding me."]
['american', 'forceful', 'dominant']
["I'm a fat, biracial bisexual woman.", "I'm a funny depressive--aren't all depressives a riot?", " I'm a boring drudge, not glamorous or fancy, but fairly dependable."]
['biracial', 'riot', 'drudge']
['I am an adventurous geeky skydiver', 'I am fun-loving and love life.', ' I am intelligent and caring.']
['skydiver', 'life', 'intelligent']
['I am a daughter, sister, friend, and advocate', "I advocate for those who don't have a voice", ' I care so deeply about children involved in the system and I will do almost anything to help them!']
['advocate', 'voice', 'system']
['an inquisitive person', 'friendly and approachable', ' a desire to always learn new things']
['inquisitive', 'approachable', 'desire']
['I am a working mom.', 'I am calm, determined, and loving.', ' The essence of what makes me is my compassion and caring.']
['mom', 'determined', 'compassion']
["I'm a wife and mother of 5 children.", 'I am introverted, honest and generous.', ' My Catholic faith is a big part of who I am and how I live my life.']
['children', 'generous', 'catholic']
['i am a hard working smart female', 'im funny yet clever and warm', ' love for animals and others makes me who i am']
['smart', 'clever', 'animals']
['A girl', 'I am silly', 'I love dogs']
['girl', 'silly', 'dogs']
['I AM A MIDDLE AGED PROFESSIONAL GRAPHICS DESIGNER.', 'I AM CHARMING AND CREATIVE.', 'I AM ARTISTIC AND CREATIVE. CAN I DESIGN SOMETHING FOR YOU? ANYTHING, YOU NAME IT.']
['graphics', 'charming', 'design']
['I am a female.', 'I am outgoing, outspoken, and caring and funny.', 'My ability to approach things from a mindful perspective of others, even if not so much for myself.']
['female', 'outspoken', 'mindful']
['I am a woman in my early 30s struggling to find success and fulfillment in life.', 'I am cynical, edgy and crafty.', 'My wry sense of humor']
['fulfillment', 'edgy', 'wry']
['I am an artist.', 'I am quiet and energetic.', 'I am a woman of divine origins, living on Earth at this time.']
['artist', 'energetic', 'origins']
['I am a twin.', 'I am very creative', 'What makes me who I am is my strive to achieve my goals.']
['twin', 'creative', 'strive']
['I am a self confident woman who is loyal and generous.', 'I have an outgoing personality and love to travel!', 'I have a nurturing soul and find my peace in nature.']
['confident', 'travel', 'peace']
['I am Leigh Ann Little -- publisher, writer, historian, lover of classic films, parent, and servent of Yahwey (in reverse order).', "I am extremely devoted to serving the Lord and making the world a better place through activism and publishing, and I'm a nostalgia buff as well, devoting lots of time to preserving historical things..", 'The essence of what makes me ME is quite simple -- I was put on this planet by a deity named Yahweh to fulfill HIS purposes, and enjoy the benfitis of living on this planet with His many blessings and protection.']
['classic', 'preserving', 'planet']
['A man with a plan', 'Honest and loyal', 'Integrity']
['plan', 'loyal', 'integrity']
['am a christian', 'i love the lord', 'love']
['christian', 'lord', 'love']
['I am a young female wife.', 'I am intelligent, quiet, & an introvert.', 'My interests make me who I am: video games, books, exercise, food']
['young', 'introvert', 'exercise']
['I am a traveling artist and dancer.', "I'm brave and smart and very much in love. I have vices but I try to balance them. I love the world and am generally excited about life.", "A deep spinning twirling gyroscopic, bright-eyed jewel full of love and joy. I realize that's kind of a weird thing to say but it's my real answer."]
['traveling', 'vices', 'twirling']
['I am an intelligent thirty-something single female.', 'I am kind-hearted and soft-spoken, gentle, and helpful.', 'I am very quirky and have unique interests, but very wise.']
['single', 'gentle', 'wise']
['I am a woman', 'I am loving, kind, caring, patient and guarded', 'I love books, cats, relaxing, travel and my family']
['woman', 'guarded', 'relaxing']
['I am Catholic.', 'I try to be holy.', 'I am the creation of our Lord Jesus Christ.']
['catholic', 'holy', 'creation']
['I am a beautiful queen.', 'I am like a warm summer day walking in the park with a breeze and you just got your favorite ice cream.', 'My faith in GOD.']
['queen', 'summer', 'faith']
['I am a kind person', 'I am adventurous and friendly.', 'My love for travel and music']
['kind', 'adventurous', 'travel']
['I am an older female who is married and a mother of three.', 'I am quiet until I get to know you. I am kind and considerate and I care about people.', 'My past experiences in life and with people all make up who I am.']
['older', 'considerate', 'past']
['I am a mother.', "I'm very controlling.", 'I am very complex.']
['mother', 'controlling', 'complex']
['I work at a library and am a mother of three.', 'I am friendly and helpful.', 'I am generous and caring.']
['library', 'helpful', 'generous']
['I am a skeptic', 'I question everything', 'I take nothing for granted. I make others think about things in a different way. I am the opposite of ordinary.']
['skeptic', 'question', 'granted']
['I am a respected, kind, professional person.', "I'm a very reasonable, fun, and energetic.", 'My great personality, being compassionate, and having empathy makes me who I am.']
['respected', 'reasonable', 'empathy']
['I am a wife and a mother.', 'I am kind and caring and hard working.', 'I am a family person who loves to cacre for others.']
['wife', 'working', 'care']
['A loving, compassionate, loyal woman to friends and family.', "I'm laid back, fun, easy going and forgiving", 'Jesus is the essence of all that is good in me.']
['loyal', 'forgiving', 'jesus']