from sklearn.preprocessing import MinMaxScaler
 
# 数据归一化
scaler = MinMaxScaler(feature_range=(0, 1))
scaler.fit_transform(dataset)
train = scaler.transform(train)
val = scaler.transform(val)
test = scaler.transform(test)
 
data_range = MinMaxScaler.data_range_
data_min = MinMaxScaler.data_min_
outputs = outputs * data_range[0] + data_min[0]
y_val = y_val * data_range[0] + data_min[0]