Executes request, records parameters, and return random values More specifically this triggers the `_generate_single()` subroutine, records the appropriate keywords in the `_supplied_values` member, and returns a pandas Series of random values. Parameters
(self, target, count, **kwargs)
| 107 | raise FairException('"{}" is missing "{}".'.format(str(target_function), required_keyword)) |
| 108 | |
| 109 | def generate(self, target, count, **kwargs): |
| 110 | """Executes request, records parameters, and return random values |
| 111 | |
| 112 | More specifically this triggers the `_generate_single()` |
| 113 | subroutine, records the appropriate keywords in the |
| 114 | `_supplied_values` member, and returns a pandas Series of random |
| 115 | values. |
| 116 | |
| 117 | Parameters |
| 118 | ---------- |
| 119 | target : str |
| 120 | The node for which the data is being generated (e.g. "Loss |
| 121 | Event Frequency"). |
| 122 | count : int |
| 123 | The number of random numbers generated (or alternatively, the |
| 124 | length of the Series returned). |
| 125 | **kwargs |
| 126 | Keyword arguments with one of the following values: {`mean`, |
| 127 | `stdev`, `low`, `mode`, `high`, `gamma`, or `constant`}. |
| 128 | |
| 129 | Raises |
| 130 | ------ |
| 131 | pyfair.utility.fair_exception.FairException |
| 132 | Raised if subroutine errors bubble up for reasons such as: 1) |
| 133 | parameters are missing/incompatible, 2) parameters do not fall |
| 134 | within proscribed value ranges, or 3) numbers supplied cannot |
| 135 | be used to create meaningful distributions. |
| 136 | |
| 137 | Returns |
| 138 | ------- |
| 139 | pd.Series |
| 140 | A series of length `count` composed of random values. These |
| 141 | values are consistent with a particular distribution type |
| 142 | (Normal, BetaPert, or constant). |
| 143 | |
| 144 | """ |
| 145 | # Generate result |
| 146 | result = self._generate_single(target, count, **kwargs) |
| 147 | # Explicitly insert optional keywords for model storage |
| 148 | dict_keys = kwargs.keys() |
| 149 | if 'low' in dict_keys and 'gamma' not in dict_keys: |
| 150 | kwargs['gamma'] = 4 |
| 151 | # Record and return |
| 152 | self._supplied_values[target] = {**kwargs} |
| 153 | return result |
| 154 | |
| 155 | def _generate_single(self, target, count, **kwargs): |
| 156 | """Internal workhorse function for single request |