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

Method input_data

pyfair/model/model.py:247–282  ·  view source on GitHub ↗

Input data for a single node This takes input, feeds it to self._data_input.generate(), and updates the dependencies via self._tree.update_status(). The kwargs can be for normal (keywords `mean` and `stdev`), BetaPert (keywords `low`, `mode`, `high`, and `gamma`), ,

(self, target, **kwargs)

Source from the content-addressed store, hash-verified

245 ##########################################################################
246
247 def input_data(self, target, **kwargs):
248 """Input data for a single node
249
250 This takes input, feeds it to self._data_input.generate(), and
251 updates the dependencies via self._tree.update_status(). The kwargs
252 can be for normal (keywords `mean` and `stdev`), BetaPert (keywords
253 `low`, `mode`, `high`, and `gamma`), , or a constant (keywords
254 `constant`).
255
256 Parameters
257 ----------
258 target : str
259 The name of the node for which the arguments are directed
260 kwargs : float
261 The arguments used to generate a distribution for the node
262
263 Returns
264 -------
265 pyfair.model.FairModel
266 A reference to this object of type FairModel
267
268 Examples
269 --------
270 >>> model = pyfair.model.FairModel(name='Data Loss')
271 >>> model.input_data('Loss Magnitude', mean=20, stdev=10)
272
273 """
274 # Standardize inputs to account for abbreviations
275 target = self._standardize_target(target)
276 # Generate data via data captive class
277 data = self._data_input.generate(target, self._n_simulations, **kwargs)
278 # Update dependency tracker captive class
279 self._tree.update_status(target, 'Supplied')
280 # Update the model table with the generated data
281 self._model_table[target] = data
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

Callers 13

test_inspectionMethod · 0.95
test_inputsMethod · 0.95
test_calculationMethod · 0.95
test_generate_imageMethod · 0.95
read_jsonMethod · 0.95
bulk_import_dataMethod · 0.95
vignette.pyFile · 0.80
setUpMethod · 0.80
setUpMethod · 0.80
setUpMethod · 0.80

Calls 3

_standardize_targetMethod · 0.95
generateMethod · 0.80
update_statusMethod · 0.80

Tested by 9

test_inspectionMethod · 0.76
test_inputsMethod · 0.76
test_calculationMethod · 0.76
test_generate_imageMethod · 0.76
setUpMethod · 0.64
setUpMethod · 0.64
setUpMethod · 0.64