@@ -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