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.

Learn to Build a Multi Class Image Classification Model in Python from Scratch

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

What Users are saying..

profile image

Jingwei Li

Graduate Research assistance at Stony Brook University
linkedin profile url

ProjectPro is an awesome platform that helps me learn much hands-on industrial experience with a step-by-step walkthrough of projects. There are two primary paths to learn: Data Science and Big Data.... Read More

Relevant Projects

Multi-Class Text Classification with Deep Learning using BERT
In this deep learning project, you will implement one of the most popular state of the art Transformer models, BERT for Multi-Class Text Classification

MLOps AWS Project on Topic Modeling using Gunicorn Flask
In this project we will see the end-to-end machine learning development process to design, build and manage reproducible, testable, and evolvable machine learning models by using AWS

Build a Autoregressive and Moving Average Time Series Model
In this time series project, you will learn to build Autoregressive and Moving Average Time Series Models to forecast future readings, optimize performance, and harness the power of predictive analytics for sensor data.

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

Build CNN for Image Colorization using Deep Transfer Learning
Image Processing Project -Train a model for colorization to make grayscale images colorful using convolutional autoencoders.

AWS Project to Build and Deploy LSTM Model with Sagemaker
In this AWS Sagemaker Project, you will learn to build a LSTM model on Sagemaker for sales forecasting while analyzing the impact of weather conditions on Sales.

Build CI/CD Pipeline for Machine Learning Projects using Jenkins
In this project, you will learn how to create a CI/CD pipeline for a search engine application using Jenkins.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Hands-On Approach to Causal Inference in Machine Learning
In this Machine Learning Project, you will learn to implement various causal inference techniques in Python to determine, how effective the sprinkler is in making the grass wet.

Time Series Python Project using Greykite and Neural Prophet
In this time series project, you will forecast Walmart sales over time using the powerful, fast, and flexible time series forecasting library Greykite that helps automate time series problems.