oikan 0.0.1.6__py3-none-any.whl → 0.0.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oikan/metrics.py +25 -0
- {oikan-0.0.1.6.dist-info → oikan-0.0.1.7.dist-info}/METADATA +1 -1
- {oikan-0.0.1.6.dist-info → oikan-0.0.1.7.dist-info}/RECORD +6 -5
- {oikan-0.0.1.6.dist-info → oikan-0.0.1.7.dist-info}/LICENSE +0 -0
- {oikan-0.0.1.6.dist-info → oikan-0.0.1.7.dist-info}/WHEEL +0 -0
- {oikan-0.0.1.6.dist-info → oikan-0.0.1.7.dist-info}/top_level.txt +0 -0
oikan/metrics.py
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
import numpy as np
|
2
|
+
import torch
|
3
|
+
|
4
|
+
def evaluate_regression(model, X, y):
|
5
|
+
# Evaluate regression performance (MSE, MAE, RMSE)
|
6
|
+
with torch.no_grad():
|
7
|
+
X_tensor = torch.FloatTensor(X)
|
8
|
+
y_pred = model(X_tensor).numpy().ravel()
|
9
|
+
mse = np.mean((y - y_pred)**2)
|
10
|
+
mae = np.mean(np.abs(y - y_pred))
|
11
|
+
rmse = np.sqrt(mse)
|
12
|
+
print("Mean Squared Error:", mse)
|
13
|
+
print("Mean Absolute Error:", mae)
|
14
|
+
print("Root Mean Squared Error:", rmse)
|
15
|
+
return mse, mae, rmse
|
16
|
+
|
17
|
+
def evaluate_classification(model, X, y):
|
18
|
+
# Evaluate classification accuracy
|
19
|
+
with torch.no_grad():
|
20
|
+
X_tensor = torch.FloatTensor(X)
|
21
|
+
logits = model(X_tensor)
|
22
|
+
y_pred = torch.argmax(logits, dim=1).numpy()
|
23
|
+
accuracy = np.mean(y_pred == y)
|
24
|
+
print("Classification Accuracy:", accuracy)
|
25
|
+
return accuracy
|
@@ -1,12 +1,13 @@
|
|
1
1
|
oikan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
oikan/metrics.py,sha256=z3V0GI_edR7hYt_ic08Utfln5ynfqCfO1Gq0Yq4Q42Q,846
|
2
3
|
oikan/model.py,sha256=9_U3jh1YwASbLOgHpFm4F80J3QGEhzIgQHNkqbZCPJs,2920
|
3
4
|
oikan/regularization.py,sha256=D0Xc2lr5X5ORdA5ltvWDbNDuN8z0hkyoGzFo7pum2XE,1033
|
4
5
|
oikan/symbolic.py,sha256=K1aI5JEPgKFu8dyjXxWDA-UZm8Gvfp0lU1M7c2NAPLY,5517
|
5
6
|
oikan/trainer.py,sha256=itFCHSR_T6KHqa0D5RLRCmqFHa4lUIamsFGWKHmUZuI,1258
|
6
7
|
oikan/utils.py,sha256=XwY6pgAgfYlUI9SOjdop91wh0_t6LfPLCiHretlw2Wg,1754
|
7
8
|
oikan/visualize.py,sha256=7GTvfeFxrezHKMM9QmYaax75rMnTxMH0KYi_fbAw4-M,2501
|
8
|
-
oikan-0.0.1.
|
9
|
-
oikan-0.0.1.
|
10
|
-
oikan-0.0.1.
|
11
|
-
oikan-0.0.1.
|
12
|
-
oikan-0.0.1.
|
9
|
+
oikan-0.0.1.7.dist-info/LICENSE,sha256=75ASVmU-XIpN-M4LbVmJ_ibgbzbvRLVti8FhnR0BTf8,1096
|
10
|
+
oikan-0.0.1.7.dist-info/METADATA,sha256=onbMLORaKPQnqA-nZmydvoLDSR0xtJfh44BqWf_n2Ls,2962
|
11
|
+
oikan-0.0.1.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
12
|
+
oikan-0.0.1.7.dist-info/top_level.txt,sha256=XwnwKwTJddZwIvtrUsAz-l-58BJRj6HjAGWrfYi_3QY,6
|
13
|
+
oikan-0.0.1.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|