util
def findwhere(itr, func, *, default=-1)
#
  Find the index of the next occurence where func is True.
| PARAMETER | DESCRIPTION | 
|---|---|
| itr | The iterable to search over 
                
                  TYPE:
                     | 
| func | The function to use | 
| default | The default value to give if no value was found where func was True 
                
                  TYPE:
                     | 
| RETURNS | DESCRIPTION | 
|---|---|
| int | The first index where func was True | 
Source code in src/mfpbench/util.py
        
def remove_hyperparameter(name, space)
#
  A new configuration space with the hyperparameter removed.
Essentially copies hp over and fails if there is conditionals or forbiddens
Warning
This will not work with conditional search spaces and will raise an error
| PARAMETER | DESCRIPTION | 
|---|---|
| name | The name of the hyperparameter to remove 
                
                  TYPE:
                     | 
| space | The configuration space to remove the hyperparameter from 
                
                  TYPE:
                     | 
| RETURNS | DESCRIPTION | 
|---|---|
| ConfigurationSpace | The space with the hyperparameter removed | 
Source code in src/mfpbench/util.py
        
def pairs(itr)
#
  An iterator over pairs of items in the iterator.
| PARAMETER | DESCRIPTION | 
|---|---|
| itr | An itr of items 
                
                  TYPE:
                     | 
| RETURNS | DESCRIPTION | 
|---|---|
| Iterator[tuple[T, T]] | An itr of sequential pairs of the items | 
Source code in src/mfpbench/util.py
        
def intersection(*items)
#
  Does an intersection over all collection of items.
ans = intersection(["a", "b", "c"], "ab", ("b", "c"))
items = [(1, 2, 3), (2, 3), (4, 5)]
ans = intesection(*items)
| PARAMETER | DESCRIPTION | 
|---|---|
| *items | Iterable things 
                
                  TYPE:
                     | 
| RETURNS | DESCRIPTION | 
|---|---|
| set[T] | The intersection of all items | 
Source code in src/mfpbench/util.py
        
def invert(d)
#
  
def rename(d, keys)
#
  Rename keys of a dictionary based on a set of keys to update.
def perturb(value, hp, std, seed=None)
#
  Perturb a value based on a hyperparameter.
| PARAMETER | DESCRIPTION | 
|---|---|
| value | The value to perturb 
                
                  TYPE:
                     | 
| hp | The hyperparameter it comes from 
                
                  TYPE:
                     | 
| std | The standard deviation of the noise to add 
                
                  TYPE:
                     | 
| seed | The seed to use for the perturbation 
                
                  TYPE:
                     | 
| RETURNS | DESCRIPTION | 
|---|---|
| ValueT | The perturbed value | 
Source code in src/mfpbench/util.py
        | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |  |