As a person who learned coding I can't do this annoying thing myself.
Let's create a macro.
Read and add one by one.
67% chance that "you are the best" is a good word
When comment like this is written..
This is JoCoding, making a channel where everyone can learn coding easily.
In this video we'll learn
Machine Learning for Kids, an educational machine learning site
similar to the Teachable Machine we covered last time.
From there, I'm going to make an emotion for the
artificial intelligence using text recognition AI.
Let's see how AI responds to our comments.
Before starting the lecture, please understand that
this video was be sponsored by ASUS on the ZenBook Duo UX481 model
and I will be using the latest dual-screen notebook for the lecture.
First, let me briefly introduce the Zenbook Duo UX481.
Uniquely, this laptop has one more screen.
You can touch and write with a separate pen that is provided.
Also, when opening the laptop, there is a slight tilt,
so I could type in the keyboard more comfortably.
The touchpad was also pretty good,
so I thought wouldn't need a mouse.
In addition, I will briefly show you how to use the ZenBook Duo during the course.
Then let's see on the screen together!
This site is the Machine Learning for Kids homepage I will introduce to you today.
The address is machinelearningforkids.co.uk
I'll leave the address in the below and in the comments.
You might think because the site
is named "Kids" that it's a service for kids.
But that's not necessarily true.
Internally, it uses Watson, IBM's artificial intelligence,
and can deliver even higher-than-expected services.
Press the "Let's get started" button to get started.
This will bring up a login screen.
No need to register
Just click on "Try Now" on the Skip Registration section.
You can start right away.
Create a new project by pressing the Add Project button
The project is to make an emotion for the AI
so name it emotion.
The recognition method will be specified as "text".
You can do machine learning with images, numbers, and sounds in addition to text.
And for the language, I will choose Korean.
Then press the "Create" button.
The project has been created.
Click into the project and enter.
This will bring up 3 tabs.
If you look at them one by one, the "Training" tab
this which is where you put the data that allows
the AI to learn to be created.
In the "Learning & Assessment" tab,
Models are created through machine learning
based on the data provided in "Training".
You can then evaluate the model to see how accurate it is.
And on the "Create" tab, you can easily create
your own AI program using this model.
AI, Machine Learning, Data, Model
If you are not familiar with these words,
please refer to the previous video.
First of all go to the "Training" tab.
Here you can give the data AI needs to learn.
We will teach good words and bad words
so that the AI can recognize
which ones are good and which ones are bad.
I'll press "Add new label" button on the right
and add a "label".
Because we are going to distinguish between good and bad words
let's add a label called "good"
and another label called "bad".
Then press the "Add Data" button at the
bottom to add data.
It's a good word so I'll add "Like".
The word is added.
You can continue to add in this way.
However, I thought it would take a long time
to add and think one by one, so I searched on Google
and there was an "Emotional Word Dictionary" Excel file provided by BK 21.
When I opened the file, I was able to see
what emotions are in each word and how strong the emotions are.
There are data for a total of 428 words.
If the emotion category is hate or sadness, put it as "bad" data.
It's good to put joy or interest in the word "good."
Then from number one, "What a show" is a hate so in the "bad" label
"What a show" add it like this.
But if you enter 428 pieces of data like this,
wouldn't it be troublesome?
As a person who learned coding I can't do this annoying thing myself.
Let's create a macro to automate it.
I wrote the code like this.
I think it will get too long to cover the detailed lectures on macros,
so I'll prepare the video on this later.
It's a code that selects the emotion category from the Excel file
with pleasure or interest and extracts 50 words with high emotion
and automatically inputs the words.
So let's run it.
Switch screens and run Python macro code.
Then it reads the words from Excel and add them one by one by itself.
Let's do the same procedure with the word bad.
Dual Screen and macro was used to proceed conveniently.
When data input is completed, click the Return to Project button on the left.
And go to the "Learning & Assessment" tab
This is a screen to create a model by training based on the data we entered.
Press the button at the bottom.
This should look like this,
and after a while, the training is complete and the model is created.
Creation is complete.
Now you can enter some text here
and test what results
we get through our model.
For example, if I type "you are the best" and press test,
I get a 67% chance that "you are the best" is a good word.
When training the model, I didn't teach the sentence "You are the best," itself.
Artificial intelligence broke down the model and analyzed it.
Perhaps because of the word "best",
that made it recognize it as a positive sentence.
On the contrary, let's say a bad word.
"You're a bad guy" will have a 79% chance "bad".
The model is pretty good.
Then come back up and hit "Back to Project."
Then click the "Create" button on the Create tab.
Here we can use our model in a variety of ways.
You can use Scratch
or create an app with App Inventor.
You can also use Python for other programs.
In this lesson, we will create
a simple program using Scratch 3.
Press the "Scratch 3" button.
Press the "Open Scratch 3" button on the left.
You have entered the Scratch screen.
If you are unfamiliar with scratch,
please refer to my previous scratch course.
Here we'll create an artificial intelligence with emotions that respond to
the contents of a comment if we leave a comment.
First, let's make the expression of the AI character.
Go to the "Appearance" tab at the top.
Scratch basically contains a cat character.
Let's get rid of this and draw a new character.
In the upper shape section, make it expressionless at first.
Press the "Draw" button at the bottom to add a new shape.
Let's make two more and make number two with joy
and three with sadness.
And let's draw each face.
I'm going to draw directly with the Screen Pad.
First, I will draw the expressionless expression,
copy it and paste it in the joy and draw the rest of the eyes and mouth.
Finally, I will draw a sad face.
Once I've made the look, I'll add a sound as well.
Come into the "Sounds" tab on the right to remove the old meow sound
and from "Choosing a sound", I'll put a human
laugh sound "Laugh2" in the voice.
The sound of crying was not appropriate so I downloaded it myself.
You can upload the downloaded sound through
"Upload sound" at the bottom.
You can press the play button to preview.
Laugh2 for laughing when happy
and add crying for when it feels sad.
Now that we are ready,
we will go to the "Code" tab and write the code.
First, bring the "when clicked" event
to the start of the event.
And take the form "switch shape to sadness."
When you first start, it's good to start with no expression, not sadness.
And since it needs input,
let's take the "Ask what's your name and wait" block on the detection side
and change it to "Please enter a comment" instead.
If you press the flag,
it can start with expressions like this,
and wait for a comment after "Please enter a comment."
It asked for your comment, so it will get some responses.
Then, I can make it that if the answer is good, it will make a happy expression,
and if it is bad, it will make a sad expression.
In other words, you can use conditional statements.
You get a block called "if~" to control.
And in the operation, "O = O" takes the block and puts it inside here.
And at the bottom there is a tab called emotion.
With the blocks here we can utilize our model.
Take "Recognize text (label)" at the top
and put it inside the first element and put your answer inside this text.
Then put "good" after the equal sign (=).
Then look at the code, put the "answer" that was the response to the
"Please enter a comment"
into the logic that determines "recognize the text (label)."
Then it will determine if it's "good" or "bad".
This means, if that label is equal to "good".
In other words, what should go inside of this is the content when the "answer" is "good".
In other words, change this character to a smiley face and make it laugh.
Then take the form "Replace Shape to ~"
and turn this into "Joy"
then bring this "Play Crying" from the sound
and assign it to Laugh2, not Crying.
And we need to make a case if it's "bad" instead of "good".
So copy and paste this conditional statement below
and put "bad" instead of "good".
I'll change the shape to sadness
and make it play the crying sound.
The code is now complete.
So let's test it.
Click the green flag to run the code and enter your comment.
"Video is so good! Liked and subscribed"
When comment like this is written,
this is my face.
Your likes, subscribe, and comments are a real help for me.
As expected, the comments were recognized as good words and it made a happy face.
Now let's test the bad ones.
I'll try this, "This is the worst video".
These hurtful comments can hurt someone.
You can see that it is crying because it was recognized as a bad word.
So, we made the AI characters with emotions.
You can add more data to make it more accurate
or you can make more of these labels
to create a variety of emotions.
In practical applications, you can use Python to crawl the comments
and find out how many positive comments or more.
You can apply it in a variety of ways.
Did you enjoy the video?
If it was helpful, please like, subscribe, and ding that bell.
This helps me produce videos.
See you in the future with better videos.