protected ModelEvaluatorCollection(List <ModelEvaluator> modelsToEvaluate)
            :
            base(modelsToEvaluate[0].NullDistns, modelsToEvaluate[0].AltDistn, modelsToEvaluate[0].ModelScorer)
        {
            _modelsToEvaluate = new List <ModelEvaluatorCrossValidate>(modelsToEvaluate.Count);

            foreach (ModelEvaluator modelEvaluator in modelsToEvaluate)
            {
                ModelEvaluatorCrossValidate modelToAdd;
                if (modelEvaluator is ModelEvaluatorCrossValidate)
                {
                    modelToAdd = (ModelEvaluatorCrossValidate)modelEvaluator;
                }
                else
                {
                    modelToAdd = ModelEvaluatorCrossValidate.GetInstance(modelEvaluator);
                }
                _modelsToEvaluate.Add(modelToAdd);
            }
        }
Пример #2
0
 public static ModelEvaluator GetInstance(string nameAndParameters, ModelScorer scorer)
 {
     nameAndParameters = nameAndParameters.ToLower();
     if (nameAndParameters.StartsWith(ModelEvaluatorCrossValidate.BaseName.ToLower()))
     {
         return(ModelEvaluatorCrossValidate.GetInstance(nameAndParameters.Substring(ModelEvaluatorCrossValidate.BaseName.Length), scorer));
     }
     else if (nameAndParameters.StartsWith(ModelEvaluatorDiscreteConditionalCollection.BaseName.ToLower()))
     {
         return(ModelEvaluatorDiscreteConditionalCollection.GetInstance(nameAndParameters.Substring(ModelEvaluatorDiscreteConditionalCollection.BaseName.Length), scorer));
     }
     else if (nameAndParameters.StartsWith(ModelEvaluatorDiscrete.BaseName.ToLower()))
     {
         return(ModelEvaluatorDiscrete.GetInstance(nameAndParameters.Substring(ModelEvaluatorDiscrete.BaseName.Length), scorer));
     }
     else if (nameAndParameters.StartsWith(ModelEvaluatorGaussian.BaseName.ToLower()))
     {
         return(ModelEvaluatorGaussian.GetInstance(nameAndParameters.Substring(ModelEvaluatorGaussian.BaseName.Length), scorer));
     }
     else
     {
         throw new ArgumentException("ModelEvaluator cannot parse " + nameAndParameters);
     }
 }