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!!!
We'll see you next week same time same place! π«‘