/// <summary> /// Method to load Samples /// </summary> /// <param name="sample">Sample values</param> public void LoadGradientBoostingCarsSample(Sample sample, DataManager dataManager) { Cars_Laplace.Program cars = new Cars_Laplace.Program(); var path = sample.GetParentDirectoryPath(Server.MapPath("~")); string samplePath = string.Format("{0}{1}\\{2}", path, sample.SamplePath, "Model\\"); string outputPath = samplePath + "PredictedOutput.html"; string pmmlPath = string.Format("{0}{1}.pmml", samplePath, "Cars"); string rScriptPath = string.Format("{0}{1}.R", samplePath, "Cars"); string inputPath = samplePath + "Cars.csv"; Table inputTable = new Syncfusion.PMML.Table(inputPath, true, ','); Table selectedPageInputTable = sample.PagingMethod(inputTable, dataManager, dataManager != null ? dataManager.Skip : 0); Table outputTable = cars.PredictResult(selectedPageInputTable, pmmlPath); ViewBag.output = sample.serializeTable(inputTable, outputTable, dataManager != null ? dataManager.Skip : 0); Dictionary <string, List <string> > columnCollection = sample.GetColumnNames(inputTable, outputTable); ViewBag.InputColumns = columnCollection["inputColumns"]; ViewBag.OutputColumns = columnCollection["outputColumns"]; ViewBag.InputNumericColumns = columnCollection["inputNumericColumns"]; ViewBag.OutputNumericColumns = columnCollection["outputNumericColumns"]; if (System.IO.File.Exists(rScriptPath)) { ViewBag.RScript = System.IO.File.ReadAllText(rScriptPath); } ViewBag.PMML = System.IO.File.ReadAllText(pmmlPath); }
/// <summary> /// Method to load Samples /// </summary> /// <param name="sample">Sample values</param> /// <param name="root">root directory</param> public static void LoadSample(Sample sample, string root) { Cars_Laplace.Program cars = new Cars_Laplace.Program(); var path = sample.GetParentDirectoryPath(root); string samplePath = string.Format("{0}{1}\\{2}", path, sample.samplePath, "Model\\"); string outputPath = samplePath + "PredictedOutput.html"; string pmmlPath = string.Format("{0}{1}.pmml", samplePath, "Cars"); string rScriptPath = string.Format("{0}{1}.R", samplePath, "Cars"); string inputPath = samplePath + "Cars.csv"; sample.inputTable = new Syncfusion.PMML.Table(inputPath, true, ','); sample.selectedPageInputTable = sample.PagingMethod(sample.inputTable); sample.outputTable = cars.PredictResult(sample.selectedPageInputTable, pmmlPath); if (File.Exists(rScriptPath)) { sample.RScript = File.ReadAllText(rScriptPath); } sample.PMML = File.ReadAllText(pmmlPath); }