https://github.com/nas5w/grid-search
A small, simple node module that can be used to generate an array of parameters to use during a machine learning grid search
https://github.com/nas5w/grid-search
grid-search javascript machine-learning node-module
Last synced: 4 months ago
JSON representation
A small, simple node module that can be used to generate an array of parameters to use during a machine learning grid search
- Host: GitHub
- URL: https://github.com/nas5w/grid-search
- Owner: nas5w
- Created: 2019-02-18T03:32:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-18T20:20:11.000Z (over 6 years ago)
- Last Synced: 2025-03-22T12:48:54.040Z (7 months ago)
- Topics: grid-search, javascript, machine-learning, node-module
- Language: JavaScript
- Homepage:
- Size: 61.5 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![]()
![]()
[](https://travis-ci.org/nas5w/grid-search) [](https://codecov.io/gh/nas5w/grid-search/branch/master)
`grid-search` is a small, simple node module that can be used to generate an array of parameters to use during a machine learning grid search. It will generate every possible combination of parameters based on user input.
This package additionally ships with a small `range` method that can be used to generate a range of values between two numbers.
# Installation
Install `grid-search` using npm.
```bash
npm i grid-search
```# Example Use
## Basic grid search parameter generation
```javascript
const { gridSearch } = require("grid-search");const params = {
iterations: [10, 20, 30],
objective: "binaryCrossentropy",
dropout: [0.4, 0.5, 0.6]
};const search = gridSearch(params);
console.log(search);
```Your output will be:
```javascript
[
{ iterations: 10, objective: "binaryCrossentropy", dropout: 0.4 },
{ iterations: 10, objective: "binaryCrossentropy", dropout: 0.5 },
{ iterations: 10, objective: "binaryCrossentropy", dropout: 0.6 },
{ iterations: 20, objective: "binaryCrossentropy", dropout: 0.4 },
{ iterations: 20, objective: "binaryCrossentropy", dropout: 0.5 },
{ iterations: 20, objective: "binaryCrossentropy", dropout: 0.6 },
{ iterations: 30, objective: "binaryCrossentropy", dropout: 0.4 },
{ iterations: 30, objective: "binaryCrossentropy", dropout: 0.5 },
{ iterations: 30, objective: "binaryCrossentropy", dropout: 0.6 }
];
```## Using range
The previous example can use the `range` function to specify the `iterations` and `dropout` parameters and achieve the exact same result.
`range(start, finish, step)`
```javascript
const { range } = require("grid-search");const params = {
iterations: range(10, 30, 10),
objective: "binaryCrossentropy",
dropout: range(0.4, 0.6, 0.1)
};
```# Contributing
Contributions welcome! Please open an issue in the [Github repository](https://github.com/nas5w/grid-search) describing what changes you would like to see (or to contribute yourself).