file
get_experiment_filename(PREFIX)
¶
Returns the name of the experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
PREFIX |
str
|
Prefix of the experiment. |
required |
Returns:
Name | Type | Description |
---|---|---|
filename |
str
|
Name of the experiment. |
Examples:
>>> from spotPython.utils.file import get_experiment_name
>>> from spotPython.utils.init import fun_control_init
>>> fun_control = fun_control_init(PREFIX="branin")
>>> PREFIX = fun_control["PREFIX"]
>>> filename = get_experiment_filename(PREFIX)
Source code in spotPython/utils/file.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
load_cifar10_data(data_dir='./data')
¶
Loads the CIFAR10 dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_dir |
str
|
Directory to save the data. Defaults to “./data”. |
'./data'
|
Returns:
Name | Type | Description |
---|---|---|
trainset |
CIFAR10
|
Training dataset. |
Examples:
>>> from spotPython.utils.file import load_cifar10_data
>>> trainset = load_cifar10_data(data_dir="./data")
Source code in spotPython/utils/file.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
load_core_model_from_file(coremodel, dirname='userModel')
¶
Loads a core model from a python file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coremodel |
str
|
Name of the core model. |
required |
dirname |
str
|
Directory name. Defaults to “userModel”. |
'userModel'
|
Returns:
Name | Type | Description |
---|---|---|
coremodel |
object
|
Core model. |
Source code in spotPython/utils/file.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
load_dict_from_file(coremodel, dirname='userModel')
¶
Loads a dictionary from a json file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coremodel |
str
|
Name of the core model. |
required |
dirname |
str
|
Directory name. Defaults to “userModel”. |
'userModel'
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary with the core model. |
Source code in spotPython/utils/file.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
load_experiment(PKL_NAME)
¶
Loads the experiment from a pickle file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
PKL_NAME |
str
|
Name of the pickle file. |
required |
Returns:
Name | Type | Description |
---|---|---|
spot_tuner |
object
|
The spot tuner object. |
fun_control |
dict
|
The function control dictionary. |
design_control |
dict
|
The design control dictionary. |
surrogate_control |
dict
|
The surrogate control dictionary. |
optimizer_control |
dict
|
The optimizer control dictionary. |
Notes
The corresponding save_experiment function is part of the class spot.
Source code in spotPython/utils/file.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
load_pickle(filename)
¶
Loads a pickle file. Add .pkl to the filename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
Name of the pickle file. |
required |
Returns:
Type | Description |
---|---|
object
|
Loaded object. |
Examples:
>>> from spotPython.utils.file import load_pickle
>>> obj = load_pickle(filename="obj.pkl")
Source code in spotPython/utils/file.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
save_pickle(obj, filename)
¶
Saves an object as a pickle file. Add .pkl to the filename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj |
object
|
Object to be saved. |
required |
filename |
str
|
Name of the pickle file. |
required |
Examples:
>>> from spotPython.utils.file import save_pickle
>>> save_pickle(obj, filename="obj.pkl")
Source code in spotPython/utils/file.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|