O'Reilly logo

Python Deep Learning Cookbook by Indra den Bakker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. Import the libraries as follows:
import numpy as np import pandas as pdfrom sklearn.model_selection import train_test_splitfrom keras.models import Sequentialfrom keras.layers import Dense, Dropoutfrom keras.wrappers.scikit_learn import KerasRegressorfrom sklearn.model_selection import cross_val_scorefrom sklearn.model_selection import KFoldfrom sklearn.preprocessing import StandardScalerfrom sklearn.pipeline import Pipelineimport numpy as npfrom matplotlib import pyplot as plt
  1. Load the dataset and extract features:
data = pd.read_csv('../Data/Bike-Sharing-Dataset/hour.csv')# Feature engineeringohe_features = ['season', 'weathersit', 'mnth', 'hr', 'weekday']for feature in ohe_features: dummies = pd.get_dummies(data[feature], ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required