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

Method input_multi_data

pyfair/model/model.py:284–328  ·  view source on GitHub ↗

Input data for multiple items that roll up into an aggregate As of now, this is only used for Secondary Loss when calculating mutliple secondary loss line items (e.g. 'Reputation' has a probability of A and a loss of B; 'Morale' has a probability of C and a loss of D

(self, target, kwargs_dict)

Source from the content-addressed store, hash-verified

282 return self
283
284 def input_multi_data(self, target, kwargs_dict):
285 """Input data for multiple items that roll up into an aggregate
286
287 As of now, this is only used for Secondary Loss when calculating
288 mutliple secondary loss line items (e.g. 'Reputation' has a
289 probability of A and a loss of B; 'Morale' has a probability
290 of C and a loss of D, etc.).
291
292 Parameters
293 ----------
294 target : str
295 The name of the node for which the arguments are directed
296 kwargs_dict : dict
297 The arguments used to generate a distribution for the node
298
299 Returns
300 -------
301 pyfair.model.FairModel
302 A reference to this object of type FairModel
303
304 Examples
305 --------
306 >>> model = pyfair.FairModel(name="Insider Threat")
307 >>> model1.input_multi_data('Secondary Loss', {
308 ... 'Reputational': {
309 ... 'Secondary Loss Event Frequency': {'constant': 4000},
310 ... 'Secondary Loss Event Magnitude': {'low': 10, 'mode': 20, 'high': 100},
311 ... },
312 ... 'Legal': {
313 ... 'Secondary Loss Event Frequency': {'constant': 2000},
314 ... 'Secondary Loss Event Magnitude': {'low': 10, 'mode': 20, 'high': 100},
315 ... }
316 ... })
317
318 """
319 # Generate our data
320 data = self._data_input.generate_multi(target, self._n_simulations, kwargs_dict)
321 # Multitargets are prefixed with 'multi_'
322 mod_target = target.lstrip('multi_')
323 # Supplied then calculated is a nasty workaround to propegate down then change.
324 self._tree.update_status(mod_target, 'Supplied')
325 self._tree.update_status(mod_target, 'Calculated')
326 # Update model table with data
327 self._model_table[mod_target] = data
328 return self
329
330 def bulk_import_data(self, param_dictionary):
331 """Takes multiple inputs via nested dictionaries.

Callers 3

test_inputsMethod · 0.95
read_jsonMethod · 0.95
_add_argumentsMethod · 0.80

Calls 2

generate_multiMethod · 0.80
update_statusMethod · 0.80

Tested by 1

test_inputsMethod · 0.76