wi-lab commited on
Commit
f938ef0
·
verified ·
1 Parent(s): ba7035a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -160,7 +160,7 @@ from sklearn.metrics import f1_score
160
  import seaborn as sns
161
 
162
  # Function to compute confusion matrix, F1-score and plot it with dark mode style
163
- def plot_confusion_matrix_from_csv(csv_file_path, title, save_path, light_mode=True):
164
  # Load CSV file
165
  data = pd.read_csv(csv_file_path)
166
 
@@ -181,8 +181,9 @@ def plot_confusion_matrix_from_csv(csv_file_path, title, save_path, light_mode=T
181
  cmap = 'Blues' # Light-mode-friendly colormap
182
  else:
183
  plt.style.use('dark_background') # Dark mode styling
184
- text_color = 'white'
185
- cmap = 'magma' # Dark-mode-friendly colormap
 
186
 
187
  plt.figure(figsize=(5, 5))
188
 
@@ -336,7 +337,7 @@ def classify_based_on_distance(train_data, train_labels, test_data):
336
 
337
  return torch.tensor(predictions) # Return predictions as a PyTorch tensor
338
 
339
- def plot_confusion_matrix(y_true, y_pred, title, light_mode=True):
340
  cm = confusion_matrix(y_true, y_pred)
341
 
342
  # Calculate F1 Score
@@ -351,8 +352,9 @@ def plot_confusion_matrix(y_true, y_pred, title, light_mode=True):
351
  cmap = 'Blues' # Light-mode-friendly colormap
352
  else:
353
  plt.style.use('dark_background') # Dark mode styling
354
- text_color = 'white'
355
- cmap = 'magma' # Dark-mode-friendly colormap
 
356
 
357
  plt.figure(figsize=(5, 5))
358
 
 
160
  import seaborn as sns
161
 
162
  # Function to compute confusion matrix, F1-score and plot it with dark mode style
163
+ def plot_confusion_matrix_from_csv(csv_file_path, title, save_path, light_mode=False):
164
  # Load CSV file
165
  data = pd.read_csv(csv_file_path)
166
 
 
181
  cmap = 'Blues' # Light-mode-friendly colormap
182
  else:
183
  plt.style.use('dark_background') # Dark mode styling
184
+ text_color = 'gray'
185
+ #cmap = 'magma' # Dark-mode-friendly colormap
186
+ cmap = 'coolwarm'
187
 
188
  plt.figure(figsize=(5, 5))
189
 
 
337
 
338
  return torch.tensor(predictions) # Return predictions as a PyTorch tensor
339
 
340
+ def plot_confusion_matrix(y_true, y_pred, title, light_mode=False):
341
  cm = confusion_matrix(y_true, y_pred)
342
 
343
  # Calculate F1 Score
 
352
  cmap = 'Blues' # Light-mode-friendly colormap
353
  else:
354
  plt.style.use('dark_background') # Dark mode styling
355
+ text_color = 'gray'
356
+ #cmap = 'magma' # Dark-mode-friendly colormap
357
+ cmap = 'coolwarm'
358
 
359
  plt.figure(figsize=(5, 5))
360