in readability.mjs file when i call anneal function , deviationScore class call infinite time. for compare two file i hardcode two sourcefile html and expected output html file.
function anneal()
{
const annealer = new ContentFnodesTuner();
coeffs = annealer.anneal();
}
}
randomTransition(solution) {
// Nudge a random coefficient in a random direction.
const ret = solution.slice();
let element, nudge;
// Don't let weights go negative. Negative scores make overall
// scores flip signs spastically. If you want fractional scores in
// your ruleset, put 1 / coefficient in your ruleset.
do {
element = Math.floor(Math.random() * solution.length);
nudge = Math.floor(Math.random() * 2) ? -.5 : .5;
} while (ret[element] + nudge < 0);
ret[element] += nudge;
return ret;
}
initialSolution() {
console.log("this is random init")
return coeffs;
}
}
function deviationScore(coeffs) {
var coeffs = [14.5, 11, 18, 5, 9.5, 21, 33, doc];
const stats = new DiffStats(tunedContentFnodes(coeffs));
return stats.score();
}
class DiffStats {
in readability.mjs file when i call anneal function , deviationScore class call infinite time. for compare two file i hardcode two sourcefile html and expected output html file.
function anneal() { const annealer = new ContentFnodesTuner(); coeffs = annealer.anneal(); }
class ContentFnodesTuner extends Annealer { constructor() { super(); // const docPairs = readabilityDocPairs(); this.solutionCost = coeffs => deviationScore(coeffs); /// deviationscore call infinite times
}
function deviationScore(coeffs) { var coeffs = [14.5, 11, 18, 5, 9.5, 21, 33, doc]; const stats = new DiffStats(tunedContentFnodes(coeffs)); return stats.score(); } class DiffStats {