public void Init() { _classificationRegistry = new Mock <IClassificationTypeRegistryService>(); TypeSetupHelper(out _attributeType, Classifications.PowerShellAttribute); TypeSetupHelper(out _commandType, Classifications.PowerShellCommand); TypeSetupHelper(out _commandArgumentType, Classifications.PowerShellCommandArgument); TypeSetupHelper(out _commandParameterType, Classifications.PowerShellCommandParameter); TypeSetupHelper(out _commentType, Classifications.PowerShellComment); TypeSetupHelper(out _keywordType, Classifications.PowerShellKeyword); TypeSetupHelper(out _numberType, Classifications.PowerShellNumber); TypeSetupHelper(out _operatorType, Classifications.PowerShellOperator); TypeSetupHelper(out _stringType, Classifications.PowerShellString); TypeSetupHelper(out _typeType, Classifications.PowerShellType); TypeSetupHelper(out _variableType, Classifications.PowerShellVariable); TypeSetupHelper(out _memberType, Classifications.PowerShellMember); TypeSetupHelper(out _groupStartType, Classifications.PowerShellGroupStart); TypeSetupHelper(out _groupEndType, Classifications.PowerShellGroupEnd); TypeSetupHelper(out _lineContinuationType, Classifications.PowerShellLineContinuation); TypeSetupHelper(out _loopLabelType, Classifications.PowerShellLoopLabel); TypeSetupHelper(out _newLineType, Classifications.PowerShellNewLine); TypeSetupHelper(out _positionType, Classifications.PowerShellPosition); TypeSetupHelper(out _statementSeparatorType, Classifications.PowerShellStatementSeparator); TypeSetupHelper(out _unknownType, Classifications.PowerShellUnknown); EditorImports.ClassificationTypeRegistryService = _classificationRegistry.Object; _classifierService = new ClassifierService(); }
public AppDataCenter() { AcceptanceCriteria = new AcceptanceCriteriaData() { ModelMaxFpPages = 0.2, ModelMinMatchPages = 0.5 }; m_setupData = new SetupData(); m_setupData.BaseClassifierConfiguration = ClassifierService.GetDefaultConfiguration(); ModelsService.Service.ModelsFolder = CommandLine.GetParamValue("ModelsFolder"); if (CommandLine.GetParamValue("FilterFields") != null) { _filterFields = CommandLine.GetParamValue("FilterFields").Split(','); } else { _filterFields = new string[0]; } _pathtoscale = CommandLine.GetParamValue("scales"); /* if (TiS.Core.TisCommon.CommandLine.GetParamValue("scales") != null) * { * FeatureListHolder.loadScalesFromFile(TiS.Core.TisCommon.CommandLine.GetParamValue("scales")); * * FeatureListHolder.SaveScalesToFile(TiS.Core.TisCommon.CommandLine.GetParamValue("scales")); * }*/ ModelsService.Service.Changed += ModelsServiceService_Changed; FeaturesSelected = new ObservableCollection <IFieldFeature>(); FeatureListHolder.GFeatures.ForEach(a => FeaturesSelected.Add(a)); ReportResult = new ObservableCollection <InterfaceForReflection.Models.ReportResultItem>(); ConsoleMessage = new ObservableCollection <string>(); RejectedFields = new ObservableCollection <CustomFieldData>(); FeatureSelectvertical = new ObservableCollection <FeatureSelectModel>(); FeatureSelecthorizontal = new ObservableCollection <InterfaceForReflection.Models.FeatureSelectModel>(); scatterList = new ObservableCollection <ScatterSeries>(); ChosenFields = new string [0]; ChosenFeatures = new List <IFieldFeature>(); EntireModelStats = new InterfaceForReflection.Models.FeatureStatistics(); FeatureGrades = new ObservableCollection <Tuple <string, double, double> >(); var cmd = CommandLine.GetParamValue("FeatureName"); if (cmd != null) { m_featuresCalculate = CommandLine.GetParamValue("FeatureName") .Split(new char[] { ':' }) .ToList(); } }
public void Init() { _classificationRegistry = new Mock <IClassificationTypeRegistryService>(); _variableType = new Mock <IClassificationType>(); _variableType.Setup(m => m.Classification).Returns("variable"); _classificationRegistry.Setup(m => m.GetClassificationType(Classifications.PowerShellVariable)).Returns(_variableType.Object); _stringType = new Mock <IClassificationType>(); _stringType.Setup(m => m.Classification).Returns("string"); _classificationRegistry.Setup(m => m.GetClassificationType(Classifications.PowerShellString)).Returns(_stringType.Object); EditorImports.ClassificationTypeRegistryService = _classificationRegistry.Object; _classifierService = new ClassifierService(); }
public void LoadModel(string modelName) { var model = ModelsService.Service.Load(modelName); string trainPath; ClearAnalyzerData(); foreach (var feature in FeaturesSelected) { feature.IsSelected = model.FeaturesSelectedNames.Contains(feature.Name); } SetupData.BaseClassifierConfiguration = ClassifierService.GetSetupData(model.ClassifierModel, out trainPath); m_setupData = SetupData.Load(GetSetupDataFileName(trainPath)); if (m_setupData != null) { InputFolder = Path.GetFullPath(trainPath); } else { BuildSetupData(trainPath, AppDataCenter.Singleton.GetSetupDataFileName(trainPath)); } //if ( true ) // { // FieldsSelected.Clear(); // m_setupData = SetupData.Load(GetSetupDataFileName(trainPath)); // InputFolder = Path.GetFullPath(trainPath); // UpdateFieldsSelected(m_setupData.Pages.Select(x => x.DocData)); // } // else // { // SetInputFolder(trainPath, AppDataCenter.Singleton.GetSetupDataFileName(trainPath)); // } this.SelectTrainPages(model.TrainPages); AcceptanceCriteria = model.AcceptanceCriteria; ClassifierService.ApplayModel(model); OnPropertyChanged(NotifyGroup.Configuration); OnPropertyChanged(NotifyGroup.StatisticData); }
/* public override void Execute(object state) * { * m_reportsData.Clear(); * m_parameters.Clear(); * * AppDataCenter.Singleton.StartAnalyzer(); * * try * { * var vm = state as MultiRunConfigurationViewModel; * * // Build set of configuration according the selected parameters * BuildConfigurations(vm.Parameters.Where(x => x.IsSelected == true).ToList()); * * int noOfRuns = AppDataCenter.Singleton.SetupData.ClassifierConfigurations.Count(); * * * for (int i = 0; i < noOfRuns; i++) * { * m_trainRunCmd.Configuration = AppDataCenter.Singleton.SetupData.ClassifierConfigurations.ElementAt(i); * m_trainRunCmd.ReportData = m_reportsData[i]; * m_trainRunCmd.Execute(null); * m_oneRunFinish.WaitOne(); * } * * if (AppDataCenter.Singleton.ReportsData.Count() > 2) * { * var result = AppDataCenter.Singleton.ReportsData.OrderBy(x => x, new AppDataCenter.CompareReportData()).First(); * * AppDataCenter.Singleton.SetReportByParameter(result.ParameterValue); * } * } * finally * { * AppDataCenter.Singleton.FinishAnalyzer(); * } * }*/ void BuildConfigurations(IEnumerable <ParameterRange> parametersLeft) { // Initialize parameters dictionary if (m_parameters.Count == 0) { foreach (var par in parametersLeft) { m_parameters.Add(par.ParameterName, 0); } } var parameter = parametersLeft.First(); var fromValue = double.Parse(parameter.From); var toValue = double.Parse(parameter.To); var interval = double.Parse(parameter.Interval); // Create configuration & ReportData for each run for (var val = fromValue; val <= toValue; val += interval) { m_parameters[parameter.ParameterName] = val; if (parametersLeft.Count() > 1) { BuildConfigurations(parametersLeft.Where(x => x != parameter).ToList()); } else { string parameterValue; var config = ClassifierService.GenerateConfiguration( m_parameters, AppDataCenter.Singleton.SetupData.BaseClassifierConfiguration, out parameterValue); AppDataCenter.Singleton.AddClassifierConfiguration(config); m_reportsData.Add(new ReportData() { ParameterValue = parameterValue, ParameterName = m_parameters.Count > 1 ? "Multi" : parameter.ParameterName }); } } }