Skip to main content
No need for slice now
Source Link
{
  name: "Fuzzy Eid",
  fallback: 250/3,
  prev: NaN,
  zeros: new Array(100).fill(0),
  transitions: new Array(100).fill(0).map((x)=>new Array(100).fill(0.0001)),
  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
  },
  wts: (function()
  { 
    let range = (n) => this.zerosnew Array(100).slicefill(0).map((_,index) => index);
    return range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-.01*Math.pow(avg - index,2))
        )
      )
    )
  })(),
  run(scores) {
    if(scores.length)
    {
      const avg = Math.round(average(scores)) - 1, old_prev = this.prev;
      this.prev = avg;
      if(!isNaN(old_prev))
      {
        ++this.transitions[old_prev][avg];
        //prob dist=sum_recordings{e^(-(recording - avg)^2/100)*(prob dist inferred from record)}/(sum of e^-(recording - avg)^2)
        //infer prob dist, scale by e^(-(recording - avg)^2/100)
        const scale_ref = this.scale;
        function get_summand(outpts, index)
        {
          return scale_ref(Math.exp(-.01*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 10050 + 0.4*sum(dist.map((p,n)=>p*n))
      }
    }
    return this.fallback
  }
}
{
  name: "Fuzzy Eid",
  fallback: 250/3,
  prev: NaN,
  zeros: new Array(100).fill(0),
  transitions: new Array(100).fill(0).map((x)=>new Array(100).fill(0.0001)),
  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
  },
  wts: (function()
  { 
    let range = (n) => this.zeros.slice().map((_,index) => index);
    return range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-.01*Math.pow(avg - index,2))
        )
      )
    )
  }),
  run(scores) {
    if(scores.length)
    {
      const avg = Math.round(average(scores)) - 1, old_prev = this.prev;
      this.prev = avg;
      if(!isNaN(old_prev))
      {
        ++this.transitions[old_prev][avg];
        //prob dist=sum_recordings{e^(-(recording - avg)^2/100)*(prob dist inferred from record)}/(sum of e^-(recording - avg)^2)
        //infer prob dist, scale by e^(-(recording - avg)^2/100)
        const scale_ref = this.scale;
        function get_summand(outpts, index)
        {
          return scale_ref(Math.exp(-.01*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 this.fallback
  }
}
{
  name: "Fuzzy Eid",
  fallback: 250/3,
  prev: NaN,
  zeros: new Array(100).fill(0),
  transitions: new Array(100).fill(0).map((x)=>new Array(100).fill(0.0001)),
  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
  },
  wts: (function()
  { 
    let range = (n) => new Array(100).fill(0).map((_,index) => index);
    return range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-.01*Math.pow(avg - index,2))
        )
      )
    )
  })(),
  run(scores) {
    if(scores.length)
    {
      const avg = Math.round(average(scores)) - 1, old_prev = this.prev;
      this.prev = avg;
      if(!isNaN(old_prev))
      {
        ++this.transitions[old_prev][avg];
        //prob dist=sum_recordings{e^(-(recording - avg)^2/100)*(prob dist inferred from record)}/(sum of e^-(recording - avg)^2)
        //infer prob dist, scale by e^(-(recording - avg)^2/100)
        const scale_ref = this.scale;
        function get_summand(outpts, index)
        {
          return scale_ref(Math.exp(-.01*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 50 + 0.4*sum(dist.map((p,n)=>p*n))
      }
    }
    return this.fallback
  }
}
moar bugfixes
Source Link
{
  name: "Fuzzy Eid",
  fallback: 250/3,
  prev: NaN,
  zeros: new Array(100).fill(0),
  transitions: new Array(100).fill(0).map((x)=>new Array(100).fill(0.0001)),
  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
  },
  wts: (function()
  { 
    let range = (n) => new Arraythis.zeros.slice(n).map((_,index) => index);
    return range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-Math.01*Math.pow(avg - index,2))
        )
      )
    )
  }),
  run(scores) {
    if(scores.length)
    {
      const avg = Math.round(average(scores)) - 1, old_prev = this.prev;
      this.prev = avg;
      if(!isNaN(old_prev))
      {
        ++this.transitions[old_prev][avg];
        //prob dist=sum_recordings{e^(-(recording - avg)^2*^2/100)*(prob dist inferred from record)}/(sum of e^-(recording - avg)^2)
        //infer prob dist, scale by e^(-(recording - avg)^2/100)
        const scale_ref = this.scale;
        function get_summand(outpts, index)
        {
          return this.scalescale_ref(Math.exp(-Math.01*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 this.fallback
  }
}
{
  name: "Fuzzy Eid",
  fallback: 250/3,
  prev: NaN,
  zeros: 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
  },
  wts: (function()
  { 
    let range = (n) => new Array(n).map((_,index) => index);
    return range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-Math.pow(avg - index,2))
        )
      )
    )
  }),
  run(scores) {
    if(scores.length)
    {
      const avg = Math.round(average(scores)) - 1, old_prev = this.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)
        //infer prob dist, scale by e^-(recording - avg)^2
        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
  }
}
{
  name: "Fuzzy Eid",
  fallback: 250/3,
  prev: NaN,
  zeros: new Array(100).fill(0),
  transitions: new Array(100).fill(0).map((x)=>new Array(100).fill(0.0001)),
  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
  },
  wts: (function()
  { 
    let range = (n) => this.zeros.slice().map((_,index) => index);
    return range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-.01*Math.pow(avg - index,2))
        )
      )
    )
  }),
  run(scores) {
    if(scores.length)
    {
      const avg = Math.round(average(scores)) - 1, old_prev = this.prev;
      this.prev = avg;
      if(!isNaN(old_prev))
      {
        ++this.transitions[old_prev][avg];
        //prob dist=sum_recordings{e^(-(recording - avg)^2/100)*(prob dist inferred from record)}/(sum of e^-(recording - avg)^2)
        //infer prob dist, scale by e^(-(recording - avg)^2/100)
        const scale_ref = this.scale;
        function get_summand(outpts, index)
        {
          return scale_ref(Math.exp(-.01*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 this.fallback
  }
}
MANY bugfixes
Source Link
{
  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
  }
}
{
  name: "Fuzzy Eid",
  prev: NaN,
  map: 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
  },
  range: (n) => new Array(n).map((_,index) => index),
  wts:
    range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-Math.pow(avg - index,2))
        )
      )
    ),
  run(scores) {
    if(isNaN(this.prev)) return 250/3;
    const avg = Math.round(average(scores)) - 1;
    ++this.map[prev][avg];
    this.prev = avg;
    //prob dist=sum_recordings{e^-(recording - avg)^2*(prob dist inferred from record)}/(sum of e^-(recording - avg)^2)
    //wts[avg]=sum of e^-(recording - avg)^2
    const dist = this.scale(1/this.wts[avg], this.map.map((outpts, index) => 
      this.scale(Math.exp(-Math.pow(avg - index,2)) / sum(outpts), outpts)).reduce(this.vec_plus));
    return 100 + 0.4*sum(dist.map((p,n)=>p*n))
  }
}
{
  name: "Fuzzy Eid",
  fallback: 250/3,
  prev: NaN,
  zeros: 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
  },
  wts: (function()
  { 
    let range = (n) => new Array(n).map((_,index) => index);
    return range(100).map(avg => 
      sum(
        range(100).map(index => 
          Math.exp(-Math.pow(avg - index,2))
        )
      )
    )
  }),
  run(scores) {
    if(scores.length) 
    {
      const avg = Math.round(average(scores)) - 1, old_prev = this.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)
        //infer prob dist, scale by e^-(recording - avg)^2
        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
  }
}
Whitespace!
Source Link
Loading
Source Link
Loading