You are on page 1of 2

Developing Curricula for Artificial Intelligence and Robotics (DeCAIR)

618535-EPP-1-2020-1-JO-EPPKA2-CBHE-JP

Course Title Applied Machine Learning

Experiment Number 11

Experiment Name Regression and Classification Using Neural Networks

Objectives The students learn to solve regression and classification problems using neural networks.

Introduction The students continue learning to solve machine learning problems using neural networks
with Scikit-Learn and Keras.

Materials Computer with Python integrated development environment (IDE) software installed
(PyCharm is recommended).

Procedure Exercise 1: Regression with Scikit-Learn Neural Networks


Scikit-Learn has a version of California House dataset that has 8 real-value features and real-
value target from 0.15 to 5.0 for 20,640 districts. For more detail, check:
https://scikit-
learn.org/stable/modules/generated/sklearn.datasets.fetch_california_housing.html

Train the following two regressors to predict the target from the scaled features. Using
RMSE, evaluate your models on a 25%-test set, randomly selected.

1. sklearn.linear_model.LinearRegression
2. sklearn.neural_network.MLPRegressor

Your MLP model should have one hidden layer of 100 neurons.

Exercise 2: Classification with Scikit-Learn and Keras Neural Networks


Scikit-Learn provides a famous dataset that contains the sepal and petal length and width of
150 iris flowers of three different species: Setosa, Versicolor, and Virginica.
For more detail, check: https://scikit-learn.org/stable/datasets/toy_dataset.html#iris-
dataset

Train the following three classifiers to predict the iris species from the four scaled features.
Evaluate the three models according to the accuracy of the predicted classes on 25%-test
set, randomly selected:

1. sklearn.linear_model.Perceptron
2. sklearn.neural_network.MLPClassifier
3. tf.keras.Sequential

Your MLP model should have two hidden layers, 10 neurons each. For the Keras classifier,
use the following parameters:
• Two hidden layers each is 100 cells.
• ReLU activation for the hidden layers.
• epochs = 100

The European Commission's support for the production of this publication does not constitute an endorsement of the contents, which reflect
the views only of the authors, and the Commission cannot be held responsible for any use which may be made of the information contained
therein.

2
Developing Curricula for Artificial Intelligence and Robotics (DeCAIR)
618535-EPP-1-2020-1-JO-EPPKA2-CBHE-JP

• validation_split = 0.25

Data Collection Capture the output of your code.

Data Analysis Evaluate the used models.

Required Reporting Submit your code and the captured output.

Safety Considerations Standard safety precautions related to using computer.

References 1. Applied Machine Learning presentation titled “End-to-End Machine Learning Project.”
2. Applied Machine Learning presentation titled “Classification.”
3. Applied Machine Learning presentation titled “Artificial Neural Networks with Keras.”
4. Aurélien Géron, Hands-On Machine Learning with Scikit-Learn, Keras and TensorFlow,
O’Reilly, 3rd Edition, 2022.

The European Commission's support for the production of this publication does not constitute an endorsement of the contents, which reflect
the views only of the authors, and the Commission cannot be held responsible for any use which may be made of the information contained
therein.

You might also like