Skip to content

Commit

Permalink
correction of the shap explainer and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
qnater committed Sep 25, 2024
1 parent eb5543a commit ee6b97b
Show file tree
Hide file tree
Showing 70 changed files with 426 additions and 204 deletions.
110 changes: 72 additions & 38 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file removed assets/test_contamination.png
Binary file not shown.
Binary file removed assets/test_ground_truth.png
Binary file not shown.
Binary file modified imputegap/algorithms/__pycache__/cdrec.cpython-312.pyc
Binary file not shown.
8 changes: 1 addition & 7 deletions imputegap/algorithms/cdrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __marshal_as_native_column(__py_matrix):
return __ctype_marshal;


def load_share_lib(name="lib_algo"):
def load_share_lib(name="lib_cdrec"):
"""
Determine the OS and load the correct shared library
:param name: name of the library
Expand All @@ -36,7 +36,6 @@ def load_share_lib(name="lib_algo"):
lib_path = os.path.join(local_path_win)
else:
lib_path = os.path.join(local_path_lin)
print("\n", lib_path, " has been loaded...")

return ctypes.CDLL(lib_path)

Expand Down Expand Up @@ -71,11 +70,6 @@ def native_cdrec(__py_matrix, __py_rank, __py_eps, __py_iters):
# Native code uses linear matrix layout, and also it's easier to pass it in like this
__ctype_input_matrix = __marshal_as_native_column(__py_matrix);

# extern "C" void
# cdrec_imputation_parametrized(
# double *matrixNative, size_t dimN, size_t dimM,
# size_t truncation, double epsilon, size_t iters
# )
shared_lib.cdrec_imputation_parametrized(
__ctype_input_matrix, __ctype_sizen, __ctype_sizem,
__ctype_rank, __ctype_eps, __ctype_iters
Expand Down
Binary file modified imputegap/algorithms/lib/lib_cdrec.so
Binary file not shown.
Empty file.
File renamed without changes
1 change: 1 addition & 0 deletions imputegap/assets/ground_truth/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

File renamed without changes
Empty file.
Binary file removed imputegap/assets/iim_imputation.png
Binary file not shown.
Empty file.
File renamed without changes
Binary file not shown.
Empty file added imputegap/assets/shap/.gitkeep
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions imputegap/assets/shap/chlorine_cdrec_results.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature : 1 cdrec with a score of 87.98 Geometry 10-bin histogram mode DN_HistogramMode_10
Feature : 12 cdrec with a score of 5.06 Correlation Change in autocorrelation timescale after incremental differencing FC_LocalSimple_mean1_tauresrat
Feature : 5 cdrec with a score of 4.74 Correlation Time reversibility CO_trev_1_num
Feature : 3 cdrec with a score of 1.21 Correlation First minimum of the ACF CO_FirstMin_ac
Feature : 18 cdrec with a score of 0.53 Geometry Rescaled range fluctuation analysis (low-scale scaling) SC_FluctAnal_2_rsrangefit_50_1_logi_prop_r1
Feature : 14 cdrec with a score of 0.28 Geometry Negative outlier timing DN_OutlierInclude_n_001_mdrmd
Feature : 13 cdrec with a score of 0.11 Geometry Positive outlier timing DN_OutlierInclude_p_001_mdrmd
Feature : 6 cdrec with a score of 0.08 Geometry Proportion of high incremental changes in the series MD_hrv_classic_pnn40
Feature : 0 cdrec with a score of 0.0 Geometry 5-bin histogram mode DN_HistogramMode_5
Feature : 2 cdrec with a score of 0.0 Correlation First 1/e crossing of the ACF CO_f1ecac
Feature : 4 cdrec with a score of 0.0 Correlation Histogram-based automutual information (lag 2, 5 bins) CO_HistogramAMI_even_2_5
Feature : 7 cdrec with a score of 0.0 Geometry Longest stretch of above-mean values SB_BinaryStats_mean_longstretch1
Feature : 8 cdrec with a score of 0.0 Geometry Transition matrix column variance SB_TransitionMatrix_3ac_sumdiagcov
Feature : 9 cdrec with a score of 0.0 Trend Wangs periodicity metric PD_PeriodicityWang_th0_01
Feature : 10 cdrec with a score of 0.0 Geometry Goodness of exponential fit to embedding distance distribution CO_Embed2_Dist_tau_d_expfit_meandiff
Feature : 11 cdrec with a score of 0.0 Correlation First minimum of the AMI function IN_AutoMutualInfoStats_40_gaussian_fmmi
Feature : 15 cdrec with a score of 0.0 Transformation Power in the lowest 20% of frequencies SP_Summaries_welch_rect_area_5_1
Feature : 16 cdrec with a score of 0.0 Geometry Longest stretch of decreasing values SB_BinaryStats_diff_longstretch0
Feature : 17 cdrec with a score of 0.0 Trend Entropy of successive pairs in symbolized series SB_MotifThree_quantile_hh
Feature : 19 cdrec with a score of 0.0 Geometry Detrended fluctuation analysis (low-scale scaling) SC_FluctAnal_2_dfa_50_1_2_logi_prop_r1
Feature : 20 cdrec with a score of 0.0 Transformation Centroid frequency SP_Summaries_welch_rect_centroid
Feature : 21 cdrec with a score of 0.0 Trend Error of 3-point rolling mean forecast FC_LocalSimple_mean3_stderr
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
17 changes: 9 additions & 8 deletions imputegap/contamination/contamination.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ def scenario_mcar(ts, series_impacted=0.2, missing_rate=0.2, block_size=10, prot

series_selected = Contamination.format_selection(ts_contaminated, series_indices)

print("\n\nMCAR contamination has been called with :"
"\n\ta number of series impacted ", series_impacted * 100, "%",
"\n\ta missing rate of ", missing_rate * 100, "%",
"\n\ta starting position at ", protection,
"\n\ta block size of ", block_size,
"\n\twith a seed option set to ", use_seed,
"\n\tshape of the set ", ts_contaminated.shape,
"\n\tthis selection of series", *series_selected, "\n\n")
if not explainer:
print("\n\nMCAR contamination has been called with :"
"\n\ta number of series impacted ", series_impacted * 100, "%",
"\n\ta missing rate of ", missing_rate * 100, "%",
"\n\ta starting position at ", protection,
"\n\ta block size of ", block_size,
"\n\twith a seed option set to ", use_seed,
"\n\tshape of the set ", ts_contaminated.shape,
"\n\tthis selection of series", *series_selected, "\n\n")

for series in series_selected:
S = int(series)
Expand Down
Binary file modified imputegap/explainer/__pycache__/explainer.cpython-312.pyc
Binary file not shown.
Loading

0 comments on commit ee6b97b

Please sign in to comment.