- First, load all libraries:
import numpy as npimport pandas as pdfrom matplotlib import pyplot as pltfrom keras.models import Sequentialfrom keras.layers import Dense, Dropoutfrom keras import regularizers
- Import the data and extract the features:
data = pd.read_csv('Data/bike-sharing/hour.csv')# Feature engineeringohe_features = ['season', 'weathersit', 'mnth', 'hr', 'weekday']for feature in ohe_features: dummies = pd.get_dummies(data[feature], prefix=feature, drop_first=False) data = pd.concat([data, dummies], axis=1)drop_features = ['instant', 'dteday', 'season', 'weathersit', 'weekday', 'atemp', 'mnth', 'workingday', 'hr', 'casual', 'registered']data = data.drop(drop_features, axis=1)
- Normalize numerical data: