MachineIntelligenceCore:Visualization
OpenGLContinuousLearningApplication.cpp
Go to the documentation of this file.
1 
24 
25 namespace mic {
26 namespace opengl {
27 namespace application {
28 
30  learning_iterations_to_test_ratio("learning_iterations_to_test_ratio", 50),
31  number_of_averaged_test_measures("number_of_averaged_test_measures", 5)
32 {
33  // Register properties - so their values can be overridden (read from the configuration file).
34  registerProperty(learning_iterations_to_test_ratio);
35  registerProperty(number_of_averaged_test_measures);
36 
37  // Reset learning iteration counter.
39 }
40 
42  // Check the iteration number and settings.
43  // If learning is on AND (NOT equal to learning_iterations_to_test_ratio) - learn!
44  if (((iteration % learning_iterations_to_test_ratio) != 0) && APP_STATE->isLearningModeOn()) {
45  // Perform learning.
46  return performLearningStep();
47  } else { // Else - test
48  // Perform testing.
49  return performTestingStep();
50  }//: else
51 }
52 
54  // Increment iteration number - at START!
56 
57  LOG(LDEBUG) << "iteration=" << iteration << "learning_iteration=" << learning_iteration << " learning_iteration % number_of_averaged_test_measures =" << learning_iteration % number_of_averaged_test_measures;
58 
59  // Perform testing - two phases.
61 
62  // If a given number of measures were collected - average them and populate (i.e. visualize).
64 
66  // Reset learning iteration counter.
68  }//: if iteration
69 
70  return true;
71 } //: if test mode (!learning)
72 
73 
74 } /* namespace application */
75 } /* namespace opengl */
76 } /* namespace mic */
An abstract class implementing basic functions for two-threaded, OpenGL-based applications. Introduces the execution phases that are typical for all learning/classification applications, imposes fine code granulation.
virtual bool performSingleStep(void)
Performs single step of computations - switches between learning and testing depending on the iterati...
mic::configuration::Property< unsigned int > learning_iterations_to_test_ratio
Number of learning steps after which a single classification test will be performed.
mic::configuration::Property< unsigned int > number_of_averaged_test_measures
Numbers of steps that will be averages.
unsigned long learning_iteration
Learning iteration counter - used in interlaces learning/testing mode.