Esempio n. 1
0
        public List <List <String> > list(String path)
        {
            //Create instance
            LinearRegression program = new LinearRegression();

            string[] Lines = System.IO.File.ReadAllLines(path + "../../../Models/LinearRegressionModel/lpsa.data");
            program.outputTable = program.PredictResult(Lines, path + "../../../Models/LinearRegressionModel/lpsa.pmml");
            List <List <String> > result = new List <List <String> >();

            for (int i = 0; i < Lines.Length; i++)
            {
                List <String> tempRow   = new List <String>();
                String[]      temp      = Lines[i].Split(',');
                String        tempValue = null;
                tempValue = temp[0];
                tempRow.Add(tempValue);
                temp = temp[1].Split(' ');
                for (int j = 0; j < temp.Length; j++)
                {
                    tempValue = temp[j];
                    tempRow.Add(tempValue);
                }
                tempValue = program.outputTable[i][0].ToString();
                tempRow.Add(tempValue);
                result.Add(tempRow);
            }
            return(result);
        }
Esempio n. 2
0
        public ActionResult LinearRegressionModelDefault()
        {
            List <List <String> > Datasource = new List <List <String> >();
            LinearRegression      outputData = new LinearRegression();
            String path = Request.PhysicalPath;

            Datasource         = outputData.list(path);
            ViewBag.datasource = Datasource;
            ViewBag.source     = System.IO.File.ReadAllText(path + "../../../Controllers/LinearRegressionModel/LinearRegressionModelController.cs");
            ViewBag.spark      = System.IO.File.ReadAllText(path + "../../../Models/LinearRegressionModel/Spark.scala");
            ViewBag.PMML       = System.IO.File.ReadAllText(path + "../../../Models/LinearRegressionModel/lpsa.pmml");
            return(View());
        }