Skip to content

Instantly share code, notes, and snippets.

@Sanlap1997
Created October 3, 2020 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sanlap1997/d29b59bbba070b745e59402d0b21b833 to your computer and use it in GitHub Desktop.
Save Sanlap1997/d29b59bbba070b745e59402d0b21b833 to your computer and use it in GitHub Desktop.
# MinMax normalization (from 0 to 1)
train_df['cycle_norm'] = train_df['cycle']
cols_normalize = train_df.columns.difference(['id','cycle','RUL','label1','label2'])
min_max_scaler = preprocessing.MinMaxScaler()
norm_train_df = pd.DataFrame(min_max_scaler.fit_transform(train_df[cols_normalize]),
columns=cols_normalize,
index=train_df.index)
join_df = train_df[train_df.columns.difference(cols_normalize)].join(norm_train_df)
train_df = join_df.reindex(columns = train_df.columns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment