Feature Selection Methods
This module provides various classes for feature selection analysis.
Classes
CTest: support class for handling different feature selection methods. SelectionMethod: Abstract class.
CTest
Bases: Enum
CTest Enumerator.
Source code in causalflow/selection_methods/SelectionMethod.py
19 20 21 22 23 24 |
|
SelectionMethod
Bases: ABC
SelectionMethod abstract class.
Source code in causalflow/selection_methods/SelectionMethod.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
name
property
Return Selection Method name.
Returns:
Type | Description |
---|---|
str
|
Selection Method name. |
__init__(ctest)
Class constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctest |
CTest
|
Feature Selection method's name. |
required |
Source code in causalflow/selection_methods/SelectionMethod.py
42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
compute_dependencies()
abstractmethod
Abstract method.
Source code in causalflow/selection_methods/SelectionMethod.py
86 87 88 89 |
|
initialise(data, alpha, min_lag, max_lag, graph)
Initialise the selection method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
Data. |
required |
alpha |
float
|
significance threshold. |
required |
min_lag |
int
|
min lag time. |
required |
max_lag |
int
|
max lag time. |
required |
graph |
DAG
|
initial DAG (empty). |
required |
Source code in causalflow/selection_methods/SelectionMethod.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
This module provides various classes for Correlation-based feature selection analysis.
Classes
Corr: Correlation class.
Corr
Bases: SelectionMethod
Feature selection method based on Correlation analysis.
Source code in causalflow/selection_methods/Corr.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
__init__()
Contructor class.
Source code in causalflow/selection_methods/Corr.py
15 16 17 |
|
compute_dependencies()
Compute list of dependencies for each target by correlation analysis.
Returns:
Type | Description |
---|---|
dict
|
dictonary(TARGET: list SOURCES) |
Source code in causalflow/selection_methods/Corr.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
This module provides various classes for Partial Correlation-based feature selection analysis.
Classes
ParCorr: Partial Correlation class.
ParCorr
Bases: SelectionMethod
Feature selection method based on Partial Correlation analysis.
Source code in causalflow/selection_methods/ParCorr.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
__init__()
Class contructor.
Source code in causalflow/selection_methods/ParCorr.py
16 17 18 |
|
compute_dependencies()
Compute list of dependencies for each target by partial correlation analysis.
Returns:
Type | Description |
---|---|
dict
|
dictonary(TARGET: list SOURCES). |
Source code in causalflow/selection_methods/ParCorr.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
get_residual(covar, target)
Calculate residual of the target variable obtaining conditioning on the covar variables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
covar |
np.array
|
conditioning variables. |
required |
target |
np.array
|
target variable. |
required |
Returns:
Type | Description |
---|---|
np.array
|
residual. |
Source code in causalflow/selection_methods/ParCorr.py
21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
partial_corr(X, Y, Z)
Calculate Partial correlation between X and Y conditioning on Z.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
np.array
|
source candidate variable. |
required |
Y |
np.array
|
target variable. |
required |
Z |
np.array
|
conditioning variable. |
required |
Returns:
Type | Description |
---|---|
(float, float)
|
partial correlation, p-value. |
Source code in causalflow/selection_methods/ParCorr.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
This module provides various classes for Mutual Information-based feature selection analysis.
Classes
MIestimator: support class for handling different Mutual Information estimators. MI: Mutual Information class.
MI
Bases: SelectionMethod
Feature selection method based on Mutual Information analysis.
Source code in causalflow/selection_methods/MI.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
isOpenCLinstalled: bool
property
Check whether the pyopencl pkg is installed.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if pyopencl is installed. |
__init__(estimator)
Class contructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
estimator |
MIestimator
|
Gaussian/Kraskov |
required |
Source code in causalflow/selection_methods/MI.py
29 30 31 32 33 34 35 36 37 |
|
compute_dependencies()
Compute list of dependencies for each target by mutual information analysis.
Returns:
Type | Description |
---|---|
DAG
|
dependency dag |
Source code in causalflow/selection_methods/MI.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
MIestimator
Bases: Enum
MIestimator Enumerator.
Source code in causalflow/selection_methods/MI.py
17 18 19 20 21 22 23 |
|
This module provides various classes for Transfer Entropy-based feature selection analysis.
Classes
TEestimator: support class for handling different Transfer Entropy estimators. TE: Transfer Entropy class.
TE
Bases: SelectionMethod
Feature selection method based on Trasfer Entropy analysis.
Source code in causalflow/selection_methods/TE.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
isOpenCLinstalled: bool
property
Check whether the pyopencl pkg is installed.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if pyopencl is installed. |
__init__(estimator)
Class contructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
estimator |
TEestimator
|
Gaussian/Kraskov. |
required |
Source code in causalflow/selection_methods/TE.py
33 34 35 36 37 38 39 40 41 |
|
compute_dependencies()
Compute list of dependencies for each target by transfer entropy analysis.
Returns:
Type | Description |
---|---|
DAG
|
dependency dag. |
Source code in causalflow/selection_methods/TE.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
TEestimator
Bases: Enum
TEestimator Enumerator.
Source code in causalflow/selection_methods/TE.py
21 22 23 24 25 26 27 |
|