-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
88 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
# ML | ||
|
||
|
||
needed packages for venv | ||
|
||
302 sudo apt install python3-dev python3-pip | ||
303 sudo pip3 install -U virtualenv | ||
331 pip list | ||
332 pip install --upgrade tensorflow | ||
382 pip3 --version | ||
383 sudo apt install python3-pip | ||
437 pip install --upgrade matplotlib | ||
439 pip install --upgrade pandas | ||
441 pip install --upgrade seaborn | ||
443 pip install --upgrade tensorflow_docs | ||
444 pip install git+https://github.com/tensorflow/docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import tensorflow as tf | ||
|
||
mnist = tf.keras.datasets.mnist | ||
|
||
(x_train, y_train), (x_test, y_test) = mnist.load_data() | ||
x_train, x_test = x_train / 255.0, x_test / 255.0 | ||
|
||
|
||
model = tf.keras.models.Sequential([ | ||
tf.keras.layers.Flatten(input_shape=(28, 28)), | ||
tf.keras.layers.Dense(128, activation='relu'), | ||
tf.keras.layers.Dropout(0.2), | ||
tf.keras.layers.Dense(10) | ||
]) | ||
|
||
|
||
predictions = model(x_train[:1]).numpy() | ||
predictions | ||
|
||
print ("predictions:") | ||
print(predictions) | ||
|
||
|
||
tf.nn.softmax(predictions).numpy() | ||
|
||
print (" softmax:") | ||
print(predictions) | ||
|
||
|
||
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True) | ||
loss_fn(y_train[:1], predictions).numpy() | ||
|
||
|
||
model.compile(optimizer='adam', | ||
loss=loss_fn, | ||
metrics=['accuracy']) | ||
|
||
|
||
model.fit(x_train, y_train, epochs=5) | ||
|
||
|
||
model.evaluate(x_test, y_test, verbose=2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
// | ||
// Created by sergio on 16/05/19. | ||
// | ||
|
||
#include "../../include/Model.h" | ||
#include "../../include/Tensor.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
// | ||
// Created by sergio on 12/05/19. | ||
// | ||
|
||
#include "../../include/Model.h" | ||
#include "../../include/Tensor.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters