MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# What are the metrics through which we can evaluate a regression model in keras?

# What are the metrics through which we can evaluate a regression model in keras?

This recipe explains what are the metrics through which we can evaluate a regression model in keras

The metrics through which we can evaluate a regression model in keras Keras Have provided us many ways to evaluate the Regression and Classification model when we train a deep Learning Model. But our focus is to evaluate a Regression Model

Certain types of Metrics can be used for regression Models: Mean Squared Error Mean Absolute Error Mean Absolute Percentage Error Cosine Proximity We will show you the implementation of all Metrics and visualize the Mean Squared Error and Mean Absolute Error.

```
from numpy import array
from keras.models import Sequential
from keras.layers import Dense
from matplotlib import pyplot
```

We will Define two Arrays Let's consider y_pred is our predicted array and y_actual is our actual array.

```
# prepare sequence
y_pred = array([0.4, 0.6, 0.8, 1.0, 0.5, 0.4, 0.3, 0.2, 0.1, 0.8])
y_actual = array([-0.4, -0.3, 0.8, 0.9, 0, 1.2, 0.3, 2.4, 0.3, 0.3])
```

We will define all the Metrics while compiling the model as you can see below.

```
# create model
model = Sequential()
model.add(Dense(2, input_dim=1))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['mse', 'mae','mape', 'cosine_proximity'])
```

We will train our model with the defined parameters

```
# train model
history = model.fit(y_pred, y_actual, epochs=50, batch_size=len(y_pred), verbose=2)
```

```
# plot metrics
pyplot.plot(history.history['mse'])
pyplot.plot(history.history['mae'])
pyplot.show()
```

In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

This data science in python project predicts if a loan should be given to an applicant or not. We predict if the customer is eligible for loan based on several factors like credit score and past history.

Machine Learning Project - Work with KKBOX's Music Recommendation System dataset to build the best music recommendation engine.

In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

There are different time series forecasting methods to forecast stock price, demand etc. In this machine learning project, you will learn to determine which forecasting method to be used when and how to apply with time series forecasting example.

In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

Data Science Project in Python- Build a machine learning algorithm that automatically suggests the right product prices.