Base functions
Class Get
The Get class contains functions that fetch immediate return values without requiring
computational processing.
It serves to retrieve parameters and other immediate data, leveraging the
Parameters class for default settings and bounds in specific contexts.
Source code in wgrp/base_functions.py
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 | |
get_optimum(mle_objs, df)
staticmethod
Return the best model found based on the minimum BIC score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mle_objs |
list or dict
|
List or dictionary of maximum likelihood estimation objects. |
required |
df |
DataFrame
|
DataFrame containing the BIC scores and formalism information. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
object |
dict
|
The maximum likelihood estimation object corresponding to the model with the lowest BIC score. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> mle_objs = [('model1'), ('model2'), ('model3')]
>>> data = {'BIC': [100.5, 95.3, 110.2], 'Formalism': ['formalism1', 'formalism2', 'formalism3']}
>>> df = pd.DataFrame(data)
>>> best_model = Get().get_optimum(mle_objs, df)
>>> best_model
'model2'
Source code in wgrp/base_functions.py
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 | |
get_parameters(nSamples=0, nInterventions=None, a=None, b=None, q=0.5, propagations=None, reliabilities=None, previousVirtualAge=0, interventionsTypes=None, formalism='RP', cumulativeFailureCount=None, timesPredictFailures=None, nIntervetionsReal=None)
Function get_parameters
The get_parameters method encapsulates methods for retrieving parameters related to
the work group model (wgrp).
It utilizes an instance of the Parameters class to access default settings and
bounds for function minimization
in the search for optimal parameters for the wgrp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nSamples |
int
|
Number of samples to be simulated in the inference process. |
0
|
nInterventions |
int
|
Number of interventions.praf: parei |
None
|
a |
float
|
Parameter a. |
None
|
b |
float
|
Parameter b. |
None
|
q |
float
|
Parameter q. |
0.5
|
propagations |
list
|
List of propagations. |
None
|
reliabilities |
list
|
List of reliabilities. |
None
|
previousVirtualAge |
int
|
Previous virtual age. |
0
|
interventionsTypes |
list
|
List of intervention types. |
None
|
formalism |
str
|
Formalism type. |
'RP'
|
cumulativeFailureCount |
int
|
Cumulative failure count. |
None
|
timesPredictFailures |
list
|
Times to predict failures. |
None
|
nIntervetionsReal |
int
|
Number of real interventions. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing the parameters and their values. |
Examples:
>>> params = Get().get_parameters(nSamples=10, a=0.1, b=0.2, q=0.6, formalism='RP')
>>> params['nSamples']
10
>>> params['a']
0.1
>>> params['b']
0.2
>>> params['q']
0.6
>>> params['formalism']
'RP'
>>> params['bBounds']
{'min': 1e-100, 'max': 5}
>>> params['qBounds']
{'min': 0, 'max': 1}
Source code in wgrp/base_functions.py
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 | |