Esempio n. 1
0
        public async Task <TrainingResults> Train(DocumentSet documentSet, TrainingHeader header, CancellationToken token)
        {
            Guard.NotNull(() => documentSet, documentSet);
            Guard.NotNull(() => header, header);
            Guard.NotNull(() => documentSet.Document, documentSet.Document);
            log.Debug("Train with {0} - {1}", documentSet.Document.Length, header);
            using (PerformanceTrace.Info(log, "Training..."))
            {
                var arff = CreateDataset(documentSet, token);
                if (arff == null)
                {
                    throw new LearningException("Not enough documents to learn patterns");
                }

                arff.CompactHeader(3);
                arff.CompactReviews(3);
                arff.CompactClass(3);

                if (arff.TotalDocuments < 10)
                {
                    throw new LearningException("Not enough documents to learn patterns");
                }

                token.ThrowIfCancellationRequested();
                arff.Normalize(header.Normalization);
                SvmTrainClient train = new SvmTrainClient(arff);
                var            model = await train.Train(header, token).ConfigureAwait(false);

                return(model);
            }
        }
Esempio n. 2
0
        public static IDisposable BeginPerformanceTrace(string name)
        {
            PerformanceTrace trace;

            if (!m_PerformanceTraces.TryGetValue(name, out trace))
            {
                trace = new PerformanceTrace(name);
            }

            return(trace);
        }
Esempio n. 3
0
        public static IDisposable BeginPerformanceTrace(string name)
        {
            PerformanceTrace trace;

            if (!m_PerformanceTraces.TryGetValue(name, out trace))
            {
                trace = new PerformanceTrace(name);
            }

            return trace;
        }
        public void Initialize()
        {
            using (var p = new PerformanceTrace("new Workspace"))
            {
                workspace = new ScriptingWorkspace();
            }

            PropertyChangedEventManager.AddHandler(documentService, DocumentServicePropertyChanged, "");
            CollectionChangedEventManager.AddHandler(documentService.DocumentFiles, DocumentsCollectionChanged);
            foreach (var documentFile in documentService.DocumentFiles)
            {
                AddProject(documentFile);
            }

            ShellViewModel.StartCommand           = startCommand;
            ShellViewModel.StopCommand            = stopCommand;
            ShellViewModel.ErrorListView          = ErrorListViewModel.View;
            ShellViewModel.OutputView             = OutputViewModel.View;
            ShellViewModel.IsErrorListViewVisible = true;
        }
Esempio n. 5
0
 private void PerformanceTrace_Alert(PerformanceTrace sender, PerformanceTrace.PerformanceAlertEventArgs e)
 {
     Console.WriteLine("Call {4} => {0}:{1} passed in {2} milliseconds ({3} Ticks)", e.EntityName, e.MethodName, e.TimeElapsedMS, e.Ticks, e.CallType);
 }
Esempio n. 6
0
 private void PerformanceTrace_Alert(PerformanceTrace sender, PerformanceTrace.PerformanceAlertEventArgs args)
 {
     Factory.Console.WriteLine("PerformanceTrace Alert: {0}", args);
 }
Esempio n. 7
0
 private void PerformanceTrace_Alert(PerformanceTrace sender, PerformanceTrace.PerformanceAlertEventArgs args)
 {
     Console.WriteLine("Call {4} => {0}:{1} passed in {2} milliseconds ({3} Ticks)",
                       args.EntityName, args.MethodName, args.TimeElapsedMS, args.Ticks, args.CallType);
 }
Esempio n. 8
0
 private void PerformanceTrace_Alert(PerformanceTrace sender, PerformanceTrace.PerformanceAlertEventArgs args)
 {
     Console.WriteLine(args);
 }
Esempio n. 9
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 public Settings()
 {
     _messageFilter = new RetryMessageFilter();
     _performanceTrace = new PerformanceTrace();
 }