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

Method bulk_import_data

pyfair/model/model.py:330–361  ·  view source on GitHub ↗

Takes multiple inputs via nested dictionaries. The function iterates through a dictionary and runs input_data() for each item. This allows for multiple items to be added at a single time. The param dictionary will take the form: {'target_1': {param_1: value_1}, 'ta

(self, param_dictionary)

Source from the content-addressed store, hash-verified

328 return self
329
330 def bulk_import_data(self, param_dictionary):
331 """Takes multiple inputs via nested dictionaries.
332
333 The function iterates through a dictionary and runs input_data()
334 for each item. This allows for multiple items to be added at a
335 single time. The param dictionary will take the form:
336
337 {'target_1': {param_1: value_1}, 'target_2': {param_2: value_2}}
338
339 Parameters
340 ----------
341 param_dictionary : dict
342 A nested dictionary of parameters.
343
344 Returns
345 -------
346 pyfair.model.FairModel
347 A reference to this object of type FairModel
348
349 Examples
350 --------
351 >>> model = pyfair.FairModel(name="Insider Threat")
352 >>> model.bulk_import_data({
353 ... 'Loss Event Frequency': {'mean': 90, 'stdev': 100},
354 ... 'Loss Magnitude': {'constant': 4000},
355 ... })
356
357 """
358 # Iterate through each key, value pair and run through input_data()
359 for target, parameters in param_dictionary.items():
360 self.input_data(target, **parameters)
361 return self
362
363 def input_raw_data(self, target, array):
364 """Supply a raw array to the model

Callers 3

test_inputsMethod · 0.95
test_exportsMethod · 0.95

Calls 1

input_dataMethod · 0.95

Tested by 3

test_inputsMethod · 0.76
test_exportsMethod · 0.76