generated from maycuatroi/python-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b857e41
commit 31ec618
Showing
3 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.12 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from evo_science.entities.metrics import WAPE | ||
|
||
if __name__ == '__main__': | ||
import pandas as pd | ||
import numpy as np | ||
|
||
# Assuming the WAPE metric is in a module named metrics.py | ||
|
||
# Create a sample DataFrame with true values and predicted values | ||
data = { | ||
'y_true': [100, 150, 200, 250, 300], | ||
'y_pred': [110, 140, 190, 260, 310] | ||
} | ||
|
||
df = pd.DataFrame(data) | ||
|
||
# Convert DataFrame columns to numpy arrays | ||
y_true = df['y_true'].values | ||
y_pred = df['y_pred'].values | ||
|
||
# Initialize WAPE metric | ||
wape_metric = WAPE() | ||
|
||
# Calculate WAPE | ||
wape_value = wape_metric._calculate_np(y_true, y_pred) | ||
|
||
# Print the result | ||
print(f"WAPE: {wape_value:.2f}%") |