示例#1
0
        public static bool IsDatasetCompatible(IDataAnalysisModel model, IDataset dataset, out string errorMessage)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model", "The provided model is null.");
            }
            if (dataset == null)
            {
                throw new ArgumentNullException("dataset", "The provided dataset is null.");
            }
            errorMessage = string.Empty;

            foreach (var variable in model.VariablesUsedForPrediction)
            {
                if (!dataset.ContainsVariable(variable))
                {
                    if (string.IsNullOrEmpty(errorMessage))
                    {
                        errorMessage = "The following variables must be present in the dataset for model evaluation:";
                    }
                    errorMessage += System.Environment.NewLine + " " + variable;
                }
            }

            return(string.IsNullOrEmpty(errorMessage));
        }