Example #1
0
        /// <summary>
        ///     Handle loading a task.
        /// </summary>
        /// <param name="section">The section.</param>
        private void HandleTask(EncogFileSection section)
        {
            var task = new AnalystTask(section.SubSectionName);

            foreach (String line in section.Lines)
            {
                task.Lines.Add(line);
            }
            _script.AddTask(task);
        }
Example #2
0
        /// <summary>
        ///     Execute a task.
        /// </summary>
        /// <param name="name">The name of the task to execute.</param>
        public void ExecuteTask(String name)
        {
            EncogLogging.Log(EncogLogging.LevelInfo, "Analyst execute task:"
                             + name);
            AnalystTask task = _script.GetTask(name);

            if (task == null)
            {
                throw new AnalystError("Can't find task: " + name);
            }

            ExecuteTask(task);
        }
Example #3
0
        /// <summary>
        ///     Execute a task.
        /// </summary>
        /// <param name="task">The task to execute.</param>
        public void ExecuteTask(AnalystTask task)
        {
            int total   = task.Lines.Count;
            int current = 1;

            foreach (String line in task.Lines)
            {
                EncogLogging.Log(EncogLogging.LevelDebug, "Execute analyst line: "
                                 + line);
                ReportCommandBegin(total, current, line);

                bool   canceled = false;
                String command;
                String args;

                String line2 = line.Trim();
                int    index = line2.IndexOf(' ');
                if (index != -1)
                {
                    command = line2.Substring(0, (index) - (0)).ToUpper();
                    args    = line2.Substring(index + 1);
                }
                else
                {
                    command = line2.ToUpper();
                    args    = "";
                }

                Cmd cmd = _commands[command];

                if (cmd != null)
                {
                    canceled = cmd.ExecuteCommand(args);
                }
                else
                {
                    throw new AnalystError("Unknown Command: " + line);
                }

                ReportCommandEnd(canceled);
                CurrentQuantTask = null;
                current++;

                if (ShouldStopAll())
                {
                    break;
                }
            }
        }
Example #4
0
        /// <summary>
        /// Save the tasks.
        /// </summary>
        ///
        /// <param name="xout">The output file.</param>
        private void SaveTasks(EncogWriteHelper xout)
        {
            xout.AddSection("TASKS");
            var list = _script.Tasks.Keys.ToList();

            list.Sort();

            foreach (String key  in  list)
            {
                AnalystTask task = _script.GetTask(key);
                xout.AddSubSection(task.Name);

                foreach (String line  in  task.Lines)
                {
                    xout.AddLine(line);
                }
            }
        }
Example #5
0
        /// <summary>
        /// Generate the tasks.
        /// </summary>
        ///
        private void GenerateTasks()
        {
            var task1 = new AnalystTask(EncogAnalyst.TaskFull);

            if (!_timeSeries && _taskRandomize)
            {
                task1.Lines.Add("randomize");
            }

            if (!_timeSeries && _taskBalance)
            {
                task1.Lines.Add("balance");
            }

            if (_taskSegregate)
            {
                task1.Lines.Add("segregate");
            }

            if (_taskNormalize)
            {
                task1.Lines.Add("normalize");
            }

            task1.Lines.Add("generate");
            task1.Lines.Add("create");
            task1.Lines.Add("train");
            task1.Lines.Add("evaluate");

            var task2 = new AnalystTask("task-generate");

            if (!_timeSeries && _taskRandomize)
            {
                task2.Lines.Add("randomize");
            }

            if (_taskSegregate)
            {
                task2.Lines.Add("segregate");
            }
            if (_taskNormalize)
            {
                task2.Lines.Add("normalize");
            }
            task2.Lines.Add("generate");

            var task3 = new AnalystTask("task-evaluate-raw");

            task3.Lines.Add(CreateSet(ScriptProperties.MlConfigEvalFile,
                                      FileEvalNorm));
            task3.Lines.Add(CreateSet(ScriptProperties.NormalizeConfigSourceFile,
                                      FileEval));
            task3.Lines.Add(CreateSet(ScriptProperties.NormalizeConfigTargetFile,
                                      FileEvalNorm));
            task3.Lines.Add("normalize");
            task3.Lines.Add("evaluate-raw");

            var task4 = new AnalystTask("task-create");

            task4.Lines.Add("create");

            var task5 = new AnalystTask("task-train");

            task5.Lines.Add("train");

            var task6 = new AnalystTask("task-evaluate");

            task6.Lines.Add("evaluate");

            var task7 = new AnalystTask("task-cluster");

            task7.Lines.Add("cluster");

            _script.AddTask(task1);
            _script.AddTask(task2);
            _script.AddTask(task3);
            _script.AddTask(task4);
            _script.AddTask(task5);
            _script.AddTask(task6);
            _script.AddTask(task7);
        }
Example #6
0
 /// <summary>
 ///     Add a task.
 /// </summary>
 public void AddTask(AnalystTask task)
 {
     _tasks[task.Name] = task;
 }