//initialize project controllers with project information internal async Task <bool> Initproject(string projectPath, ProjectType pType = ProjectType.Default) { 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"); 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 = Path.Combine(Settings.ProjectFolder, Name, Name + "_rawdata.txt"); } //load rawdataset var parser = Project.CreateDataParser(dicData["parser"]); var result = await initRawData(filePath, parser); //create dataset var ds = new ANNDataSet(); ds.InitMetaColumn(prData.Where(x => x.StartsWith("Column")).OrderBy(x => x)); ds.Data = result.data; ds.IsPrecentige = Settings.PercentigeSplit; ds.RowsToValidation = Settings.ValidationSetCount; ds.RowsToTest = Settings.TestSetCount; 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); } return(true); } catch (Exception) { throw; } }
//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; } }