Rename pattern and make probability per row

master
Mike Bryant 5 years ago
parent 63e6b1adec
commit 0b69cba802

@ -47,7 +47,7 @@
<option value="-1" selected>(unknown)</option>
<!-- Choices are ordered by increasing desirability, not code ID order -->
<option value="2">Decreasing</option>
<option value="0">Rollercoaster</option>
<option value="0">Fluctuating</option>
<option value="3">Small spike</option>
<option value="1">Large spike</option>
</select>

@ -1,31 +1,38 @@
const PATTERN = {
ROLLERCOASTER: 0,
FLUCTUATING: 0,
LARGE_SPIKE: 1,
DECREASING: 2,
SMALL_SPIKE: 3,
};
const PATTERN_COUNTS = {
[PATTERN.FLUCTUATING]: 56,
[PATTERN.LARGE_SPIKE]: 7,
[PATTERN.DECREASING]: 1,
[PATTERN.SMALL_SPIKE]: 8,
}
const PROBABILITY_MATRIX = {
[PATTERN.ROLLERCOASTER]: {
[PATTERN.ROLLERCOASTER]: 0.20,
[PATTERN.FLUCTUATING]: {
[PATTERN.FLUCTUATING]: 0.20,
[PATTERN.LARGE_SPIKE]: 0.30,
[PATTERN.DECREASING]: 0.15,
[PATTERN.SMALL_SPIKE]: 0.35,
},
[PATTERN.LARGE_SPIKE]: {
[PATTERN.ROLLERCOASTER]: 0.50,
[PATTERN.FLUCTUATING]: 0.50,
[PATTERN.LARGE_SPIKE]: 0.05,
[PATTERN.DECREASING]: 0.20,
[PATTERN.SMALL_SPIKE]: 0.25,
},
[PATTERN.DECREASING]: {
[PATTERN.ROLLERCOASTER]: 0.25,
[PATTERN.FLUCTUATING]: 0.25,
[PATTERN.LARGE_SPIKE]: 0.45,
[PATTERN.DECREASING]: 0.05,
[PATTERN.SMALL_SPIKE]: 0.25,
},
[PATTERN.SMALL_SPIKE]: {
[PATTERN.ROLLERCOASTER]: 0.45,
[PATTERN.FLUCTUATING]: 0.45,
[PATTERN.LARGE_SPIKE]: 0.25,
[PATTERN.DECREASING]: 0.15,
[PATTERN.SMALL_SPIKE]: 0.15,
@ -211,7 +218,7 @@ function* generate_pattern_0_with_lengths(given_prices, high_phase_1_len, dec_ph
});
}
yield {
pattern_description: "Rollercoaster",
pattern_description: "Fluctuating",
pattern_number: 0,
prices: predicted_prices
};
@ -615,7 +622,7 @@ function get_probabilities(possibilities, previous_pattern) {
}, 0);
return possibilities.map(function (poss) {
poss.probability = PROBABILITY_MATRIX[previous_pattern][poss.pattern_number] / max_percent;
poss.probability = PROBABILITY_MATRIX[previous_pattern][poss.pattern_number] / PATTERN_COUNTS[poss.pattern_number] / max_percent;
return poss;
});
}

Loading…
Cancel
Save