Beispiel #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>();
                tempRow.Add(program.outputTable[i][0].ToString());
                String[] tempValue = new String[2];
                tempValue = Lines[i].Split(',');
                tempRow.Add(tempValue[0]);
                tempRow.InsertRange(2, tempValue[1].Split(' ').ToList());
                result.Add(tempRow);
            }
            return(result);
        }
Beispiel #2
0
        private void BindDataSource()
        {
            List <List <String> > Datasource = new List <List <String> >();

            LinearRegression outputData = new LinearRegression();
            String           path       = Request.PhysicalPath;

            Datasource = outputData.list(path);
            this.FlatGrid.DataSource = Datasource;
            this.FlatGrid.DataBind();
            Model  data       = new Model();
            String pmmlPath   = string.Format("{0}{1}.pmml", path + "../../../Models/LinearRegressionModel/", "lpsa");
            String sourcePath = string.Format("{0}{1}.aspx.cs", path + "../../../LinearRegressionModel/", "Default");
            String sparkPath  = string.Format("{0}{1}.scala", path + "../../../Models/LinearRegressionModel/", "Spark");

            data.setPath(pmmlPath, sourcePath, sparkPath);
            string PMMLconv = data.PMML.Replace("<", "&lt");

            Literal3.Text = PMMLconv;
            JavaScriptSerializer js = new JavaScriptSerializer();

            Session["source"] = js.Serialize(data.Source).Replace("\"", "^");
            Session["spark"]  = js.Serialize(data.Spark).Replace("\"", "^");
        }