lib/apparatus/classifier/randomforest_classifier.js
function entropy(labels, ix) {
    var N= ix.length;
    var p=0.0;
    for(var i=0;i<N;i++) {
        if(labels[ix[i]]==1) p+=1;
    }
    p=(1+p)/(N+2); // let's be bayesian about this
    q=(1+N-p)/(N+2);
    return (-p*Math.log(p) -q*Math.log(q));
}
function entropy(labels, ix) {
    var N= ix.length;
    var p=0.0;
    for(var i=0;i<N;i++) {
        if(labels[ix[i]]==1) p+=1;
    }
    p=(1+p)/(N+2); // let's be bayesian about this
    q=(1+N-p)/(N+2);
    return (-p*Math.log(p) -q*Math.log(q));
}
function entropy ( labels , ix ) { var N = ix . length ; var p = 0.0 ; for ( var i = 0 ; i < N ; i ++ ) { if ( labels [ ix [ i ] ] == 1 ) p += 1 ; } p = ( 1 + p ) / ( N + 2 ) ; // let's be bayesian about this q = ( 1 + N - p ) / ( N + 2 ) ; return ( - p * Math . log ( p ) - q * Math . log ( q ) ) ; }
Misc utility functions
Misc utility functions