Explain with an example how to do feature preprocessing using keras?

Explain with an example how to do feature preprocessing using keras?

Explain with an example how to do feature preprocessing using keras?

This recipe explains with an example how to do feature preprocessing using keras


Recipe Objective

With an example, elaborate how to do feature preprocessing using keras

The Keras preprocessing layers API gives an option to developers to build Keras-native input processing pipelines. These pipelines can be used as independent preprocessing code in non-Keras workflows, they can be combined directly with Keras models.

Step 1- Importing Library

import numpy as np import tensorflow as tf from tensorflow.keras.layers.experimental import preprocessing

Step 2- Creating a 2d array.

Preprocessing a 2D array.

X = np.array([[4,8,10], [40,100, 120], [200, 300, 1000],[1000,5000,10000]]) layer = preprocessing.Normalization() layer.adapt(data) normalized_X = layer(X)

Step 3- Printing the mean and Standard Deviation of Data.

print("Features mean: %.2f" % (normalized_X.numpy().mean())) print("Features std: %.2f" % (normalized_X.numpy().std()))

Relevant Projects

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

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

Customer Market Basket Analysis using Apriori and Fpgrowth algorithms
In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Data Science Project - Instacart Market Basket Analysis
Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

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

Data Science Project in Python on BigMart Sales Prediction
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.

Zillow’s Home Value Prediction (Zestimate)
Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
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.

Choosing the right Time Series Forecasting Methods
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.

Learn to prepare data for your next machine learning project
Text data requires special preparation before you can start using it for any machine learning project.In this ML project, you will learn about applying Machine Learning models to create classifiers and learn how to make sense of textual data.