Skip to content

Commit

Permalink
1b PM - alpha correction
Browse files Browse the repository at this point in the history
  • Loading branch information
qnater committed Jan 8, 2025
1 parent e9311ca commit b8792a2
Show file tree
Hide file tree
Showing 25 changed files with 183 additions and 204 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pytest - ImputeGAP - Pipeline - 10
name: VERSIONING 3.10 - Pipeline

on:
push:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/pytest_pipeline_3_11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: VERSIONING 3.11 - Pipeline

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libmlpack-dev
sudo apt-get install libopenblas-dev
sudo apt-get install python3-dev build-essential
pip install --upgrade google protobuf
pip install -r requirements.txt
pip install mypy
pip install pytest
- name: Run pytest
run: |
python -m pytest ./tests/test_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pytest - ImputeGAP - Pipeline - 12
name: VERSIONING 3.12 - Pipeline

on:
push:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pytest - ImputeGAP - Pipeline - 12.6
name: VERSIONING 3.12.6 - Pipeline

on:
push:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pytest - ImputeGAP - Pipeline - 12.8
name: VERSIONING 3.12.8 - Pipeline

on:
push:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pytest - ImputeGAP - Pipeline - 13
name: VERSIONING 3.13 - Pipeline

on:
push:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/pytest_pipeline_3_8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: VERSIONING 3.8 - Pipeline

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libmlpack-dev
sudo apt-get install libopenblas-dev
sudo apt-get install python3-dev build-essential
pip install --upgrade google protobuf
pip install -r requirements.txt
pip install mypy
pip install pytest
- name: Run pytest
run: |
python -m pytest ./tests/test_pipeline.py
35 changes: 35 additions & 0 deletions .github/workflows/pytest_pipeline_3_9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: VERSIONING 3.9 - Pipeline

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libmlpack-dev
sudo apt-get install libopenblas-dev
sudo apt-get install python3-dev build-essential
pip install --upgrade google protobuf
pip install -r requirements.txt
pip install mypy
pip install pytest
- name: Run pytest
run: |
python -m pytest ./tests/test_pipeline.py
229 changes: 49 additions & 180 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file modified imputegap/recovery/__pycache__/explainer.cpython-312.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions imputegap/recovery/explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ def shap_explainer(input_data, algorithm="cdrec", params=None, pattern="mcar", m

training_ratio = int(limit * split_ratio)

if limit > M:
limit = M

print("\nFrom", limit, "/", M, "elements, the training dataset has been set with", training_ratio,"elements and the testing dataset with", (limit-training_ratio), "elements")

if verbose:
Expand Down
Binary file modified tests/__pycache__/test_explainer.cpython-312-pytest-8.3.3.pyc
Binary file not shown.
Binary file modified tests/assets/shap/chlorine_cdrec_DTL_Beeswarm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_DTL_Waterfall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 16 additions & 16 deletions tests/assets/shap/chlorine_cdrec_results.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Feature : 1 cdrec with a score of 68.3 Geometry 10-bin histogram mode DN_HistogramMode_10
Feature : 12 cdrec with a score of 9.34 Correlation Change in autocorrelation timescale after incremental differencing FC_LocalSimple_mean1_tauresrat
Feature : 5 cdrec with a score of 4.68 Correlation Time reversibility CO_trev_1_num
Feature : 6 cdrec with a score of 4.63 Geometry Proportion of high incremental changes in the series MD_hrv_classic_pnn40
Feature : 13 cdrec with a score of 3.38 Geometry Positive outlier timing DN_OutlierInclude_p_001_mdrmd
Feature : 4 cdrec with a score of 2.68 Correlation Histogram-based automutual information (lag 2, 5 bins) CO_HistogramAMI_even_2_5
Feature : 2 cdrec with a score of 2.28 Correlation First 1/e crossing of the ACF CO_f1ecac
Feature : 14 cdrec with a score of 1.37 Geometry Negative outlier timing DN_OutlierInclude_n_001_mdrmd
Feature : 17 cdrec with a score of 0.66 Trend Entropy of successive pairs in symbolized series SB_MotifThree_quantile_hh
Feature : 0 cdrec with a score of 0.65 Geometry 5-bin histogram mode DN_HistogramMode_5
Feature : 21 cdrec with a score of 0.62 Trend Error of 3-point rolling mean forecast FC_LocalSimple_mean3_stderr
Feature : 8 cdrec with a score of 0.5 Geometry Transition matrix column variance SB_TransitionMatrix_3ac_sumdiagcov
Feature : 10 cdrec with a score of 0.5 Geometry Goodness of exponential fit to embedding distance distribution CO_Embed2_Dist_tau_d_expfit_meandiff
Feature : 15 cdrec with a score of 0.42 Transformation Power in the lowest 20% of frequencies SP_Summaries_welch_rect_area_5_1
Feature : 3 cdrec with a score of 0.0 Correlation First minimum of the ACF CO_FirstMin_ac
Feature : 6 cdrec with a score of 22.22 Geometry Proportion of high incremental changes in the series MD_hrv_classic_pnn40
Feature : 15 cdrec with a score of 10.24 Transformation Power in the lowest 20% of frequencies SP_Summaries_welch_rect_area_5_1
Feature : 10 cdrec with a score of 9.27 Geometry Goodness of exponential fit to embedding distance distribution CO_Embed2_Dist_tau_d_expfit_meandiff
Feature : 0 cdrec with a score of 9.07 Geometry 5-bin histogram mode DN_HistogramMode_5
Feature : 5 cdrec with a score of 8.31 Correlation Time reversibility CO_trev_1_num
Feature : 21 cdrec with a score of 7.84 Trend Error of 3-point rolling mean forecast FC_LocalSimple_mean3_stderr
Feature : 2 cdrec with a score of 7.65 Correlation First 1/e crossing of the ACF CO_f1ecac
Feature : 14 cdrec with a score of 6.67 Geometry Negative outlier timing DN_OutlierInclude_n_001_mdrmd
Feature : 1 cdrec with a score of 5.0 Geometry 10-bin histogram mode DN_HistogramMode_10
Feature : 8 cdrec with a score of 3.75 Geometry Transition matrix column variance SB_TransitionMatrix_3ac_sumdiagcov
Feature : 4 cdrec with a score of 3.11 Correlation Histogram-based automutual information (lag 2, 5 bins) CO_HistogramAMI_even_2_5
Feature : 17 cdrec with a score of 2.06 Trend Entropy of successive pairs in symbolized series SB_MotifThree_quantile_hh
Feature : 3 cdrec with a score of 1.63 Correlation First minimum of the ACF CO_FirstMin_ac
Feature : 12 cdrec with a score of 1.58 Correlation Change in autocorrelation timescale after incremental differencing FC_LocalSimple_mean1_tauresrat
Feature : 13 cdrec with a score of 1.55 Geometry Positive outlier timing DN_OutlierInclude_p_001_mdrmd
Feature : 9 cdrec with a score of 0.04 Trend Wangs periodicity metric PD_PeriodicityWang_th0_01
Feature : 7 cdrec with a score of 0.0 Geometry Longest stretch of above-mean values SB_BinaryStats_mean_longstretch1
Feature : 9 cdrec with a score of 0.0 Trend Wangs periodicity metric PD_PeriodicityWang_th0_01
Feature : 11 cdrec with a score of 0.0 Correlation First minimum of the AMI function IN_AutoMutualInfoStats_40_gaussian_fmmi
Feature : 16 cdrec with a score of 0.0 Geometry Longest stretch of decreasing values SB_BinaryStats_diff_longstretch0
Feature : 18 cdrec with a score of 0.0 Geometry Rescaled range fluctuation analysis (low-scale scaling) SC_FluctAnal_2_rsrangefit_50_1_logi_prop_r1
Expand Down
Binary file modified tests/assets/shap/chlorine_cdrec_shap_aggregate_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_shap_aggregate_reverse_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_shap_correlation_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_shap_geometry_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_shap_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_shap_reverse_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_shap_transformation_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/assets/shap/chlorine_cdrec_shap_trend_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/test_contamination_mcar.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@ def test_mcar_size_of_block(self):

for block in nan_blocks:
assert block >= block_size, (
f"Dataset: {dataset}, Series: {i}, Seed: {seed_value}, "
f"Dataset: {dataset}, Series: {i}, "
f"Block size {block} found, expected at least {block_size}."
)
6 changes: 4 additions & 2 deletions tests/test_explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def test_explainer_shap(self):
self.assertTrue(shap_values is not None)
self.assertTrue(shap_details is not None)

print("shap_details", np.array(shap_details).shape)
print("RMSE", np.array(RMSE).shape)

for i, (_, output) in enumerate(shap_details):
assert np.isclose(RMSE[i], output, atol=0.01)

Expand All @@ -41,8 +44,7 @@ def test_explainer_shap(self):
self.assertTrue(description is not None)
self.assertTrue(feature is not None)
self.assertTrue(category is not None)
self.assertTrue(
mean_features is not None and not (isinstance(mean_features, (int, float)) and np.isnan(mean_features)))
self.assertTrue(mean_features is not None and not (isinstance(mean_features, (int, float)) and np.isnan(mean_features)))

# Check relation feature/category
feature_found_in_category = False
Expand Down

0 comments on commit b8792a2

Please sign in to comment.