├── Images ├── AI-ML-DL.png ├── binance.jpg ├── output.png ├── tensor.png ├── learning_rate.png ├── Overview_Explained_Example.png ├── artificial-neural-network-model.png └── artificial-neuron-model-sigmoid-activiation-function.png ├── LICENSE ├── Code └── Example_Code_with_Comments.py └── README.md /Images/AI-ML-DL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/AI-ML-DL.png -------------------------------------------------------------------------------- /Images/binance.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/binance.jpg -------------------------------------------------------------------------------- /Images/output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/output.png -------------------------------------------------------------------------------- /Images/tensor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/tensor.png -------------------------------------------------------------------------------- /Images/learning_rate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/learning_rate.png -------------------------------------------------------------------------------- /Images/Overview_Explained_Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/Overview_Explained_Example.png -------------------------------------------------------------------------------- /Images/artificial-neural-network-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/artificial-neural-network-model.png -------------------------------------------------------------------------------- /Images/artificial-neuron-model-sigmoid-activiation-function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDouble/Deep-Learning-Machine-Learning-AI-TensorFlow-Python/HEAD/Images/artificial-neuron-model-sigmoid-activiation-function.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Alpay Yildirim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Code/Example_Code_with_Comments.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf # deep learning library. Tensors are just multi-dimensional arrays 2 | 3 | mnist = tf.keras.datasets.mnist # mnist is a dataset of 28x28 images of handwritten digits and their labels 4 | (x_train, y_train),(x_test, y_test) = mnist.load_data() # unpacks images to x_train/x_test and labels to y_train/y_test 5 | 6 | x_train = tf.keras.utils.normalize(x_train, axis=1) # scales data between 0 and 1 7 | x_test = tf.keras.utils.normalize(x_test, axis=1) # scales data between 0 and 1 8 | 9 | model = tf.keras.models.Sequential() # a basic feed-forward model 10 | model.add(tf.keras.layers.Flatten()) # takes our 28x28 and makes it 1x784 11 | model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu)) # a simple fully-connected layer, 128 units, relu activation 12 | model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu)) # a simple fully-connected layer, 128 units, relu activation 13 | model.add(tf.keras.layers.Dense(10, activation=tf.nn.softmax)) # our output layer. 10 units for 10 classes. Softmax for probability distribution 14 | 15 | model.compile(optimizer='adam', # Good default optimizer to start with 16 | loss='sparse_categorical_crossentropy', # how will we calculate our "error." Neural network aims to minimize loss. 17 | metrics=['accuracy']) # what to track 18 | 19 | model.fit(x_train, y_train, epochs=3) # train the model 20 | 21 | val_loss, val_acc = model.evaluate(x_test, y_test) # evaluate the out of sample data with model 22 | print(val_loss) # model's loss (error) 23 | print(val_acc) # model's accuracy -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🐍 Deep Learning / Machine Learning / Artificial Intelligence (AI) TensorFlow Python 🐍 2 | 🐍 **Deep Learning / Machine Learning / Artificial Intelligence (AI)** with **TensorFlow** 🐍 3 | 4 | Learning & Understanding **Deep Learning / Machine Learning / Artificial Intelligence (AI)**.
5 | I tried to keep it as short as possible, but Truth needs to be told, **Deep Learning / Machine Learning and Artificial Intelligence (AI)** are big topics.
6 | In this Repository, the focus is mainly on **TensorFlow** and **Deep Learning** with **neural networks**. 7 | 8 |

9 | 10 |

11 | 12 | ## What is a neural network? 🌐 13 | 14 | A basic **neural network** consists of an **input layer**, which is just **your data, in numerical form**. After your **input layer**, you will have some number of what are called **"hidden" layers**. **A hidden layer** is just in between your input and output layers.
***One hidden layer means you just have a neural network. Two or more hidden layers? you've got a deep neural network!*** 15 | 16 | ![neural network](Images/artificial-neural-network-model.png) 17 | 18 | ## What is a Tensor? 🔢 19 | 20 | Each operation takes a **Tensor** as an Input and outputs a **Tensor**. A **Tensor** is how Data is represented in **TensorFlow**.
21 | A **Tensor is a multidimensional array** ex:

