Introduction to Machine Learning and Hello World in Neural Networks

What is Machine Learning?

Yes, as the topic says machines are learning. Machine learning is all about how machines are learning and how do we teach the machines to learn. In so near future machines can learn and do the thing that we, humans do.

# height input as "h" and weight in as "w"
h = float(input("Please Enter Your Height in cm: "))
w = float(input("Please Enter Your Weight in kg: "))
BMI = w / (h/100)**2
print(f"You BMI Index is {BMI}")if BMI <= 18.4:
print("You are slightly underweight.")
elif BMI <= 24.9:
print("You are pretty healthy.")
elif BMI <= 29.9:
print("You are slightly overweight.")
elif BMI <= 34.9:
print("You are severely overweight.")
elif BMI <= 39.9:
print("You are obese.. -_-")
else:
print("You are severely obese... Get Some Help")

Machine Learning Road Map

Simple Number Pattern Prediction using Neural Networks

Here I am going to show you how to do a simple pattern recognition like above using Neural Networks which is a part of Deep Learning.

import keras

model = keras.Sequential([keras.layers.Dense(units=1,input_shape[1])])
model.compile(optimizer="sgd", loss='mean_squared_error')
import numpy as np
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)
# Training the model
model.fit(xs, ys, epochs=500)
print(model.predict([10.0]))

Simple House Price Prediction using Neural Network Basics and Tensorflow

Here we are going to do a real-life scenario to Build a Neural network using TensorFlow.

import tensorflow as tf
import numpy as np
from tensorflow import keras
def house_model():
xs = np.array([1.0,2.0,3.0,4.0,5.0,6.0], dtype=float)
ys = np.array([1.0,1.5,2.0,2.5,3.0,3.5],dtype=float)
model = tf.keras.models.Sequential([tf.keras.layers.Dense(units=1,input_shape=[1])])
model.compile(optimizer = 'sgd', loss = 'mean_squared_error')
model.fit(xs,ys,epochs=1000)
return model
new_y = 10.0
model = house_model()
prediction = model.predict([new_y])[0]
print(prediction)

If you want to continue your self-study in Neural networks while parallel to Machine Learning, You can follow the DeepLearning Coursera specialization by applying for financial Aid.

Visit Coursera

So, I believe this guide would’ve provided some basic introduction on how machine learning and artificial intelligence are applied through the neural network.

--

--

Game Dev | Engineering Undergraduate Student at Sri Lanka Technological Campus.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nawodya Ishan

Game Dev | Engineering Undergraduate Student at Sri Lanka Technological Campus.