Оценщики¶
Этот модуль содержит оценщики. По сути, это обертка над сетями bamt
с дополнительными ограничениями.
Пожалуйста, используйте этот модуль, только если вы являетесь разработчиком, так как он низкоуровневый. В противном случае используйте предназначенные для этого интерфейсы
(например, конвейеры, объяснители и т.д.).
Подробнее читайте в Руководстве пользователя.
BNEstimator
¶
Bases: BaseEstimator
A Bayesian Network Estimator class that extends scikit-learn's BaseEstimator.
Source code in applybn/core/estimators/base_estimator.py
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 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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
__getattr__(attr)
¶
If attribute is not found in the pipeline, look in the last step of the pipeline.
Source code in applybn/core/estimators/base_estimator.py
__init__(has_logit=False, use_mixture=False, partial=False, bn_type=None, learning_params=None)
¶
Initializes the BNEstimator with the given parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
has_logit
|
bool
|
Indicates if logit transformation is used. |
False
|
use_mixture
|
bool
|
Indicates if mixture model is used. |
False
|
partial
|
False | Literal['parameters', 'structure']
|
Indicates if partial fitting is used. |
False
|
bn_type
|
Literal['hybrid', 'disc', 'cont'] | None
|
Type of Bayesian Network. |
None
|
learning_params
|
Unpack[ParamDict] | None
|
Parameters for learning. |
None
|
Source code in applybn/core/estimators/base_estimator.py
detect_bn(data)
staticmethod
¶
Detects the type of Bayesian Network based on the data. Bamt typing is used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
DataFrame
|
The input data to analyze. |
required |
Returns:
Name | Type | Description |
---|---|---|
bn_type |
Literal['hybrid', 'disc', 'cont']
|
The detected type of Bayesian Network. |
Raises:
Type | Description |
---|---|
None
|
an error translates into bamt logger. Possible errors: "Unsupported data type. Dtype: {dtypes}" |
Source code in applybn/core/estimators/base_estimator.py
fit(X, y=None)
¶
Fits the Bayesian Network to the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
tuple
|
a tuple with (X, descriptor, clean_data). If partial is "structure", clean_data can be None (not used). |
required |
y
|
None
|
not used. |
None
|
Returns:
Name | Type | Description |
---|---|---|
self |
BNEstimator
|
The fitted estimator. |
Source code in applybn/core/estimators/base_estimator.py
init_bn(bn_type)
¶
Initializes the Bayesian Network based on the type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bn_type
|
Literal['hybrid', 'disc', 'cont']
|
The type of Bayesian Network to initialize. |
required |
Returns:
Type | Description |
---|---|
HybridBN | DiscreteBN | ContinuousBN
|
An instance of the corresponding Bayesian Network class. |
Raises:
Type | Description |
---|---|
TypeError
|
Invalid bn_type. |