TensorFlow in Google Colaboratory
Intro to Machine Learning (ML Zero to Hero – Part 1)
# simple neural network code example on Colab import tensorflow as tf from tensorflow import keras import numpy as np model = keras.Sequential([keras.layers.Dense(units=1,input_shape=[1])]) model.compile(optimizer='sgd',loss=keras.losses.MeanSquaredError()) xs = np.array([-1.0,0.0,1.0,2.0,3.0,4.0],dtype=float) ys = np.array([-3.0,-1.0,1.0,3.0,5.0,7.0],dtype=float) model.fit(xs, ys, epochs=500) print(model.predict([10.0]))