machine_learning icon indicating copy to clipboard operation
machine_learning copied to clipboard

Cost function used in hillclimb.js

Open mykeels opened this issue 7 years ago • 0 comments

Is there a name for the cost function used in the hill-climbing example? I'm talking this:

var costf = function(vec) {
    var cost = 0;
    for(var i =0; i<14;i++) { // This example is using 15-dimensional input vector.
        cost += (0.5*i*vec[i]*Math.exp(-vec[i]+vec[i+1])/vec[i+1])
    }
    cost += (3.*vec[14]/vec[0]);
    return cost; // our goal is finding a vector which makes the cost value minimum.
};

mykeels avatar Jan 02 '17 20:01 mykeels