Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        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;
        }