MCPcopy Create free account
hub / github.com/Derive-Risk/pyfair / generate_multi

Method generate_multi

pyfair/model/model_input.py:181–265  ·  view source on GitHub ↗

Generates aggregate risk data for multiple targets .. deprecated:: 0.1-alpha.1 `generate_multi()` will be removed in future versions because it was a terrible idea to begin with. This function essentially creates a small simulation for each key in the

(self, prefixed_target, count, kwargs_dict)

Source from the content-addressed store, hash-verified

179 return results
180
181 def generate_multi(self, prefixed_target, count, kwargs_dict):
182 """Generates aggregate risk data for multiple targets
183
184 .. deprecated:: 0.1-alpha.1
185 `generate_multi()` will be removed in future versions because
186 it was a terrible idea to begin with.
187
188 This function essentially creates a small simulation for each key
189 in the dictionary. For example, with the following data:
190
191 .. code:: python
192
193 {
194 'Reputational': {
195 'Secondary Loss Event Frequency': {'constant': 4000},
196 'Secondary Loss Event Magnitude': {
197 'low': 10, 'mode': 20, 'high': 100
198 },
199 },
200 'Legal': {
201 'Secondary Loss Event Frequency': {'constant': 2000},
202 'Secondary Loss Event Magnitude': {
203 'low': 10, 'mode': 20, 'high': 100
204 },
205 }
206 }
207
208 Two separate simulations for "Reputational" and "Legal" will be run
209 using the information supplied. Each of these simulations will be
210 composed of random values with distributions based on the
211 parameters supplied. Those simulations are then calculated
212 independently, and then summed to yield aggregate risk.
213
214 .. warning:: unlike other functions, this does not take **kwargs--
215 rather it takes a dictionary
216
217 Parameters
218 ----------
219 prefixed_target : str
220 The node for which the data is being generated (e.g. "Loss
221 Event Frequency").
222 count : int
223 The number of random numbers generated (or alternatively, the
224 length of the Series returned).
225 kwargs_dict : dict
226 This is an actual dictionary (and not an expanded **kwargs)
227 keyword list.
228
229 Raises
230 ------
231 pyfair.utility.fair_exception.FairException
232 Raised if subroutine errors bubble up for reasons such as: 1)
233 parameters are missing/incompatible, 2) parameters do not fall
234 within proscribed value ranges, or 3) numbers supplied cannot
235 be used to create meaningful distributions.
236
237 Returns
238 -------

Callers 2

input_multi_dataMethod · 0.80

Calls 1

_generate_singleMethod · 0.95

Tested by 1