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()
```

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

Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

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

Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.