Search in sources :

Example 1 with IgniteDoubleConsumer

use of org.apache.ignite.ml.math.functions.IgniteDoubleConsumer in project ignite by apache.

the class AbstractCrossValidation method injectAndGetParametersFromPipeline.

/**
 * Forms the parameter map from parameter grid and parameter set.
 *
 * @param paramGrid Parameter grid.
 * @param paramSet  Parameter set.
 */
@NotNull
private Map<String, Double> injectAndGetParametersFromPipeline(ParamGrid paramGrid, Double[] paramSet) {
    Map<String, Double> paramMap = new HashMap<>();
    for (int paramIdx = 0; paramIdx < paramSet.length; paramIdx++) {
        IgniteDoubleConsumer setter = paramGrid.getSetterByIndex(paramIdx);
        Double paramVal = paramSet[paramIdx];
        setter.accept(paramVal);
        paramMap.put(paramGrid.getParamNameByIndex(paramIdx), paramVal);
    }
    return paramMap;
}
Also used : HashMap(java.util.HashMap) IgniteDoubleConsumer(org.apache.ignite.ml.math.functions.IgniteDoubleConsumer) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

HashMap (java.util.HashMap)1 IgniteDoubleConsumer (org.apache.ignite.ml.math.functions.IgniteDoubleConsumer)1 NotNull (org.jetbrains.annotations.NotNull)1