Skip to content

Commit c44f7b4

Browse files
committed
Remove the exact p-value compute
1 parent 662aa64 commit c44f7b4

File tree

2 files changed

+1
-40
lines changed

2 files changed

+1
-40
lines changed

examples/tutorials/plot_tuto_mcar.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -394,18 +394,3 @@
394394
# As a result, by removing the missing patterns induced by variable 2, the p-value rises
395395
# above the significance threshold set beforehand. Thus in this sense, the test detects that the
396396
# main culprit of the MAR mechanism lies in the second variable.
397-
398-
399-
# %%
400-
# Calculation time -> TO BE DELETED
401-
# | **n_rows** | **n_cols** | **Calculation_time** |
402-
# |------------|------------|----------------------|
403-
# | 200 | 2 | 2"12 |
404-
# | 500 | 2 | 2"24 |
405-
# | 500 | 4 | 2"18 |
406-
# | 1000 | 4 | 2"48 |
407-
# | 1000 | 6 | 2"42 |
408-
# | 10000 | 6 | 20"54 |
409-
# | 10000 | 10 | 14"48 |
410-
# | 100000 | 10 | 4'51" |
411-
# | 100000 | 15 | 3'06" |

qolmat/analysis/holes_characterization.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ class PKLMTest(McarTest):
188188
Number of trees per projection.
189189
compute_partial_p_values : bool
190190
If true, compute the partial p-values.
191-
exact_p_value : bool
192-
If True, compute exact p-value.
193191
encoder : OneHotEncoder or None, default=None
194192
Encoder to convert non numeric pandas dataframe values to numeric
195193
values.
@@ -206,7 +204,6 @@ def __init__(
206204
nb_permutation: int = 30,
207205
nb_trees_per_proj: int = 200,
208206
compute_partial_p_values: bool = False,
209-
exact_p_value: bool = False,
210207
encoder: Union[None, OneHotEncoder] = None,
211208
random_state: Union[None, int, np.random.RandomState] = None,
212209
):
@@ -216,14 +213,8 @@ def __init__(
216213
self.nb_permutation = nb_permutation
217214
self.nb_trees_per_proj = nb_trees_per_proj
218215
self.compute_partial_p_values = compute_partial_p_values
219-
self.exact_p_value = exact_p_value
220216
self.encoder = encoder
221217

222-
if self.exact_p_value:
223-
self.process_permutation = self._parallel_process_permutation_exact
224-
else:
225-
self.process_permutation = self._parallel_process_permutation
226-
227218
def _encode_dataframe(self, df: pd.DataFrame) -> np.ndarray:
228219
"""Encode the DataFrame.
229220
@@ -593,21 +584,6 @@ def _parallel_process_permutation(
593584
y = self._build_label(X, M_perm, features_idx, target_idx)
594585
return self._U_hat(oob_probabilities, y)
595586

596-
def _parallel_process_permutation_exact(
597-
self,
598-
X: np.ndarray,
599-
M_perm: np.ndarray,
600-
features_idx: np.ndarray,
601-
target_idx: int,
602-
oob_probabilites_unused: np.ndarray,
603-
) -> float:
604-
X_features, _ = self._build_dataset(X, features_idx, target_idx)
605-
y = self._build_label(X, M_perm, features_idx, target_idx)
606-
# In this case, we fit the classifier in each permutation.
607-
# It takes much more longer.
608-
oob_probabilities = self._get_oob_probabilities(X_features, y)
609-
return self._U_hat(oob_probabilities, y)
610-
611587
def _parallel_process_projection(
612588
self,
613589
X: np.ndarray,
@@ -622,7 +598,7 @@ def _parallel_process_projection(
622598
# We fit only one classifier to get oob probabilities and compute u_hat
623599
# nb_permutations times.
624600
result_u_permutations = Parallel(n_jobs=-1)(
625-
delayed(self.process_permutation)(
601+
delayed(self._parallel_process_permutation)(
626602
X, M_perm, features_idx, target_idx, oob_probabilities
627603
)
628604
for M_perm in list_permutations

0 commit comments

Comments
 (0)