Decision Base Module
Classes:
Name | Description |
---|---|
BaseDecision |
Abstract base class for decision-making in risk control. |
BaseDecision
BaseDecision(estimator)
Bases: ABC
Abstract base class for decision-making in risk control.
This class provides a common interface for decision-making algorithms used in risk control. It includes methods for making predictions and decisions.
How does it work?
- The decision-making algorithm is initialized with an estimator.
- The estimator is used to make predictions.
- The decision is made based on the hyper-parameters and the predictions.
How to use it?
- Initialize the decision-making algorithm with an estimator and a parameter space.
- Make predictions using the
predict
method.- First, the estimator is used to make predictions
using the
make_prediction
method. - Then, the decision is made based on the hyper-parameters and the predictions
using the
make_decision
method.
- First, the estimator is used to make predictions
using the
Parameters:
Name | Type | Description | Default |
---|---|---|---|
estimator
|
BaseEstimator
|
The estimator object used for making predictions. |
required |
Attributes:
Name | Type | Description |
---|---|---|
estimator |
BaseEstimator
|
The estimator object used for making predictions. |
Methods:
Name | Description |
---|---|
set_params |
Set the parameters of the estimator. |
get_params |
Get the parameters of the estimator. |
make_prediction |
Abstract method for predicting output values based on the input data. |
make_decision |
Abstract method for predicting decisions based on output values. |
predict |
Predict decisions based on the input data. |
fit |
Fit the estimator to the input data. |
Source code in risk_control/decision/base.py
43 44 |
|
estimator
instance-attribute
estimator = estimator
set_params
set_params(**params)
Set the parameters of the estimator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**params
|
Dict[str, Any]
|
The parameters to set on the estimator. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
self |
BaseDecision
|
Returns the instance itself. |
Source code in risk_control/decision/base.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
get_params
abstractmethod
get_params()
Get the parameters of the estimator.
Returns:
Name | Type | Description |
---|---|---|
params |
Dict[str, Any]
|
The parameters of the estimator. |
Source code in risk_control/decision/base.py
67 68 69 70 71 72 73 74 75 76 77 |
|
make_prediction
abstractmethod
make_prediction(X)
Abstract method for predicting output values based on the input data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
ndarray
|
The input data for making predictions. |
required |
Returns:
Type | Description |
---|---|
Any
|
The predicted output values based on the input data. |
Source code in risk_control/decision/base.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
make_decision
abstractmethod
make_decision(y_output)
Abstract method for predicting decisions based on output values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_output
|
Any
|
The predicted output values. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
The predicted decisions based on the output values. |
Source code in risk_control/decision/base.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
predict
predict(X)
Predict decisions based on the input data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
ndarray
|
The input data for making predictions. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
The predicted decisions based on the input data. |
Source code in risk_control/decision/base.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
fit
fit(X, y)
Fit the estimator to the input data.
This method is a placeholder and does not perform any fitting. It is intended to be overridden by subclasses that require fitting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
ndarray
|
The input data for fitting the estimator. |
required |
y
|
ndarray
|
The target values for fitting the estimator. |
required |
Returns:
Name | Type | Description |
---|---|---|
self |
BaseDecision
|
Returns the instance itself. |
Source code in risk_control/decision/base.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|