예제 #1
0
        // import dataset into data frame
        private void btnImportData_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(textBox3.Text))
                {
                    MessageBox.Show("No file is selected!");
                    return;
                }


                var colDelimiter = GetColumDelimiter();
                //define the row
                //string[] rows = originData.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries);
                this.Cursor = Cursors.WaitCursor;
                var result = ANNDataSet.prepareData(originLines, colDelimiter, firstRowHeaderCheck.Checked, radioButton1.Checked);

                Header = result.header;
                Data   = result.data;
            }
            catch (Exception ex)
            {
                reportException(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
예제 #2
0
        //import data as time series
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(textBox3.Text))
                {
                    MessageBox.Show("No file is selected!");
                    return;
                }


                var colDelimiter = GetColumDelimiter();

                if (numCtrlNumForTest.Value < 1 && numCtrlNumForTest.Value > originData.Length)
                {
                    MessageBox.Show("Invalid number of time leg. PLease specify the time leg between 1 and row number.");
                    return;
                }

                if (string.IsNullOrEmpty(originData))
                {
                    return;
                }

                //
                //define the row
                string[] tdata = originData.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries);
                //transform the time series into data frame
                string[] prepData = prepareTimeSeriesData(tdata, (int)numCtrlNumForTest.Value);

                //prepare data for loading
                var result = ANNDataSet.prepareData(prepData, new char[] { ';' }, checkBox1.Checked, radioButton1.Checked);
                Header = result.header;
                Data   = result.data;
            }
            catch (Exception ex)
            {
                reportException(ex);
            }
        }
예제 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(textBox3.Text))
                {
                    MessageBox.Show("No file is selected!");
                    return;
                }


                var colDelimiter = GetColumDelimiter();
                //define the row
                string[] rows = originData.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries);

                var result = ANNDataSet.prepareData(rows, colDelimiter, checkBox1.Checked, radioButton1.Checked);
                Header = result.header;
                Data   = result.data;
            }
            catch (Exception ex)
            {
                reportException(ex);
            }
        }
예제 #4
0
        //initialize project controllers with project information
        internal void Initproject(string projectPath)
        {
            try
            {
                var fi = new FileInfo(projectPath);
                if (!fi.Exists)
                {
                    throw new Exception("Project File not found!");
                }

                //load project information from file
                var dicData = Project.LoadProjectData(projectPath);

                //load project info
                Settings = Project.CreateProjectSettings(dicData["project"]);
                Settings.ProjectFolder = fi.Directory.FullName;
                Settings.ProjectFile   = fi.Name;

                //
                Name = Project.GetParameterValue(dicData["project"], "Name");

                //check which type the project is
                var strType = Project.GetParameterValue(dicData["project"], "Type");
                if (string.IsNullOrEmpty(strType))
                {
                    Type = ProjectType.Default;
                }
                else
                {
                    Type = (ProjectType)Enum.Parse(typeof(ProjectType), strType, true);
                }

                var prData   = dicData["data"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                var dataPath = Project.GetParameterValue(prData, "RawData");
                var filePath = "";
                if (!string.IsNullOrEmpty(dataPath))
                {
                    filePath = Path.Combine(Settings.ProjectFolder, Name, dataPath);
                }
                else
                {
                    filePath = Name + "_rawdata.txt";
                }

                //create dataset
                var ds = new ANNDataSet();

                ds.InitMetaColumn(prData.Where(x => x.StartsWith("Column")).OrderBy(x => x));
                var parser = Project.CreateDataParser(dicData["parser"]);

                //check if raw data file exists
                fi = new FileInfo(filePath);
                if (fi.Exists)
                {
                    //column separator is always ;
                    var result = ANNDataSet.prepareData(File.ReadAllLines(filePath), parser.ColumnSeparator, parser.FirstRowHeader);
                    ds.Data         = result.data;
                    ds.IsPrecentige = Settings.PrecentigeSplit;
                    ds.TestRows     = Settings.ValidationSetCount;
                    DataSet         = ds;
                }

                //load existing mlconfigs
                var models = Project.GetMLConfigs(dicData["project"]);
                foreach (var model in models)
                {
                    var m = new MLConfigController(activeModelChanged);
                    m.Settings = Settings;
                    //
                    m.Name = model;
                    Models.Add(m);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }