
    ӆh~                        S SK r S SKrS SKrS SKrS SKrSSKJr  SSKJrJ	r	   S SK
r S SKJr  S rS rS	 rS
 rSCS jrSCS jrSCS jrSCS jrSCS jrSCS jrSCS jrSCS jrSCS jrSCS jrSCS jrSCS jrSCS jr SCS jr!SCS jr"SCS jr#SCS jr$SCS jr%SCS jr&SCS jr'SCS jr(SCS  jr)SCS! jr*SCS" jr+SCS# jr,SCS$ jr-SCS% jr.SCS& jr/S' r0SCS( jr1SCS) jr2SCS* jr3SCS+ jr4S, r50 r6 SDS- jr7Sq8Sq9Sq:Sq;Sq<Sq=S. r>S/ r?S0 r@S1 rAS2 rBS3 rCS4 rDS5 rES6 rFS7 rGS8 rHS9 rIS: rJS; rKS< rLS= rMS> rNS? rOS@ rPSA rQSB rRg! \ a     GNf = f! \ a
    S SKJr   GN"f = f)E    N   )__version__   )measuresmethods)train_test_splitc                    [         R                  R                  5       n[         R                  R                  S5        / n[        S5       H  n[	        [        U 5      USUS9u  pxpU" 5       nUR                  Xy5        [        R                  " 5       n[        [        U5      " X5      n[        R                  " 5       U-
  n[        R                  " 5       nU" U5        [        R                  " 5       U-
  nUR                  XS-  UR                  S   -  -   5        M     [         R                  R                  U5        S[         R                  " U5      4$ )zCRuntime (sec / 1k samples)
transform = "negate_log"
sort_order = 2
     d   	test_sizerandom_stateg     @@r   N)nprandomseedranger   	__toarrayfittimegetattrr   appendshapemean)Xymodel_generatormethod_nameold_seedmethod_repsiX_trainX_testy_train_modelstart	explainer
build_timeexplain_times                   iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\shap/benchmark/metrics.pyruntimer,      s   
 yy~~HIINN4 K1X&6y|QRUde&f#  !		'# 		G[1%A	YY[5(
		&yy{U* 	:v(=Q(OOP% & IINN8%%%    c           	      :   ^^ S mUU4S jnS[        XSTXC5      4$ )z5Local Accuracy
transform = "identity"
sort_order = 0
c                 f    [         R                  " X-
  5      [         R                  " U 5      S-   -  $ )zQComputes local accuracy as the normalized standard deviation of numerical scores.gư>)r   stdtruepreds     r+   	score_map!local_accuracy.<locals>.score_map>   s%    vvdk"bffTlT&9::r-   c           
      F   > [         R                  " XXU" U5      TTU5      $ N)r   local_accuracy)	r"   r#   r$   y_testattr_functiontrained_modelr   r   r4   s	          r+   score_function&local_accuracy.<locals>.score_functionB   s*    &&fmF.C_V_an
 	
r-   N)__score_method)r   r   r   r   r<   r4   s     `  @r+   r8   r8   8   s%    ;

 dO^YYYr-   c                 x    0 SS_SS_SS_SS_SS_S	S_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_nSXC   4$ )z=Consistency Guarantees
transform = "identity"
sort_order = 1
linear_shap_corr      ?linear_shap_indcoef        kernel_shap_1000_meanrefg?sampling_shap_1000r   saabas	tree_gaintree_shap_tree_path_dependenttree_shap_independent_200mean_abs_tree_shaplime_tabular_regression_1000 lime_tabular_classification_1000maple
tree_maple	deep_shapg333333?expected_gradientsN )r   r   r   r   
guaranteess        r+   consistency_guaranteesrT   J   s    C3 	 	#C	
 	c 	# 	# 	S 	( 	$S 	c 	' 	+C 	 	c  	S!" 	c#J( (((r-   c                 .    [         R                  " U5      $ )z9A trivial metric that is just is the output of the model.)r   r   r1   s     r+   __mean_predrV   j   s    774=r-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Positive (mask)
xlabel = "Max fraction of features kept"
ylabel = "Mean model output"
transform = "identity"
sort_order = 4
r   __run_measurer   	keep_maskrV   r   r   r   r   num_fcountss        r+   keep_positive_maskr]   o   s"     ++Q?QRT_almmr-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Negative (mask)
xlabel = "Max fraction of features kept"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 5
rX   r[   s        r+   keep_negative_maskr`   y   s"     ++Q?QSU`bmnnr-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zsKeep Absolute (mask)
xlabel = "Max fraction of features kept"
ylabel = "R^2"
transform = "identity"
sort_order = 6
r   )rY   r   rZ   sklearnmetricsr2_scorer[   s        r+   keep_absolute_mask__r2re      s1     A/;PWP_P_PhPh r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zwKeep Absolute (mask)
xlabel = "Max fraction of features kept"
ylabel = "ROC AUC"
transform = "identity"
sort_order = 6
r   rY   r   rZ   rb   rc   roc_auc_scorer[   s        r+   keep_absolute_mask__roc_aucri      1     A/;PWP_P_PmPm r-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Positive (mask)
xlabel = "Max fraction of features removed"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 7
r   rY   r   remove_maskrV   r[   s        r+   remove_positive_maskrn      "     --q_STVacnoor-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Negative (mask)
xlabel = "Max fraction of features removed"
ylabel = "Mean model output"
transform = "identity"
sort_order = 8
r_   rl   r[   s        r+   remove_negative_maskrq      "     --q_SUWbdoppr-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )z}Remove Absolute (mask)
xlabel = "Max fraction of features removed"
ylabel = "1 - R^2"
transform = "one_minus"
sort_order = 9
r   )rY   r   rm   rb   rc   rd   r[   s        r+   remove_absolute_mask__r2rt      1     aO![RYRaRaRjRj r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zRemove Absolute (mask)
xlabel = "Max fraction of features removed"
ylabel = "1 - ROC AUC"
transform = "one_minus"
sort_order = 9
r   rY   r   rm   rb   rc   rh   r[   s        r+   remove_absolute_mask__roc_aucrx      1     aO![RYRaRaRoRo r-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Positive (resample)
xlabel = "Max fraction of features kept"
ylabel = "Mean model output"
transform = "identity"
sort_order = 10
r   rY   r   keep_resamplerV   r[   s        r+   keep_positive_resampler}      "     //UVXcepqqr-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Negative (resample)
xlabel = "Max fraction of features kept"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 11
r_   r{   r[   s        r+   keep_negative_resampler      "     //UWYdfqrrr-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zxKeep Absolute (resample)
xlabel = "Max fraction of features kept"
ylabel = "R^2"
transform = "identity"
sort_order = 12
r   )rY   r   r|   rb   rc   rd   r[   s        r+   keep_absolute_resample__r2r      1     oA{T[TcTcTlTl r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )z|Keep Absolute (resample)
xlabel = "Max fraction of features kept"
ylabel = "ROC AUC"
transform = "identity"
sort_order = 12
r   )rY   r   r|   rb   rc   rh   r[   s        r+   keep_absolute_resample__roc_aucr      s1     oA{T[TcTcTqTq r-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Positive (resample)
xlabel = "Max fraction of features removed"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 13
r   rY   r   remove_resamplerV   r[   s        r+   remove_positive_resampler      s"     111WXZegrssr-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Negative (resample)
xlabel = "Max fraction of features removed"
ylabel = "Mean model output"
transform = "identity"
sort_order = 14
r_   r   r[   s        r+   remove_negative_resampler      s"     111WY[fhsttr-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zRemove Absolute (resample)
xlabel = "Max fraction of features removed"
ylabel = "1 - R^2"
transform = "one_minus"
sort_order = 15
r   )rY   r   r   rb   rc   rd   r[   s        r+   remove_absolute_resample__r2r     s1       !aV]VeVeVnVn r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zRemove Absolute (resample)
xlabel = "Max fraction of features removed"
ylabel = "1 - ROC AUC"
transform = "one_minus"
sort_order = 15
r   )rY   r   r   rb   rc   rh   r[   s        r+   !remove_absolute_resample__roc_aucr     s1       !aV]VeVeVsVs r-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Positive (impute)
xlabel = "Max fraction of features kept"
ylabel = "Mean model output"
transform = "identity"
sort_order = 16
r   rY   r   keep_imputerV   r[   s        r+   keep_positive_imputer     ro   r-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Negative (impute)
xlabel = "Max fraction of features kept"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 17
r_   r   r[   s        r+   keep_negative_imputer   )  rr   r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zvKeep Absolute (impute)
xlabel = "Max fraction of features kept"
ylabel = "R^2"
transform = "identity"
sort_order = 18
r   )rY   r   r   rb   rc   rd   r[   s        r+   keep_absolute_impute__r2r   3  ru   r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zzKeep Absolute (impute)
xlabel = "Max fraction of features kept"
ylabel = "ROC AUC"
transform = "identity"
sort_order = 19
r   rg   r[   s        r+   keep_absolute_impute__roc_aucr   ?  rj   r-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Positive (impute)
xlabel = "Max fraction of features removed"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 7
r   rY   r   remove_imputerV   r[   s        r+   remove_positive_imputer   K  r~   r-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Negative (impute)
xlabel = "Max fraction of features removed"
ylabel = "Mean model output"
transform = "identity"
sort_order = 8
r_   r   r[   s        r+   remove_negative_imputer   U  r   r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zRemove Absolute (impute)
xlabel = "Max fraction of features removed"
ylabel = "1 - R^2"
transform = "one_minus"
sort_order = 9
r   )rY   r   r   rb   rc   rd   r[   s        r+   remove_absolute_impute__r2r   _  r   r-   c           
      n    [        [        R                  XX#SU[        R                  R
                  5      $ )zRemove Absolute (impute)
xlabel = "Max fraction of features removed"
ylabel = "1 - ROC AUC"
transform = "one_minus"
sort_order = 9
r   rw   r[   s        r+   remove_absolute_impute__roc_aucr   k  ry   r-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Positive (retrain)
xlabel = "Max fraction of features kept"
ylabel = "Mean model output"
transform = "identity"
sort_order = 6
r   rY   r   keep_retrainrV   r[   s        r+   keep_positive_retrainr   w  s"     ..oTUWbdoppr-   c           
      F    [        [        R                  XX#SU[        5      $ )zKeep Negative (retrain)
xlabel = "Max fraction of features kept"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 7
r_   r   r[   s        r+   keep_negative_retrainr     s"     ..oTVXcepqqr-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Positive (retrain)
xlabel = "Max fraction of features removed"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 11
r   rY   r   remove_retrainrV   r[   s        r+   remove_positive_retrainr     s"     00!VWYdfqrrr-   c           
      F    [        [        R                  XX#SU[        5      $ )zRemove Negative (retrain)
xlabel = "Max fraction of features removed"
ylabel = "Mean model output"
transform = "identity"
sort_order = 12
r_   r   r[   s        r+   remove_negative_retrainr     s"     00!VXZegrssr-   c           	      p   ^ ^^^ UU UU4S jn[        SUR                  S   U5      n	U	[        XU	TX5      4$ )Nc                   > T
S:X  a&  [         R                  " [        U" U5      5      5      nOT
[        U" U5      5      -  n[         R                  " [	        U5      5      U -  n	[         R
                  " U	[         R                  " US:  5      R                  S5      5      R                  [        5      n	T" XX2XHTTXg5
      $ )Nr   r   )
r   abs__strip_listoneslenminimumarraysumastypeint)fcountr"   r#   r$   r9   r:   r;   r   Anmaskattribution_signmeasurer   summary_functions             r+   r<   %__run_measure.<locals>.score_function  s    q |M&$9:;A <f0E#FFAF$v-

5"((16"2"6"6q"9:AA#FGVIY[h
 	
r-   r   r   __intlogspacer   r>   )
r   r   r   r   r   r   r\   r   r<   fcountss
   `  ` ` `  r+   rY   rY     s;    	
 	
 Aqwwqz;7GN1/>___r-   c           	      l    [        [        R                  XX#[        R                  R
                  U5      $ )zBatch Remove Absolute (retrain)
xlabel = "Fraction of features removed"
ylabel = "1 - R^2"
transform = "one_minus"
sort_order = 13
)__run_batch_abs_metricr   batch_remove_retrainrb   rc   rd   r[   s        r+   !batch_remove_absolute_retrain__r2r     s-     "%%q_7??KcKcep r-   c           	      l    [        [        R                  XX#[        R                  R
                  U5      $ )zyBatch Keep Absolute (retrain)
xlabel = "Fraction of features kept"
ylabel = "R^2"
transform = "identity"
sort_order = 13
)r   r   batch_keep_retrainrb   rc   rd   r[   s        r+   batch_keep_absolute_retrain__r2r     s-     "##Q?IaIacn r-   c           	      l    [        [        R                  XX#[        R                  R
                  U5      $ )zBatch Remove Absolute (retrain)
xlabel = "Fraction of features removed"
ylabel = "1 - ROC AUC"
transform = "one_minus"
sort_order = 13
)r   r   r   rb   rc   rh   r[   s        r+   &batch_remove_absolute_retrain__roc_aucr     s-     "%%q_7??KhKhju r-   c           	      l    [        [        R                  XX#[        R                  R
                  U5      $ )z}Batch Keep Absolute (retrain)
xlabel = "Fraction of features kept"
ylabel = "ROC AUC"
transform = "identity"
sort_order = 13
)r   r   r   rb   rc   rh   r[   s        r+   $batch_keep_absolute_retrain__roc_aucr     s-     "##Q?IfIfhs r-   c           	      l   ^ ^^ UU U4S jn[        SUR                  S   U5      nU[        XUTXt5      4$ )Nc                   > [         R                  " [        U" U5      5      5      n[         R                  " [	        U5      5      U -  R                  [        5      n[         R                  " [        U" U5      5      5      n	[         R                  " [	        U5      5      U -  R                  [        5      n
T" XXX$XyTT5
      $ r7   )r   r   r   r   r   r   r   )r   r"   r#   r$   r9   r:   r;   A_trainnkeep_trainA_test
nkeep_testlossmetricr   s              r+   r<   .__run_batch_abs_metric.<locals>.score_function  s    &&mG&<=>wws7|,v5==cB]6%:;<ggc&k*V3;;C@
kwQXbqswxxr-   r   r   r   )	r   r   r   r   r   r   r\   r<   r   s	   `  ` `   r+   r   r     s7    y Aqwwqz;7GN1/>___r-   c	           
        ^^^^^^^^^  [           [        R                  R                  5       n	[        R                  R                  S5        / n
[        R                  " [        U 5      R                  5       5      R                  5       [        R                  " [        U5      5      R                  5       -   n[        U5       GH  m[        [        U 5      XTS9u  mmmmSSR                  [        XR                  /5      -   S-   n[         R"                  R                  XS-   5      n[         R"                  R%                  U5      (       a,  ['        US5       n[         R(                  " U5      mSSS5        OEU" 5       mTR+                  TT5        ['        US	5       n[         R,                  " TU5        SSS5        S
R                  UR                  U[/        U5      [/        U5      [/        T5      U/5      mUUUUUUUUU4	S jnT[0        ;  a/  U
R3                  U" [5        [6        U5      " TT5      5      5        GM~  U
R3                  U" S5      5        GM     [        R                  R                  U	5        [        R8                  " U
5      R;                  S5      $ ! [         a    [        S5      ef = f! , (       d  f       GN= f! , (       d  f       GN= f)zTest an explanation method.zGThe 'dill' package could not be loaded and is needed for the benchmark!r
   r   model_cache__v__z.picklerbNwbr%   c                    >	^  U U4S jnTc  T
" TTTTUT	T5      $ / nT H!  nUR                  T
" UTTTTUT	T5      5        M#     [        R                  " U5      $ )Nc                 H   > T[         ;  a  T" U 5      [         T'   [         T   $ r7   )_attribution_cache)X_innerr:   attr_keys    r+   cached_attr_function;__score_method.<locals>.score.<locals>.cached_attr_function  s'    #553@3I&x0)(33r-   )r   r   r   )r:   r   scoresfr#   r"   r   r   r!   r&   r<   r9   r$   s   `   r+   score__score_method.<locals>.score  si    4 %gvwH\^cefgg AMM.GVWfVjlqst"uv !xx''r-   r   )pickle	NameErrorImportErrorr   r   r   hashlibsha256r   flatten	hexdigestr   r   joinr   __name__ospathisfileopenloadr   dumpstrr   r   r   r   r   r   )r   r   r   r   r<   r   nrepsr   	cache_dirr   r    	data_hashmodel_id
cache_filer   r   r#   r"   r   r!   r&   r9   r$   s     ` `           @@@@@@@r+   r>   r>     s(   e yy~~HIINN4 Ky|3356@@BW^^T]^_T`EaEkEkEmmI5\+;IaL!op+q(& $diiiIaIa0b&ccfooWW\\)	-AB
77>>*%%j$'1A (' $%EIIgw'j$'1E1% ( 88_55{C	NTWX]T^`cde`fhqrs	( 	(  --uWWk%B5'%RSTuT{+I L IINN888K %%a((c  ecdde" ('
 ('s#   J" J;K"J8;
K
	
K	c                     U[         L a  U [        L a  [        $ U[        L a  U [        L a  [
        $ [        q[         q[        qU qUq U " U5      q[        $ r7   )
__cache_X0
__cache_f0__cache0
__cache_X1
__cache_f1__cache1)r   r   s     r+   __check_cacher  3  sO     	J1
?	
jQ*_



Q4r-   c                     [         R                  " [         R                  " XU -
  [         R                  " SSUSS9S-
  -  S-  -   5      R	                  [
        5      5      $ )Nr   r   T)endpoint	   )r   uniqueroundlogspacer   r   )r'   endcounts      r+   r   r   D  sN    99RXXeU{r{{1aY]7^ab7b&cfg&gghoopstuur-   c                 @    [        U S5      (       a  U R                  n U $ )z$Converts DataFrames to numpy arrays.values)hasattrr  )r   s    r+   r   r   H  s    q(HHHr-   c                 :    [        U [        5      (       a  U S   $ U $ )z`This assumes that if you have a list of outputs you just want the second one (the second class).r   )
isinstancelist)attrss    r+   r   r   O  s    %Qxr-   c                    SnSn[         R                  " XE45      nUR                    [         R                  " U5      U-  nSUSS2S4'   X'SS& [	        SSS5       H  nSXhS4'   X'U'   M     X7S'   U " 5       n	U	R                  Xg5        U	$ )Ni@B r   r   r   i  )r   zerosr   r   r   r   )
r   val00val01val11NMr   r   r!   r&   s
             r+   
_fit_humanr  W  s    A	A
!AGG

UAAafaiLaI1gt$Q$! % aDE	IIaOLr-   c                    [         R                  " U 5      R                  5       S:X  d   S5       e[         R                  " S5      nU(       d@  U(       d9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OU(       d@  U(       a9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OFU(       a?  U(       a8  [         R                  " / SQ5      n[         R                  " / S	Q/5      USS S 24'   [        USS
S5      n[        [        U5      " Xp5      nU" U5      n	SWU	SS S 24   44$ )Nr   JHuman agreement metrics are only for use with the human_agreement dataset!r   r   rD   rD   rD   rD   rD   rA   rD          @rD   rD   rA   rA         @r'  rD   rA   rA   rA   r   
   humanr   r   maxr  r   r  r   r   
r   r   r   fevercoughr#   human_consensusr&   r:   methods_attrss
             r+   
_human_andr2  i      66!9==?am!mm XXhF((?3xx 12q!tu((?3xx 12q!t	5((?3xx 12q!t 1b1EG[1%;M!&)M_mAqD&9:::r-   c                     [        XUSS5      $ )a  AND (false/false)

This tests how well a feature attribution method agrees with human intuition
for an AND operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever and cough: +6 points

transform = "identity"
sort_order = 0
Fr2  r   r   r   r   s       r+   human_and_00r7         a+ueDDr-   c                     [        XUSS5      $ )a  AND (false/true)

This tests how well a feature attribution method agrees with human intuition
for an AND operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever and cough: +6 points

transform = "identity"
sort_order = 1
FTr5  r6  s       r+   human_and_01r:         a+udCCr-   c                     [        XUSS5      $ )a  AND (true/true)

This tests how well a feature attribution method agrees with human intuition
for an AND operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever and cough: +6 points

transform = "identity"
sort_order = 2
Tr5  r6  s       r+   human_and_11r=         a+tTBBr-   c                    [         R                  " U 5      R                  5       S:X  d   S5       e[         R                  " S5      nU(       d@  U(       d9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OU(       d@  U(       a9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OFU(       a?  U(       a8  [         R                  " / SQ5      n[         R                  " / S	Q/5      USS S 24'   [        USS
S5      n[        [        U5      " Xp5      nU" U5      n	SWU	SS S 24   44$ )Nr   r  r   r!  r"  rD   g       @rD   r%  r&  r(     r)  r*  r+  r-  s
             r+   	_human_orrB    r3  r-   c                     [        XUSS5      $ )a~  OR (false/false)

This tests how well a feature attribution method agrees with human intuition
for an OR operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever or cough: +6 points

transform = "identity"
sort_order = 0
FrB  r6  s       r+   human_or_00rE    s     QeUCCr-   c                     [        XUSS5      $ )a}  OR (false/true)

This tests how well a feature attribution method agrees with human intuition
for an OR operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever or cough: +6 points

transform = "identity"
sort_order = 1
FTrD  r6  s       r+   human_or_01rG    s     QeTBBr-   c                     [        XUSS5      $ )a|  OR (true/true)

This tests how well a feature attribution method agrees with human intuition
for an OR operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever or cough: +6 points

transform = "identity"
sort_order = 2
TrD  r6  s       r+   human_or_11rI    s     QdDAAr-   c                    [         R                  " U 5      R                  5       S:X  d   S5       e[         R                  " S5      nU(       d@  U(       d9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OU(       d@  U(       a9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OFU(       a?  U(       a8  [         R                  " / SQ5      n[         R                  " / S	Q/5      USS S 24'   [        USS
S5      n[        [        U5      " Xp5      nU" U5      n	SWU	SS S 24   44$ )Nr   r  r   r!  r"  r@  r%  r$  r$  rD   r(  rA     r*  r+  r-  s
             r+   
_human_xorrM        66!9==?am!mm XXhF((?3xx 12q!tu((?3xx 12q!t	5((?3xx 12q!t 1a0EG[1%;M!&)M_mAqD&9:::r-   c                     [        XUSS5      $ )a  XOR (false/false)

This tests how well a feature attribution method agrees with human intuition
for an eXclusive OR operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever or cough but not both: +6 points

transform = "identity"
sort_order = 3
FrM  r6  s       r+   human_xor_00rQ    r8  r-   c                     [        XUSS5      $ )a  XOR (false/true)

This tests how well a feature attribution method agrees with human intuition
for an eXclusive OR operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever or cough but not both: +6 points

transform = "identity"
sort_order = 4
FTrP  r6  s       r+   human_xor_01rS  %  r;  r-   c                     [        XUSS5      $ )a  XOR (true/true)

This tests how well a feature attribution method agrees with human intuition
for an eXclusive OR operation combined with linear effects. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points
if fever or cough but not both: +6 points

transform = "identity"
sort_order = 5
TrP  r6  s       r+   human_xor_11rU  6  r>  r-   c                    [         R                  " U 5      R                  5       S:X  d   S5       e[         R                  " S5      nU(       d@  U(       d9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OU(       d@  U(       a9  [         R                  " / SQ5      n[         R                  " / SQ/5      USS S 24'   OFU(       a?  U(       a8  [         R                  " / SQ5      n[         R                  " / S	Q/5      USS S 24'   [        USS
S5      n[        [        U5      " Xp5      nU" U5      n	SWU	SS S 24   44$ )Nr   r  r   r!  r"  r#  r%  rK  r(  r   rL  r*  r+  r-  s
             r+   
_human_sumrW  G  rN  r-   c                     [        XUSS5      $ )aE  SUM (false/false)

This tests how well a feature attribution method agrees with human intuition
for a SUM operation. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points

transform = "identity"
sort_order = 0
FrW  r6  s       r+   human_sum_00rZ  ^  s     a+ueDDr-   c                     [        XUSS5      $ )aD  SUM (false/true)

This tests how well a feature attribution method agrees with human intuition
for a SUM operation. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points

transform = "identity"
sort_order = 1
FTrY  r6  s       r+   human_sum_01r\  n  s     a+udCCr-   c                     [        XUSS5      $ )aC  SUM (true/true)

This tests how well a feature attribution method agrees with human intuition
for a SUM operation. This metric deals
specifically with the question of credit allocation for the following function
when all three inputs are true:
if fever: +2 points
if cough: +2 points

transform = "identity"
sort_order = 2
TrY  r6  s       r+   human_sum_11r^  ~  s     a+tTBBr-   )   )r)  r   z/tmp)Sr   r   r   numpyr   rb    r   r   r   dillr   	Exceptionsklearn.model_selectionr   sklearn.cross_validationr,   r8   rT   rV   r]   r`   re   ri   rn   rq   rt   rx   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rY   r   r   r   r   r   r   r>   r  r   r  r  r  r  r  r   r   r   r  r2  r7  r:  r=  rB  rE  rG  rI  rM  rQ  rS  rU  rW  rZ  r\  r^  rR   r-   r+   <module>rf     s    	     	:8
&DZ$)@
no		pq		rs		tu		pq		rs		qrst` 				`   ek7)v 



"v$;.E"D"C";.D"C"B";.E"D"C";.E D Cc  		
  :99:s"   D5 E 5D?>D?EE