B1 中級 3 タグ追加 保存
I get questions all the time about some of the new concepts in machine learning on what they really mean.
So, for example, I get asked, what is one hot encoding and why should I use it?
It does seem very inefficient, you know, that's a great question.
So let's take a look at the answer by digging into some code, will also see how a function called Argh!
Max Compliments.
That's perfectly and saves you a lot of coding.
Here's the popular iris classification data sets.
With the values implemented in a JavaScript array, you'll notice that there are five values in each entry, four of which are features of the iris.
And the fifth, which will be 01 or two, is the classifications.
The classes are shown here with Iris a Tosa being zero Irish versa.
Color being one on Iris Virgin Icka Being too Now, this seems to be a really efficient encoding.
But when doing machine learning, you often have to transform this into something that appears to be less efficient, such as one hot encoding, which you can see here on instead of 01 and two for the values you haven't array with three values in it.
On here.
We've only got three options of flour.
If we had more options, this array would be much bigger.
The index of the array is sets a one for the relative flower.
So, for example, for it's a Tosa, the first element is one, and everything else is zero.
And for Virgin Icka, the third element is one, and everything else is zero.
Now this might seem a little strange, but when you consider the neural network that's doing the classification, they're designed with the number of output nodes equal to the number of classes that you want to determine.
We're picking between three classes here, so I have three output notes.
These three output nodes will then produce three probabilities.
The probability that you match class zero, the probability match class one or the probability of match class, too.
So it might look something like this.
So now, when training the network, we can train it from matching Values III.
If the flowers of class to we want to train it with a zero desired output from neuron 00 desired output from there on one on a one desired output from there on to.
So that's one hot encoding.
It may not look efficient from a storage perspective, but it maps really neatly to our desired output on thus is very efficient for training.
Another function, called Argh!
Max is then really handy for helping you find the desired values.
So instead of searching through a less to find the biggest value, it would transform that list of priorities into something like this.
And from there you can derive the correct class.
So let's jump back into the code, and we'll see this in action here.
I'm going to evaluate a flower with the features 5.82 point 75.1 on 1.9.
I know that this is an Irish virgin, Icka, which is class, too.
But let's see what the neural network gives me.
Will first take a look at the rope prediction, and then we'll take a look at the prediction that's been determined using our max.
Let's run this in the browser when I refresh, the Java script will start executing, and here you can see my a pox on my loss.
At that epoch, it's steadily decreasing, which is good, and now I get my classification and you can see that has very low probabilities for zero and one on a very high probability for two, which is what we'd expect if I then execute.
On this, I will get to consider the amount of code that you would have to write.
In this case, it's not a lot with just two classes.
But if there were a lot more classes and he needed to find the biggest, you'd have a lot of coding to do.
But Argh!
Max does this for you.
Given that these values Aaron a tensor, I hope this was a useful explanation of one heart and coding and how it complements INAUG max function.
These are some of the concepts that are a bit different when you're coding for machine learning, but they're incredibly useful and powerful.
One hot encoding is great because it's a way of mapping your classes to the shape that a neural network outputs values on.
Max is a function that saves you writing a lot of code to go over all those values to find the biggest.
There's lots of useful functions and transforms like these intensive flow on will continue to cover them on this channel.
So go ahead and hit that subscribe button Now.


A demo of One Hot Encoding (TensorFlow Tip of the Week)

林宜悉 2020 年 3 月 25 日 に公開
  1. 1. クリック一つで単語を検索


  2. 2. リピート機能


  3. 3. ショートカット


  4. 4. 字幕の表示/非表示


  5. 5. 動画をブログ等でシェア


  6. 6. 全画面再生


  1. クイズ付き動画


  1. クリックしてメモを表示

  1. UrbanDictionary 俚語字典整合查詢。一般字典查詢不到你滿意的解譯,不妨使用「俚語字典」,或許會讓你有滿意的答案喔