Esempio n. 1
0
        /// <summary>
        /// Determines whether the specified train parameters are valid.
        /// </summary>
        /// <param name="trainParams">The train parameters.</param>
        /// <returns><c>true</c> if the specified train parameters are valid; otherwise, <c>false</c>.</returns>
        public static bool IsValid(TrainingParameters trainParams)
        {
            if (!trainParams.IsValid())
            {
                return(false);
            }

            var algorithmName = trainParams.Get(Parameters.Algorithm);

            if (!(builtInTrainers.ContainsKey(algorithmName) || GetTrainerType(trainParams) != null))
            {
                return(false);
            }

            var dataIndexer = trainParams.Get(Parameters.DataIndexer);

            if (dataIndexer != null)
            {
                switch (dataIndexer)
                {
                case Parameters.DataIndexers.OnePass:
                case Parameters.DataIndexers.TwoPass:
                    break;

                default:
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// Determines whether the parameters of this trainer are valid.
 /// </summary>
 /// <returns><c>true</c> if the parameters of this trainer are valid; otherwise, <c>false</c>.</returns>
 protected virtual bool IsValid()
 {
     return(trainParams.IsValid());
 }