Importing Libraries
- Pandas – This library helps to load the data frame in a 2D array format and has multiple functions to perform analysis tasks in one go.
- Numpy – Numpy arrays are very fast and can perform large computations in a very short time.
- Matplotlib – This library is used to draw visualizations.
- Sklearn – This module contains multiple libraries having pre-implemented functions to perform tasks from data preprocessing to model development and evaluation.
- OpenCV – This is an open-source library mainly focused on image processing and handling.
- Tensorflow – This is an open-source library that is used for Machine Learning and Artificial intelligence and provides a range of functions to achieve complex functionalities with single lines of code.
Python3
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sb import tensorflow as tf from tensorflow import keras from keras import layers import warnings warnings.filterwarnings( 'ignore' ) |
Python3
df = pd.read_csv( 'auto-mpg.csv' ) df.head() |
Output:
Let’s check the shape of the data.
Python3
df.shape |
Output:
(398, 9)
Now, check the datatypes of the columns.
Python3
df.info() |
Output:
Here we can observe one discrepancy the horsepower is given in the object datatype whereas it should be in the numeric datatype.
Python3
df.describe() |
Output:
Predict Fuel Efficiency Using Tensorflow in Python
In this article, we will learn how can we build a fuel efficiency predicting model by using TensorFlow API. The dataset we will be using contain features like the distance engine has traveled, the number of cylinders in the car, and other relevant feature.