optimizedParameter

optimizedParameter ( string parameterIdentifier , number _minimum , number _maximum , number _initial , number _initialStep , string _idOptimSystem , number _forceOptimizedValue ) : float

Returns and/or sets an optimized parameter. It must be a decimal number. Optimized parameters are essential in artificial intelligence when you create an expert system, assigning scores to data for example.
They correspond to the coordinates of an extremum of a cost function.

This function works with optimizeConfiguredParameters. You start by defining for example a bounded domain, an initial point and an initial step to the parameter. Initially only the initial value is used.
Then when optimizeConfiguredParameters is called the parameter will be manipulated according to your configuration in order to minimize (or maximize) the cost function.

You will then retrieve the parameter in your script with its optimized value.

For the configuration, note that it is mandatory to set a minimum and a maximum and strongly advised to set an initial value. The setting of the step is also a plus which helps the optimization algorithm.

If you do not put these arguments, the value of the parameter is simply returned by the function without modifying its configuration.
If you call this function without having configured it with an initial value, the first call will return a null value.

To use optimizeConfiguredParameters, all optimizedParameter functions must be called once to initialize the system (we must know in advance the total number of parameters to optimize). So don't hesitate to create a separate script that simply calls all these functions once. This avoids that at the first iteration some optimizedParameters are not called because they are for example in if blocks which are not executed.

See also

optimizeConfiguredParameters

Parameters

parameterIdentifier

Give a name to your optimized variable

_minimum (optional)

The minimum bound of the parameter, the optimization algorithm will not be able to test values outside the bounds. Mandatory to use this parameter with optimizedParameter.

_maximum (optional)

The maximum bound of the parameter, the optimization algorithm will not be able to test values outside the bounds. Mandatory to use this parameter with optimizedParameter.

_initial (optional)

The initial value of the parameter.
It is used when no more relevant value can be returned and to initiate the optimization algorithm.
Think of playing with this value during the optimization to avoid being sucked in by local extremums (a classic problem in optimization).

_initialStep (optional)

The optimization algorithm is supposed to use the initial value at the beginning and then move away from it. To try other values. But how far away will it go? This argument is used to indicate whether the initial step will be strong or weak.

_idOptimSystem (optional)

You can give an ID to your optimized parameter set. If you don't specify anything, the unique id of the script will be used. This parameter is especially useful if you mix several optimizers in one script or if you copy and paste them.

_forceOptimizedValue (optional)

Allows you to manually instantiate an optimized value to the parameter, as if the optimizer had calculated it
if(equals(optimizedParameter("my_factor"), 0)) optimizedParameter("my_factor", null, null, null, null, null, 0.01)