提示:以下是本篇文章正文内容,下面案例可供参考
1.引入库
import pandas as pd
import numpy as np
import tensorflow as tf
from sklearn.preprocessing import MinMaxScaler, LabelEncoder
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense, Dropout
from matplotlib import pyplot as plt
%matplotlib inline
2.读入数据
raw_data = pd.read_csv("C:/Users/ROG/Desktop/report1/dataset/train.csv")
raw_data.drop('Id', axis=1, inplace=True)
raw_data.info()
3.连续数值归一化
numeric_features =raw_data.dtypes[raw_data.dtypes != 'object' ].index
numeric_features=numeric_features[:-1]#不对房价处理
raw_data[numeric_features] = raw_data[numeric_features].apply(lambda x: (x - x.mean())/(x.std()))
raw_data.info()