Skip to content

Commit 043a387

Browse files
authored
ML_TensorFlow
Initial File
1 parent fdbb4e3 commit 043a387

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

ML_TensorFlow

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
python3 --version
2+
pip3 --version
3+
virtualenv --version
4+
5+
Install the pip package manager, and Virtualenv:
6+
7+
sudo apt update
8+
9+
sudo apt install python3-pip
10+
11+
When prompted, click Y to continue.
12+
13+
sudo pip3 install -U virtualenv # system-wide install
14+
15+
Go back and confirm the pip package manager and Virtualenv is installed:
16+
17+
pip3 --version
18+
virtualenv --version
19+
20+
pip install --upgrade tensorflow
21+
22+
python -c "import warnings;warnings.simplefilter(action='ignore', category=FutureWarning);import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
23+
24+
import warnings
25+
warnings.simplefilter(action='ignore', category=FutureWarning)
26+
27+
28+
import tensorflow as tf
29+
import numpy as np
30+
from tensorflow import keras
31+
32+
from tensorflow.python.util import deprecation
33+
deprecation._PRINT_DEPRECATION_WARNINGS = False
34+
35+
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
36+
37+
model.compile(optimizer='sgd', loss='mean_squared_error')
38+
39+
xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
40+
ys = np.array([-2.0, 1.0, 4.0, 7.0, 10.0, 13.0], dtype=float)
41+
42+
model.fit(xs, ys, epochs=500)

0 commit comments

Comments
 (0)