public static Vector GetMeanOfVectors(List <Vector> vectors) { Vector result = new Vector(vectors[0].values.Length, 0.0); foreach (Vector item in vectors) { result.Add(item); } result.Divide((double)vectors.Count); return(result); }
public static Vector GetYMeanOfSamples(List <Sample> samples) { int count = samples.Count; Vector result = new Vector(Params.inputDataDimension, 0.0); foreach (Sample sample in samples) { result.Add(sample.Y); } result.Divide(count); return(result); }
public static Vector GetXMeanOfSamples(List <Sample> samples) { if (samples.Count == 0) { throw new InvalidOperationException("impossible to return mean from 0 samples"); } int count = samples.Count; Vector result = new Vector(Params.inputDataDimension, 0.0); foreach (Sample sample in samples) { result.Add(sample.X); } result.Divide(count); return(result); }
public static Vector GetMeanOfVectors(List<Vector> vectors) { Vector result = new Vector(vectors[0].values.Length, 0.0); foreach (Vector item in vectors) { result.Add(item); } result.Divide((double)vectors.Count); return result; }
public static Vector GetYMeanOfSamples(List<Sample> samples) { int count = samples.Count; Vector result = new Vector(Params.inputDataDimension, 0.0); foreach (Sample sample in samples) { result.Add(sample.Y); } result.Divide(count); return result; }
public static Vector GetXMeanOfSamples(List<Sample> samples) { if (samples.Count == 0) throw new InvalidOperationException("impossible to return mean from 0 samples"); int count = samples.Count; Vector result = new Vector(Params.inputDataDimension, 0.0); foreach (Sample sample in samples) { result.Add(sample.X); } result.Divide(count); return result; }