-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomparison-graphs-classical-ML.py
More file actions
44 lines (35 loc) · 1.49 KB
/
comparison-graphs-classical-ML.py
File metadata and controls
44 lines (35 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import matplotlib.pyplot as plt
import pandas as pd
# Data for Logistic Regression
data_logistic_regression = {
"Step": range(1, 11),
"Accuracy": [63.21, 36.78, 95.89, 95.89, 63.21, 63.21, 95.89, 96.12, 96.69, 96.24]
}
# Data for Support Vector Machine (SVM)
data_svm = {
"Step": range(1, 11),
"Accuracy": [63.21, 63.21, 63.21, 63.21, 96.81, 96.69, 96.58, 96.58, 96.58, 96.58]
}
# Data for Random Forest
data_random_forest = {
"Step": range(1, 15),
"Accuracy": [63.43, 63.55, 63.21, 64.35, 65.71, 75.62, 81.89, 82.68, 94.53, 94.64, 94.64, 94.64, 94.87, 94.53]
}
# Convert to DataFrames
df_logistic_regression = pd.DataFrame(data_logistic_regression)
df_svm = pd.DataFrame(data_svm)
df_random_forest = pd.DataFrame(data_random_forest)
# Plot Accuracy Comparison for Logistic Regression, SVM, and Random Forest
plt.figure(figsize=(12, 6))
# Logistic Regression
plt.plot(df_logistic_regression["Step"], df_logistic_regression["Accuracy"], marker='o', linestyle='-', linewidth=2, color='purple', label="Logistic Regression Accuracy")
# SVM
plt.plot(df_svm["Step"], df_svm["Accuracy"], marker='s', linestyle='--', linewidth=2, color='brown', label="SVM Accuracy")
# Random Forest
plt.plot(df_random_forest["Step"], df_random_forest["Accuracy"], marker='d', linestyle=':', linewidth=2, color='darkgreen', label="Random Forest Accuracy")
plt.xlabel("Step")
plt.ylabel("Accuracy (%)")
plt.title("Accuracy Comparison: Logistic Regression vs. SVM vs. Random Forest")
plt.legend()
plt.grid(True)
plt.show()