text: # Multiple methods to standardize numeric variables. Ensures that each variable can be compared on a similar scale. 
  # Features that are reviewed the most contain large population variance values.
  
  # Log normalization
  # Print out the variance of the Proline column
  print(wine["Proline"].var())
  
  # Apply the log normalization function to the Proline column
  wine["Proline_log"] = np.log(wine["Proline"])
  
  # Check the variance of the normalized Proline column
  print(wine["Proline_log"].var())
  
  # StandardScaler
  # Import StandardScaler from scikit-learn
  from sklearn.preprocessing import StandardScaler
  
  # Create the scaler
  ss = StandardScaler()
  
  # Take a subset of the DataFrame you want to scale 
  wine_subset = wine[["Ash", "Alcalinity of ash", "Magnesium"]]
  
  # Apply the scaler to the DataFrame subset - using the method fit_transform will fit and transform the data in one step.
  wine_subset_scaled = ss.fit_transform(wine_subset)
  
  
  # ML model performance - comparing non-scaled and scaled model accuracy
  # Split the dataset and labels into training and test sets
  X_train, X_test, y_train, y_test = train_test_split(X, y)
  
  # Fit the k-nearest neighbors model to the training data
  knn.fit(X_train, y_train)
  
  # Score the model on the test data
  print(knn.score(X_test, y_test))
  
  # Create the scaling method.
  ss = StandardScaler()
  
  # Apply the scaling method to the dataset used for modeling.
  X_scaled = ss.fit_transform(X)
  X_train, X_test, y_train, y_test = train_test_split(X_scaled, y)
  
  # Fit the k-nearest neighbors model to the training data.
  knn.fit(X_train, y_train)
  
  # Score the model on the test data.
  print(knn.score(X_test, y_test))
  