1.0.0 • Published 6 years ago

ml-param-grid v1.0.0

Weekly downloads
160
License
MIT
Repository
github
Last release
6 years ago

param-grid

NPM version build status Test coverage npm download

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}]

License

MIT