ML Two
Lecture 08
πŸ€—NLP 102: Sentiment Analysis with CreateML😎
Welcome πŸ‘©β€πŸŽ€πŸ§‘β€πŸŽ€πŸ‘¨β€πŸŽ€
First of all, don't forget to confirm your attendence on Seats App!
a Linkin Park MV to wake us up
after today's lecture:
-- A few more NLP basic tasks with Apple Natural Language Framework
-- Advanced NLP: Sentiment analysis
Recap on last week

-- Introduction to NLP πŸŽƒ
-- Some basic NLP tasks solved with Apple NL framework
--- Language identification
--- Named Entity Recognition
--- Part-of-speech tagging
NLP:
from wikipedia:
-- "the application of computational techniques to the analysis and synthesis of natural language and speech.""
-- it is an interdisciplinary subfield
Example applications of NLP:
text-to-speech πŸ—£οΈ
speech-to-text πŸ‘‚
machine translation 🧠
image captioning πŸ§‘β€πŸ«
text-to-image generation πŸ§‘β€πŸŽ¨
etc.
Extend to this week

Basic NLP tasks
--- Language identification
--- Named Entity Recognition
--- Part-of-speech tagging
--- Lemmatization (NEW❀️‍πŸ”₯)
--- Tokennization (NEW❀️‍πŸ”₯)
Higher-level NLP tasks
--- Sentiment analysis (NEW❀️‍πŸ”₯)
this one playground containing all basic NLP tasks in Apple NL framework
download and revise πŸŽƒ
---Language identification (line 1-57)
---Named Entity Recognition (line 59-101)
---Part-of-speech tagging (line 144-181)
Your turn: open a new xcode playground, import the framework:
import NaturalLanguage 
import Foundation 
import CoreML
Tokenization
--1. Read about Tokenization: what is it about? πŸ₯·
--2. Copy relevant code from
line 103-142
--3. paste and run the example codes! πŸ•ΉοΈ
Lemmatization
--1. Read about Lemmatization: what is it about? πŸ₯·
--2. Copy relevant code from
line 183-212
--3. paste and run the example codes! πŸ•ΉοΈ
Higher level NLP task -
Sentiment Analysis
EASY AND HANDY!
It's a classification task
input: text (a sentence, a paragraph, etc.)
output: what are the output classes?
output:
positive or negative
(or neutral)
Sentiment analysis:
"the process of computationally identifying and categorizing opinions expressed in a piece of text, especially in order to determine whether the writer's attitude towards a particular topic, product, etc. is positive, negative, or neutral."
Sounds familiar?
It is a classification task with two or three categories: negative/positive/(neutral).
It is a classification task, which means it has almost the same principles as image classification πŸ₯°
The only difference 😈 : different data modality, one takes text as input vs. takes image as input
CreateML takes good care for us again!
Training:
Data
(epinions3.zip )
Let's take a look at what "sentiment analysis" data should look like
the data: pairs of text with its label
Training:
-- 1. Download and unzip Data
-- 2. Read through this Apple Document
-- 3. Use this Playground for training
(don't forget to change the corresponding file path! )
(specify a cooler model name)
Deployment:
-- 1. Download and unzip app code
-- 2. Drop in your freshly trained model
-- 3. Run! (tested on MacOS)
ai artist of this week: Sofia Crespo
keywords:
biology-inspired AI; artificial biodiversity
πŸŽ‰
today we talked about:

Basic NLP tasks solved with Apple NL framework
--- Lemmatization
--- Tokennization
Higher level NLP task - sentiment analysis
--- CreateML training done on playground!!!
A weekly gentle reminder of the final assessment presentation ✌️πŸ₯
We'll see you next week same time same place! 🫑