{
name: "Fuzzy Eid",
fallback: 250/3,
prev: NaN,
mapzeros: new Array(100).fill(0),
transitions: new Array(100).map(()=>new Array(100).fill(0)),
scale: (scalar, vec) => vec.map(x=>scalar*x),
vec_plus(lhs, rhs) {
let result = lhs.slice();
for(var index=0; index<result.length; ++index) result[index]+=rhs[index];
return result
},
rangewts: (function()
{
let range = (n) => new Array(n).map((_,index) => index),;
wts:
return range(100).map(avg =>
sum(
range(100).map(index =>
Math.exp(-Math.pow(avg - index,2))
)
)
)
}),
run(scores) {
if(isNaN(thisscores.prev)length)
return 250/3; {
const avg = Math.round(average(scores)) - 1;
1, old_prev = ++thisthis.map[prev][avg];prev;
this.prev = avg;
if(!isNaN(old_prev))
{
++this.transitions[old_prev][avg];
//prob dist=sum_recordings{e^-(recording - avg)^2*(prob dist inferred from record)}/(sum of e^-(recording - avg)^2)
//wts[avg]=suminfer ofprob dist, scale by e^-(recording - avg)^2
const dist = this.scale(1/this.wts[avg], this.map.map(function get_summand(outpts, index)
=> {
return this.scale(Math.exp(-Math.pow(avg - index,2)) / sum(outpts), outpts)
}
const
total=this.transitions.map(get_summand).reduce(this.vec_plus,this.zeros),
//wts[avg]=sum of e^-(recording - avg)^2
dist = this.scale(1/this.wts[avg], total);
return 100 + 0.4*sum(dist.map((p,n)=>p*n))
}
}
return fallback
}
}