public Dictionary <string, List <object> > ModelEvaluation() { var bs = Factory.ProgresReport.BestSolution; var par = Factory.Parameters; var dic = new Dictionary <string, List <object> >(); // if (bs != null) { //get output for training data set var yy = ExpData.GetColumnOutputValues(false); var y1 = yy[0];//Inputs.GetDataOutputCol(true);//experiment var output = calculateOutput(true, true); //get output for testing data set if available var yy1 = ExpData.GetColumnOutputValues(true); var y2 = yy1 != null ? yy1[0] : null;//Inputs.GetDataOutputCol(false);//experiment var outputt = calculateOutput(false, true); // var col = ExpData.GetColumnsFromOutput().FirstOrDefault(); if (col.ColumnDataType == ColumnType.Binary || col.ColumnDataType == ColumnType.Category) { dic.Add("Classes", col.Statistics.Categories.ToList <object>()); } //add data sets dic.Add("obs_train", y1.Select(x => (object)x).ToList <object>()); dic.Add("prd_train", output.Select(x => (object)x).ToList <object>()); //add test dataset if (y2 != null) { dic.Add("obs_test", y2.Select(x => (object)x).ToList <object>()); dic.Add("prd_test", outputt.Select(x => (object)x).ToList <object>()); } return(dic); } return(null); }
public bool setLearningType(Parameters param) { //determine the type of ML param.OutputType = ExpData.GetOutputColumnType(); if (param.OutputType == ColumnType.Binary) { if (param.RootName.StartsWith("Sigm")) { param.RootFunctionNode = new Function() { Id = 2048, Name = "Sigmoid", Arity = 1, HasParameter = true, Parameter = param.Threshold, Parameter2 = 2 } } ; else if (param.RootName.StartsWith("Step")) { param.RootFunctionNode = new Function() { Id = 2049, Name = "Step", Arity = 1, HasParameter = true, Parameter = param.Threshold, Parameter2 = 2 } } ; else if (param.RootName.StartsWith("Scal")) { param.RootFunctionNode = new Function() { Id = 2050, Name = "SSigmoid", Arity = 1, HasParameter = true, Parameter = param.Threshold, Parameter2 = 2 } } ; else if (param.RootName.StartsWith("Soft")) { param.RootFunctionNode = new Function() { Id = 2051, Name = "Softmax", Arity = 2, Parameter2 = 2 } } ; } else if (param.OutputType == ColumnType.Category) { var clss = ExpData.GetColumnsFromOutput().FirstOrDefault().Statistics.Categories.Count; if (param.RootName.StartsWith("Scal")) { param.RootFunctionNode = new Function() { Id = 2050, Name = "SSigmoid", Arity = 1, HasParameter = true, Parameter = clss, Parameter2 = clss } } ; else if (param.RootName.StartsWith("Soft")) { param.RootFunctionNode = new Function() { Id = 2051, Name = "Softmax", Arity = clss, Parameter2 = clss } } ; else { throw new Exception("Predefined Root Node is not compatible with multi class classification modeling!"); } } else if (param.OutputType == ColumnType.Numeric) { if (param.RootName.StartsWith("Pol3")) { param.RootFunctionNode = Globals.GetFunction(2039);// new Function() { Id = 2050, Name = "P3", Arity = 1, HasParameter = true, Parameter = clss, Parameter2 = clss }; } } return(true); }