🌱Introduction

πŸ‘©β€πŸ’» Intro to Neural Networks Coding

Like every first app we should start with something super simple that gives us an idea about the whole methodology.

✨ What is Keras?

Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano.

πŸ“š Important Terms

πŸ‘©β€πŸ”¬ The Simplest Neural Network

It contains one layer with one neuron.

πŸ‘©β€πŸ’» Code Example

# initialize the model
model = Sequential()

# add a layer with one unit and set the dimension of input 
model.add(Dense(units=1, input_shape=[1]))

# set functional properties and compile the model
model.compile(optimizer='sgd', loss='mean_squared_error'

After building out neural network we can feed it with our sample data πŸ˜‹

πŸ‘©β€πŸ’» Code Example

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)

Then we have to start training process πŸš€

πŸ‘©β€πŸ’» Code Example

model.fit(xs, ys, epochs=500)

Every thing is done 😎 ! Now we can test our neural network with new data πŸŽ‰

πŸ‘©β€πŸ’» Code Example

print(model.predict([10.0]))

πŸ‘©β€πŸ’» My Code

πŸ”ƒ Traditional Programming vs Machine Learning

🧐 References

Last updated