Skip to content

Instantly share code, notes, and snippets.

@BinarySpoon
Created November 3, 2020 13:29
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 BinarySpoon/b76b341a1a5ed31221928ad489d61b6c to your computer and use it in GitHub Desktop.
Save BinarySpoon/b76b341a1a5ed31221928ad489d61b6c to your computer and use it in GitHub Desktop.
# Log transformation -->
features = ['NOX','PTRATIO','RM','TAX','LSTAT','INDUS']
x_data = boston_data.loc[:,features]
y_label = boston_data['Target']
min_max_scaler = MinMaxScaler()
x_data = pd.DataFrame(data=min_max_scaler.fit_transform(x_data), columns = features)
y_label = np.log1p(y_label)
for features in x_data.columns:
if np.abs(x_data[features].skew()) > 0.5:
x_data[features] = np.log1p(x_data[features])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment