public Vector GetOutputFromKnownSamples(Sample sample) { if (!this.outputs.ContainsKey(sample.Label)) { this.outputs[sample.Label] = new MappedValue(){ Mean = new Vector(sample.X.Values.ToArray()), Count = 1}; } else { this.outputs[sample.Label].Count++; int count = this.outputs[sample.Label].Count; this.outputs[sample.Label].Mean.Multiply(((double)count-1.0)/(double)count); Vector addPart = new Vector(sample.X.Values.ToArray()); addPart.Multiply(1 / (double)count); this.outputs[sample.Label].Mean.Add(addPart); } return new Vector(this.outputs[sample.Label].Mean.Values.ToArray()); }
/// <summary> /// Update mean with amnesic average /// </summary> /// <param name="vector">Vector, which should be add to mean</param> protected void UpdateMean(Vector vector) { #warning this must be remade according to F. Amnesic average with parameters t1, t2 double t = (double)this.items.Count; //double multiplier1 = (t - 1) / t; //double multiplier2 = 1 / t; double multiplier1 = (t - 1 - this.GetAmnesicParameter(t)) / t; double multiplier2 = (1 + this.GetAmnesicParameter(t)) / t; this.mean.Multiply(multiplier1); Vector incrementPart = new Vector(vector.Values.ToArray()); incrementPart.Multiply(multiplier2); this.mean.Add(incrementPart); }