function generateModels(min, max, step, numWeights) {
    const values = generateNumbers(min, max, step);

    // https://stackoverflow.com/questions/12303989/cartesian-product-of-multiple-arrays-in-javascript
    // seriously this is machine learning, whoever would have thought _MATH_ would be involved???
    const f = (a, b) => [].concat(...a.map(d => b.map(e => [].concat(d, e))));
    const cartesian = (a, b, ...c) => (b ? cartesian(f(a, b), ...c) : a);
    
    const perms = [];
    for (let i = 0; i < numWeights; i++) {
        perms.push(values);
    }
    return cartesian(...perms);
}
/**
 * basically just generates numbers for all of the number of weights you need.
 * this can be pretty heavy with 4 weights.
 */
basically just generates numbers for all of the number of weights you need.
this can be pretty heavy with 4 weights.
basically just generates numbers for all of the number of weights you need . this can be pretty heavy with 4 weights .
function generateModels(min, max, step, numWeights) {
    const values = generateNumbers(min, max, step);
    const f = (a, b) => [].concat(...a.map(d => b.map(e => [].concat(d, e))));
    const cartesian = (a, b, ...c) => (b ? cartesian(f(a, b), ...c) : a);
    const perms = [];
    for (let i = 0; i < numWeights; i++) {
        perms.push(values);
    }
    return cartesian(...perms);
}
function generateModels ( min , max , step , numWeights ) { const values = generateNumbers ( min , max , step ) ; const f = ( a , b ) => [ ] . concat ( ... a . map ( d => b . map ( e => [ ] . concat ( d , e ) ) ) ) ; const cartesian = ( a , b , ... c ) => ( b ? cartesian ( f ( a , b ) , ... c ) : a ) ; const perms = [ ] ; for ( let i = 0 ; i < numWeights ; i ++ ) { perms . push ( values ) ; } return cartesian ( ... perms ) ; }
basically just generates numbers for all of the number of weights you need.
basically just generates numbers for all of the number of weights you need .
// https://stackoverflow.com/questions/12303989/cartesian-product-of-multiple-arrays-in-javascript // seriously this is machine learning, whoever would have thought _MATH_ would be involved???