Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Fix bug where fitness function assigned higher fitness to worse results. #1043

Merged
merged 1 commit into from
Jan 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/genetic_backtester/phenotype.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ module.exports = {
if (typeof phenotype.sim === 'undefined') return 0;

var vsBuyHoldRate = (phenotype.sim.vsBuyHold / 50);
var wlRatioRate = 1.0 / (1.0 + Math.pow(2.71828, -(phenotype.sim.wins - phenotype.sim.losses)));
var wlRatio = phenotype.sim.wins - phenotype.sim.losses

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ';'?

var wlRatioRate = 1.0 / (1.0 + Math.pow(2.71828, wlRatio < 0 ? wlRatio:-(wlRatio)));
var rate = vsBuyHoldRate * (wlRatioRate);
return rate;
},
Expand Down