cost_function
- class nrv.optim.cost_function(static_context=None, context_modifier=None, cost_evaluation=None, simulation=None, kwargs_CM={'t_sim': 5}, kwargs_S={'t_sim': 0}, kwargs_CE={'t_sim': 5}, filter=None, saver=None, file_name='cost_saver.csv', **kawrgs)[source]
A class to define cost from position input vector
- Parameters:
static_context (str | dict) – saving dictionary or saving file name of a nrv_simulable object which should be use as static context of the optimisation
context_modifier (funct) –
- function creating a context from a particle position, parameters:
>>> context_modifier(X: np.ndarray, static_context: NRV_simulable, **kwargs) -> NRV_simulable:
- returns
context : values of a context (array)
cost_evaluation (funct) –
- function calculating a cost from a axon simulation results, parameters:
>>> cost_evaluation(results: sim_results, **kwargs) -> float:
simulation (funct) – optional
kwargs_CM (dict) – key word arguments of context_modifier function, by default {}
kwargs_S (dict) – key word arguments of simulate_context function, by default {}
kwargs_CE (dict) – key word arguments of cost_evaluation function, by default {}
t_sim (float) – time of the simulation on wich the cost will be calculated in ms (ms), by default 100ms
dt (float) – simulation time stem for neuron (ms), by default 1us
filter (funct or None) – function wich return a filtered postition from a position, if None, position is unfiltered, by default None
saver (funct or None) – function added at the end after calculating the cost for personalized savings, if None, nothing will be saved, by default None
Attributes
Whether the underlying context is suitable for multiprocessing at the cost-function level. |
Methods
|
Initialize a callable cost-function wrapper around context generation and simulation. |
Generic method returning all the atributes of an NRV_class instance |
|
Simulated the static context modified with the tuning paramters X |
|
|
Generic loading method for |
|
Generic saving method for |
set the cost context modifier after the instantiation |
|
set the cost evalutation function after the instantiation |
|
|
Generic method to set any attribute of |
set the cost static_context after the instantiation |
|
Run the simulation associated with the current local context. |