介绍神经网络_神经网络介绍
介紹神經網絡
It is time to set our goals and introduce the framework for creating a machine learning algorithm; it means building a model that outputs correct information.
現在是設定目標并介紹用于創建機器學習算法的框架的時候了。 這意味著建立一個輸出正確信息的模型。
Generally, a machine learning algorithm can be thought of as a black box. It takes inputs and gives outputs.
通常,機器學習算法可以被視為黑匣子。 它接受輸入并給出輸出。
For instance, we may want to create a model that predicts the weather tomorrow given meteorological information for the past few days.
例如,我們可能想要創建一個模型,該模型根據過去幾天的氣象信息來預測明天的天氣。
The input will feed to the model could be metrics such as temperature humidity and precipitation.
輸入到模型的輸入可能是諸如溫度濕度和降水量的度量。
The output we will obtain would be the weather forecast for tomorrow.
我們將獲得的輸出將是明天的天氣預報。
Before we get comfortable and confident about the model’s output we must train the model.
在對模型的輸出感到滿意和自信之前,我們必須訓練模型。
Training is a fundamental concept in machine learning as this is the process through which the model learns; how to make sense of the input data? Once we have trained our model we can simply feed it with data and obtain an output.
訓練是機器學習的基本概念,因為這是模型學習的過程。 如何理解輸入數據? 一旦我們訓練了模型,我們就可以簡單地將其輸入數據并獲得輸出。
訓練和算法背后的邏輯涉及四個要素。 (The logic behind training and algorithm involves four ingredients.)
Let’s explore each of them.
讓我們探索每個。
First, we must prepare a certain amount of data to train with. Normally, this is historical data which is easily available. Second, we need a model. The simplest model we can train is a linear model in the weather forecast example.
首先,我們必須準備一定數量的數據進行訓練。 通常,這是歷史數據,很容易獲得。 其次,我們需要一個模型。 在天氣預報示例中,我們可以訓練的最簡單模型是線性模型。
That would mean to find some coefficients multiply each variable with them and sum everything to get the output.
這意味著要找到一些系數,將每個變量與它們相乘,并對所有變量求和以得到輸出。
Moving on the linear model deep, machine learning allows us to create complicated non-linear models. They usually fit the data much better than a simple linear relationship. The third ingredient is the objective function. We have data, we fed it to the model and obtained an output, we want this output to be as close to reality as possible. Objective function checks, how correct the model’s outputs are?.
深入學習線性模型,機器學習使我們能夠創建復雜的非線性模型 。 它們通常比簡單的線性關系更好地擬合數據。 第三個要素是目標函數。 我們有數據,將其提供給模型并獲得了輸出,我們希望該輸出盡可能接近實際情況。 目標函數檢查,模型輸出的正確性如何?
On average the entire machine learning framework boils down to optimizing this function. For example, if our function is measuring the prediction error of the model we would want to minimize the error or minimize the objective function.
平均而言,整個機器學習框架歸結為優化此功能。 例如,如果我們的函數正在測量模型的預測誤差,則我們希望將誤差最小化或將目標函數最小化。
The last ingredient is the optimization algorithm. It consists of the mechanics through which we can vary the parameters of the model to optimize the objective function. For example, if the weather forecast model is, the weather tomorrow equals w1 times temperature plus W2 times humidity the optimization algorithm may go through values like 1.05 * temperature + 1.2 * humidity or 1.05 * temperature — 1.2 * humidity or 1.04 * temperature — 1.1 * humidity and so on.
最后一個因素是優化算法。 它由機制組成,通過這些機制我們可以更改模型的參數以優化目標函數。 例如,如果天氣預報模型是,明天的天氣等于w1乘以溫度加W2乘以濕度,則優化算法可能會經過1.05 *溫度+ 1.2 *濕度或1.05 *溫度-1.2 *濕度或1.04 *溫度-1.1的值*濕度等。
W 1 and w 2 are the parameters that will change for each set of parameters.
W 1和w 2是隨每組參數而變化的參數。
We would calculate the objective function then choose the model with the highest predictive power. How do we know which one is the best? It would be the one with an optimal objective function
我們將計算目標函數,然后選擇具有最高預測能力的模型。 我們怎么知道哪個最好? 這將是具有最佳目標函數的那個
The machine learning process is iterative. We feed data into the model and compare the accuracy through the objective function. Then we vary the model’s parameters and repeat the operation.
機器學習過程是迭代的。 我們將數據輸入模型,并通過目標函數比較準確性。 然后,我們更改模型的參數并重復操作。
模型 (MODEL)
線性模型 (Linear Model)
The linear model display appearing oversimplified, it is extremely important as it is the basis for more complicated models including non-linear ones. In the linear model world f(x) = x *w + b
線性模型的顯示顯得過于簡單,這是非常重要的,因為它是包括非線性模型在內的更復雜模型的基礎。 在線性模型世界中f(x)= x * w + b
x is the input
x是輸入
w the coefficient of x
w x的系數
B would be the intercept
B將是截距
In machine learning W is called Weight or weights when we have more than one parameter b is called the bias or biases.
在機器學習中,當我們有多個參數b時,W被稱為權重或權重。
There are many ways to define the linear model
有很多定義線性模型的方法
The goal of the machine learning algorithm would be to find such values for W and B. So the output of X*w + B is as close to the observed values as possible.
機器學習算法的目標是找到W和B的此類值。因此X * w + B的輸出盡可能接近觀測值。
For example, our goal is to predict the price of an apartment based on its size.
例如,我們的目標是根據公寓的大小預測公寓的價格。
So the input X is the size
所以輸入X是大小
X * w + B is the model
X * w + B是模型
we are using the calculation of this expression gives us the price or the output y.
我們正在使用此表達式的計算得出價格或輸出y。
The size of an apartment is 743 square feet. A possible model for predicting its price is X * 336.1–3237.51. If we calculate the output following this model for 743 square feet apartment we would obtain a price of $246,484.79.
公寓的面積為743平方英尺。 預測其價格的可能模型是X * 336.1–3237.51。 如果我們按照此模型為743平方英尺的公寓計算輸出,我們將獲得246,484.79美元的價格。
Let’s extend our real estate valuation model to multiple inputs if we had additional information say the apartments we are located by the sea. The closer an apartment is to the beach the higher the price should be.
如果我們還有其他信息說我們位于海邊的公寓,那么讓我們將房地產評估模型擴展到多個輸入 。 公寓距離海灘越近,價格應該越高。
The linear model would predict a price based on both size and proximity to the beach. If we want to state this expression in linear algebraic terms we can use the same framework as before x * w + B. X and W are both vectors.
線性模型將根據海灘的大小和鄰近程度來預測價格。 如果我們想用線性代數來表示該表達式,則可以使用與x * w + B之前相同的框架。X和W都是向量。
Let’s continue our housing example with the two input variables the output y is equal to x times w plus B. X has two elements a size of 743 and a distance from the beach of 1.2 1 miles. W has two elements to one for each input.
讓我們繼續我們的住房示例,使用兩個輸入變量,輸出y等于x乘以W加上B。X有兩個元素,大小為743,距海灘的距離為1.2 1英里。 對于每個輸入,W有兩個元素。
The greater the distance from the beach the lower the price.
離海灘的距離越遠,價格越低。
The new situation we may be interested in predicting not only the price of the apartment when buying it but also the price for which we can rent it out.
在這種新情況下,我們可能不僅希望預測購買公寓時的價格,而且還要預測我們可以出租的價格。
Our inputs are unchanged. Therefore we can create two linear models.
我們的輸入沒有改變。 因此,我們可以創建兩個線性模型。
The price as a function of the size and proximity to the beach and the rent as a function of the size and proximity to the beach.
價格與海灘的大小和距離有關,而租金與海灘的大小和距離有關。
Y1 = x1 * w11 + x2 * w21 + B1
Y1 = x1 * w11 + x2 * w21 + B1
Y2 =x 1*w12 + x2 * w22 + B2
Y2 = x 1 * w12 + x2 * w22 + B2
Notice the indices of the weights the first number refers to the respective input while the second to the output.
注意權重的索引,第一個數字表示相應的輸入,第二個數字表示輸出。
We have two outputs two inputs for weights and two bias’s the number of weights depends on the inputs and outputs.
我們有兩個輸出,兩個輸入用于權重,兩個偏置用于權重的數量取決于輸入和輸出。
There is a different weight for each input in each equation.
每個方程式中每個輸入的權重都不同。
In general, if we have k inputs and outputs the number of weights would be k times M. The number of biases is equal to the number of outputs.
通常,如果我們有k個輸入和輸出,則權重的數量將是k乘以M。偏差的數量等于輸出的數量。
Finally, an example of many inputs outputs and observations. The output matrix will be entered by N where N is the number of observations an M is the number of output variables.
最后,是許多輸入輸出和觀察結果的示例。 輸出矩陣將由N輸入,其中N是觀察數,M是輸出變量數。
The input matrix will be n by k where k is the number of input variables.
輸入矩陣將為n×k,其中k為輸入變量的數量。
The weights matrix remains the same as the weights don’t change depending on the number of observations. The same applies to the biases.
權重矩陣保持不變,權重不隨觀察次數而變化。 偏見也是如此。
Let's discuss two situations in which machine learning and neural networks come in handy.
讓我們討論一下機器學習和神經網絡派上用場的兩種情況。
How a linear model can solve our cats and dogs photo problem?
線性模型如何解決我們的貓和狗的拍照問題?
Here is a scatterplot of a dataset consisting of animal photos.
這是由動物照片組成的數據集的散點圖。
The blue dots be the dogs is photos from one of our previous examples and the orange ones the cats a linear model or a straight line can solve this problem fairly easily.
藍點是狗,是我們先前示例之一的照片,橙點是貓的線性模型或直線可以很容易地解決此問題。
Everything below the line is one category and above it is the other in this situation we have a classification problem.
在這種情況下,該行下方的所有內容都是一個類別,而在其上方的其他類別則是分類問題。
We are trying to classify the photos into dogs and cats.
我們正在嘗試將照片分類為貓和貓。
Such a model is called a linear classifier. The data represented in the graph is linearly separable.
這種模型稱為線性分類器。 圖中表示的數據是線性可分離的。
But what about this case we have only several categories but we can’t fit a straight line through them. This data is not linearly separable. Therefore we must use a non-linear model.
但是,在這種情況下,我們只有幾個類別,但是我們無法通過它們來擬合一條直線。 該數據不是線性可分離的。 因此,我們必須使用非線性模型。
We will learn how to handle such problems in the section where we will learn about deep neural networks.
我們將在學習深度神經網絡的部分中學習如何處理此類問題。
Here is the graph of our apartment price example. Each point represents an apartment a linear model explains the data. This is one of the well known linear relationships
這是我們的公寓價格示例的圖表。 每個點代表一個公寓,線性模型解釋了數據。 這是眾所周知的線性關系之一
however different regression problems may not necessarily be solved by linear model.
但是,線性模型不一定可以解決不同的回歸問題。
Totally not linear.
完全不是線性的。
In the next blog, we will cover the objective function and optimization algorithm. Stay tuned!
在下一個博客中,我們將介紹目標函數和優化算法。 敬請關注!
翻譯自: https://medium.com/ai-in-plain-english/introduction-to-neural-nets-8c7b26ee9ee1
介紹神經網絡
總結
以上是生活随笔為你收集整理的介绍神经网络_神经网络介绍的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阴阳师速度最快的式神是谁
- 下一篇: 塞尔达怎么去火山