ml-param-grid
v1.0.0
Published
Generate a list of possible paramaters combinations. Useful for example for hyper-paramater grid search.
Downloads
528
Readme
param-grid
Generate a list of possible paramaters combinations. Useful for example for hyper-paramater grid search..
Installation
$ npm install --save ml-param-grid
Usage
import paramGrid from 'ml-param-grid';
// paramGrid is a generator function so it returns an iterator
for(let param of paramGrid({
param1: ['x', 'y'],
param2: [4, 2],
param3: true
}) {
console.log(param);
};
// result is
// {param1 : 'x', param2: 4, param3: true}
// {param1 : 'x', param2: 2, param3: true}
// {param1 : 'y', param2: 4, param3: true}
// {param1 : 'y', param2: 2, param3: true}
// Get the result directly as an array
Array.from(paramGrid({
p: [1, 2]
})); // [{p: 1}, {p: 2}]