11"""
2- Local Explanations of Global Rankings: Insights for Competitive Rankings
3-
4- Hierarchical Ranking Explanation (HRE) framework.
5-
62Anahideh, H., & Mohabbati-Kalejahi, N. (2022). Local explanations of global
73rankings: insights for competitive rankings. IEEE Access, 10, 30676-30693.
84
@@ -24,7 +20,28 @@ def hierarchical_ranking_explanation(
2420 X , score_function , model_type = "OLS" , s = 5 , * args , ** kwargs
2521):
2622 """
27- `model_type` can be one of "DT", "LR", "OLS", "PLS".
23+ Parameters
24+ ----------
25+ X : pandas.DataFrame
26+ The input data for which explanations are to be generated.
27+ score_function : callable
28+ A function that takes the input data X and returns scores.
29+ model_type : str, optional
30+ The type of model to use for feature importance calculation.
31+ Can be one of "DT" (Decision Tree), "LR" (Logistic Regression),
32+ "OLS" (Ordinary Least Squares), or "PLS" (Partial Least Squares).
33+ Default is "OLS".
34+ s : int, optional
35+ A parameter for the feature importance function. Default is 5.
36+ *args : tuple
37+ Additional arguments to pass to the feature importance function.
38+ **kwargs : dict
39+ Additional keyword arguments to pass to the feature importance function.
40+
41+ Returns
42+ -------
43+ numpy.ndarray
44+ An array of contributions for each observation in the input data.
2845 """
2946 # index = X.index
3047 X = X .copy ().reset_index (drop = True )
@@ -52,7 +69,30 @@ def hierarchical_ranking_batch_explanation(
5269 ** kwargs ,
5370):
5471 """
55- `model_type` can be one of "DT", "LR", "OLS", "PLS".
72+ Parameters
73+ ----------
74+ X : pandas.DataFrame
75+ The input data for which explanations are to be generated.
76+ score_function : callable
77+ A function that takes the input data X and returns scores.
78+ model_type : str, optional
79+ The type of model to use for feature importance calculation.
80+ Can be one of "DT" (Decision Tree), "LR" (Logistic Regression),
81+ "OLS" (Ordinary Least Squares), or "PLS" (Partial Least Squares).
82+ Default is "OLS".
83+ s : int, optional
84+ A parameter for the feature importance function. Default is 5.
85+ random_state : int, optional
86+ The seed used by the random number generator. Default is 42.
87+ *args : tuple
88+ Additional arguments to pass to the feature importance function.
89+ **kwargs : dict
90+ Additional keyword arguments to pass to the feature importance function.
91+
92+ Returns
93+ -------
94+ numpy.ndarray
95+ An array of contributions for each observation in the input data.
5696 """
5797 batch_size = (
5898 np .ceil (0.1 * len (X )).astype (int )
0 commit comments