some more of eloquent datastructures
This commit is contained in:
parent
a759fef088
commit
ec72ed57b9
2 changed files with 51 additions and 11 deletions
|
@ -113,4 +113,22 @@ function phi(table) {
|
|||
(table[1] + table[3]) *
|
||||
(table[0] + table[2]));
|
||||
};
|
||||
// console.log(phi([76, 9, 4, 1]));
|
||||
function journalEvents(journal){
|
||||
let events = [];
|
||||
for (let entry of journal){
|
||||
for (let event of entry.events){
|
||||
if (!events.includes(event)){
|
||||
events.push(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
return events;
|
||||
}
|
||||
console.log(journalEvents(JOURNAL));
|
||||
|
||||
for (let event of journalEvents(JOURNAL)){
|
||||
let correlation = phi(tableFor(event, JOURNAL));
|
||||
if (correlation > 0.1 || correlation < -0.1){
|
||||
console.log(event + ":", correlation)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue