-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_models.py
More file actions
32 lines (25 loc) · 761 Bytes
/
plot_models.py
File metadata and controls
32 lines (25 loc) · 761 Bytes
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
import pandas as pd
import matplotlib.pyplot as plt
# Read the results CSV
df = pd.read_csv('model_results.csv')
print("Columns found in CSV:", df.columns.tolist())
# Create a grid of x values for smooth curves
x = df['x'].values
y_true = df['y_true'].values
y_lin = df['y_linear'].values
y_nn = df['y_neural'].values
plt.figure(figsize=(8, 6))
# Scatter of true data
plt.scatter(x, y_true, label='True data', color='black', s=20)
# Linear model curve
plt.plot(x, y_lin, label='Linear Model', color='blue')
# Neural model curve
plt.plot(x, y_nn, label='Neural Model', color='red')
plt.title('Model Approximations vs True Data')
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.savefig('model_comparison.png')
plt.show()