22 | [0.245,0.618,0.382]

23 | This would be a **normalized one-way-tensor**.

24 | [[0.245,0.618,0.382],
[0.618,0.382,0.245],
[0.382,0.245,0.618]]

25 | This would be a **normalized two-way-tensor**.

26 | [[[0.245,0.618,0.382],[0.618,0.382,0.245],[0.382,0.245,0.618]],
[[0.245,0.618,0.382],[0.618,0.382,0.245],[0.382,0.245,0.618]],
[[0.245,0.618,0.382],[0.618,0.382,0.245],[0.382,0.245,0.618]]]

27 | This would be a **normalized three-way-tensor**.

28 | **normalized** in **TensorFlow** means that the numbers are converted to a value between 0 and 1.
The Data needs to be **normalized**, to be actually useable in **TensorFlow**. 29 | 30 | ![neural network](Images/tensor.png) 31 | 32 | ## Hyper Parameters 🔡 33 | 34 | **Hyperparameters** contain the data that govern the training process itself.
35 | 36 | As an ex. if the **learning rate** is too big, our model may skip the optimal solution, if the **learning rate** is too small we may need to many iterations to get the best result, so we try to find a **learning rate** that fits for our purpose. 37 | 38 | ![hyper parameters](Images/learning_rate.png) 39 | 40 | ## What are Weights and Biases? 🔤 41 | 42 | **Weights** and **Biases** are the **learnable parameters of your model**. As well as **neural networks**, they appear with the same names in related models such as linear regression. Most machine learning algorithms include some **learnable parameters** like this. 43 | 44 | ![explained picture machine learning](Images/Overview_Explained_Example.png) 45 | 46 | ## 📝 Example Code with Comments 📝 47 | ``` 48 | import tensorflow as tf # deep learning library. Tensors are just multi-dimensional arrays 49 | 50 | mnist = tf.keras.datasets.mnist # mnist is a dataset of 28x28 images of handwritten digits and their labels 51 | (x_train, y_train),(x_test, y_test) = mnist.load_data() # unpacks images to x_train/x_test and labels to y_train/y_test 52 | 53 | x_train = tf.keras.utils.normalize(x_train, axis=1) # scales data between 0 and 1 54 | x_test = tf.keras.utils.normalize(x_test, axis=1) # scales data between 0 and 1 55 | 56 | model = tf.keras.models.Sequential() # a basic feed-forward model 57 | model.add(tf.keras.layers.Flatten()) # takes our 28x28 and makes it 1x784 58 | model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu)) # a simple fully-connected layer, 128 units, relu activation 59 | model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu)) # a simple fully-connected layer, 128 units, relu activation 60 | model.add(tf.keras.layers.Dense(10, activation=tf.nn.softmax)) # our output layer. 10 units for 10 classes. Softmax for probability distribution 61 | 62 | model.compile(optimizer='adam', # Good default optimizer to start with 63 | loss='sparse_categorical_crossentropy', # how will we calculate our "error." Neural network aims to minimize loss. 64 | metrics=['accuracy']) # what to track 65 | 66 | model.fit(x_train, y_train, epochs=3) # train the model 67 | 68 | val_loss, val_acc = model.evaluate(x_test, y_test) # evaluate the out of sample data with model 69 | print(val_loss) # model's loss (error) 70 | print(val_acc) # model's accuracy 71 | ``` 72 | ## Resources & Links: ⛓ 73 | https://www.tensorflow.org/
74 | https://ai.google/education/
75 | Deep Learning: https://pythonprogramming.net/introduction-deep-learning-python-tensorflow-keras/
76 | TensorFlow Overview: https://www.youtube.com/watch?v=2FmcHiLCwTU
77 | AI vs Machine Learning vs Deep Learning: https://www.youtube.com/watch?v=WSbgixdC9g8
78 | https://www.quora.com/What-do-the-terms-Weights-and-Biases-mean-in-Google-TensorFlow
79 | https://datascience.stackexchange.com/questions/19099/what-is-weight-and-bias-in-deep-learning 80 | 81 | ![Binance Ready to give crypto a try ? buy bitcoin and other cryptocurrencies on binance](Images/binance.jpg) 82 | --------------------------------------------------------------------------------