🤖
Artificial Intelligence for Idiot
  • Introduction
  • What is Machine Learning
  • Python Basics
    • Random Number
  • Data Manipulation
    • Numpy
    • Pandas
  • Data Visualization
    • Matplotlib
      • Simple drawing
      • Simple line and point
      • Any line and label
      • Annotation in reality
  • Dataset Searching
  • Keras
    • Data preparation
    • Build the simplest model
  • Robot
    • Speech to Text
Powered by GitBook
On this page
  • Keras is the simplest ML library, so I hope you enjoy it
  • After that, let us feed data into our model
  • Then do a prediction

Was this helpful?

  1. Keras

Build the simplest model

import numpy as np
import pandas as pd

Keras is the simplest ML library, so I hope you enjoy it

from keras.models import Sequential
from keras.layers import Dense

model = Sequential()

model.add(Dense(units=2, activation='relu', input_dim=2))
model.add(Dense(units=1))

model.compile(
    loss='mean_squared_error',
    optimizer='sgd',
    metrics=['accuracy']
)
  1. first, we created a sequential model

  2. then, we added two dense layer(actually neural network) for it. the first layer has one neural node, the second has one neural node, too.

  3. sgd = Stochastic gradient descent

After that, let us feed data into our model

model.fit(x, y, epochs=100, batch_size=1)

Then do a prediction

model.predict(np.array([[170, 96]]))
PreviousData preparationNextRobot

Last updated 6 years ago

Was this helpful?