Structure to hold generator, model, and accuracy information.
Beispiel #1
0
        /// <summary>
        /// Trains an arbitrary number of models on the
        /// provided examples by creating a separation
        /// of data based on training percentage. Each generator
        /// is rerun a predetermined amount of times.
        /// </summary>
        /// <param name="examples">Source data</param>
        /// <param name="trainingPercentage">Data split percentage</param>
        /// <param name="repeat">Number of repetitions per generator</param>
        /// <param name="generators">Model generators used</param>
        /// <returns>Best models for each generator</returns>
        public static LearningModel[] Learn(IEnumerable<object> examples, double trainingPercentage, int repeat, params IGenerator[] generators)
        {
            if (generators.Length == 0)
                throw new InvalidOperationException("Need to have at least one generator!");

            // set up models
            var models = new LearningModel[generators.Length];

            for (int i = 0; i < generators.Length; i++)
                models[i] = Learn(examples, trainingPercentage, repeat, generators[i]);

            return models;
        }