24 Şubat 2021 Çarşamba

Deep Learning

Giriş
Deep Learning aslında Machine Learning 'in alt kümesi. Açıklaması şöyle
A part of machine learning, DL can process and use data to better understand the context in the unstructured data, thereby improving the accuracy of automated analysis of the text. 
Kavramlar
Şu kavramlar kullanılır
1. Cost Function
2. Activation Functions
3. Recurrent Neural Networks (RNN)
4. Backpropagation
5. Long Short-Term Memory Networks (LSTM)
6. Convolutional Neural Networks (CNNs)
7. Hyper-parameters
8. Batch and Stochastic Gradient Descent
Deep Learning Altta Artificial Neural Network Kullanır
Açıklaması şöyle.
Deep learning can be termed as an approach to machine learning where learning from past data happens based on artificial neural networks (a mathematical model mimicking the human brain).
Artificial Neural Network Nedir
Açıklaması şöyle. Neuron'lardan oluşur. Her neuron belli bir ağırlığa sahiptir ve bir işi yapar. Örneğin bir resimde bıyıklı bir adam olup olmadığını anlayan bir neuron'lar olsun. Bir tane neuron bıyık arar, bir başka neuron adam arar. Bu ikisinin çıktısı belli bir eşik üzerindeyse var veya yok cevabı verilir.
An artificial neural network is a bunch of computation units called neurons laid out in one or more layers while the neurons being connected with each other. Neuron as a computation unit can be expressed as a weighted sum of inputs and looks like the following:

\(w_0 + w_1x_1 + w_2x_2 + w_3x_3 + ... + w_nx_n\)

In the above equation, the \(w_n\) represents the weight and \(x_n\) represents the corresponding input. Each neuron is associated with what is called an activation function, which decides on the output of the neuron. When all the neurons across different layers are connected with each other, the neural network is also called a fully-connected neural network.

A neural network having just one neuron can be called as a single-layer neural network. It is called the perceptron. A neural network having one input layer, one hidden layer, and one output layer is called a multi-layer perceptron (MLP) network.
Dense Network Nedir
Açıklaması şöyle. Yani öndeki katmandaki nöron arkadaki katmandaki her nörona bağlıdır
A layer that is densely connected to its preceding layer means that every neuron in the layer is connected to every other neuron in the layer above it. In artificial neural network networks, this layer is the one that is most frequently utilized.
Deep Neural Network Nedir
İki veya daha fazla artificial neural network varsa deep neural network olarak adlandırılır. Şeklen şöyledir


Her dikey katmandaki neuron, bir sonraki katmandaki neuron'lara bağlıdır.

TensorFlow
Açıklaması şöyle
TensorFlow is an open-source software library for machine and deep learning. It was created by the Google Brain Team and has a wide range of uses, such as neural networks for computer vision, natural language processing, and self-driving vehicles.

With high performance and efficiency, TensorFlow enables users to construct, optimize, and assess mathematical expressions involving multi-dimensional arrays. Researchers and developers choose it because it offers a versatile and high-level API for building, honing, and deploying machine learning models. Additionally, TensorFlow has a sizable and expanding contributor community that offers a plethora of tools, tutorials, and resources for users to employ.
Örnek
Şöyle yaparız
layer_0 = tf.keras.layers.Dense(units=1, input_shape=[1])
model = tf.keras.Sequential([layer_0])
Açıklaması şöyle
To create the first layer and assemble it into a model, you can start by tf.keras.Dense method and providing two parameters as input for a basic Dense model:

- units=1 is the number of neurons in the layer, and it will represent internal variables the layer must use to try to figure out how to solve the problem.
- input_shape=[1] is the other parameter which indicates the input to this layer is a single value.
Sonra model compile edilir. Şöyle yaparız
model.compile(loss='mean_squared_error',
optimizer=tf.keras.optimizers.Adam(0.1))
Açıklaması şöyle
Now it is time to compile our model before starting to fit our training input into it. Compiling the model is pretty simple; you just need to call the compile method on your model object. But to do so, you also need to provide the loss and optimizer functions.

In this case, we are using the mean squared error as our loss function. The degree of inaccuracy in statistical models is gauged by the mean squared error, or MSE. Between the observed and projected values, it evaluates the average squared difference. The MSE is equal to 0 when a model is error-free, and its value increases when the model error does as well.

To do the optimization, we are using the Adam optimization algorithm. In place of the conventional stochastic gradient descent method, Adam is an optimization technique that may be used to iteratively update network weights depending on training data.
Sonra model veri ile beslenir. Şöyle yaparız
history = model.fit(inputs, outputs, epochs=400, verbose=0)
Açıklaması şöyle
After compiling the model, now it is time to fit our training data into the model. Using the fit method and providing the input samples and corresponding outputs, we can train our model.

- epochs: An epoch is an iteration over the entire inputs and outputs data provided which in our case we have set to 400.
- verbose: This argument controls how much output the method produces and can be set to ‘auto’, 0, 1, or 2. 0 is the silent mode.
Ve çıktı alınır
print(model.predict([39])) # [[243.605]]

Hiç yorum yok:

Yorum Gönder