Skip to content

Commit c461ba9

Browse files
Updated calculation of accuracy
1 parent d3c7f2c commit c461ba9

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/iplane/model_runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def plotEvaluate(self, test_loader: DataLoader, ax=None, is_plot: bool = True):
123123
prediction_tnsr = self.predict(feature_tnsr)
124124
prediction_df = pd.DataFrame(prediction_tnsr.to(cn.CPU).numpy(), columns=columns)
125125
target_df = pd.DataFrame(target_tnsr.to(cn.CPU).numpy(), columns=columns)
126-
plot_df = (prediction_df - target_df)/target_df
126+
numerator_arr = np.abs(prediction_df - target_df)/target_df
127+
arr1 = numerator_arr/target_df.values
128+
arr2 = numerator_arr/prediction_df.values
129+
plot_df = pd.DataFrame(np.maximum(arr1, arr2), columns=columns)
127130
plot_df['class'] = "relative error"
128131
# Plot
129132
if ax is None:

tests/test_model_runner_nn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
IGNORE_TESTS = True
1515
IS_PLOT = True
16+
NUM_EPOCH = 1000
1617
NUM_EPOCH = 20000
17-
NUM_EPOCH = 2000
1818

1919
TARGET_COLUMN = "target" # Assuming the target column is named 'target'
2020
NUM_DEPENDENT_FEATURE = 6

0 commit comments

Comments
 (0)