public static Vector GetMeanOfVectorsMDF(List <Vector> vectors) { Vector result = new Vector(vectors[0].values.Length, vectors[0].valuesMDF.Length, 0.0); foreach (Vector item in vectors) { result.AddMDF(item); } result.DivideMDF((double)vectors.Count); return(result); }
public static Vector GetVarianceOfVectors(List <Vector> vectors, Vector mean) { Vector result = new Vector(vectors[0].values.Length, vectors[0].valuesMDF.Length, 0.0); foreach (var item in vectors) { Vector diff = new Vector(item.valuesMDF.ToArray()); diff.SubtractMDF(mean); diff.MultiplyMDF(diff); result.AddMDF(diff); } result.DivideMDF(vectors.Count - 1); return(result); }
public static Vector GetVarianceOfVectors(List<Vector> vectors, Vector mean) { Vector result = new Vector(vectors[0].values.Length, vectors[0].valuesMDF.Length, 0.0); foreach (var item in vectors) { Vector diff = new Vector(item.valuesMDF.ToArray()); diff.SubtractMDF(mean); diff.MultiplyMDF(diff); result.AddMDF(diff); } result.DivideMDF(vectors.Count - 1); return result; }
public static Vector GetMeanOfVectorsMDF(List<Vector> vectors) { Vector result = new Vector(vectors[0].values.Length, vectors[0].valuesMDF.Length, 0.0); foreach (Vector item in vectors) { result.AddMDF(item); } result.DivideMDF((double)vectors.Count); return result; }