bodhidharma
Class ProgressBarTaskTrainMonitor

java.lang.Object
  extended by bodhidharma.utilities.LargeProgressBarTaskMonitor
      extended by bodhidharma.ProgressBarTaskTrainMonitor

public class ProgressBarTaskTrainMonitor
extends LargeProgressBarTaskMonitor

An implementation of the LargeProgressBarTaskMonitor abstract class. Trains ensembles of classifiers and provides information about training times. Provides information to a LargeProgressBarDialog object that is used to keep it updated.

Training is started by calling the go method. This will cause the processing in ActualTask to occur. ActualTask will keep the fields described in this class' superclass updated, which can be accessed using the methods in this class' superclass. The ActualTask simply makes use of a ClassificationPanel's performHierarchicalTraining method. The performAFoldOfTrainingAndClassification method of the ClassificationPanel can also be used to perform multiple folds.

The setProgressDialog method of an object of this class must be called externally to cancel training.

The startTopTask, startMiddleTask, startBottomTask, setBottomProgressValue, and markTaskComplete methods are called during training to keep an object of this class updated.

The isTrainingTimesAvailable, getMiddleTaskDurations, getBottomTaskDurations and getOverallTaskTime methods can be used after training to gain information about training times.

Note that the top, middle and bottom tasks are hierarchal, in the sense that one the top task is complete when all middle sub-tasks are complete, and a middle sub-task is complete when all its bottom sub-tasks are complete.

See Also:
LargeProgressBarTaskMonitor, ProgressBarDialog, SwingWorker, Recording, FeatureSet, RecordingsPanel
Author:
Cory McKay

Field Summary
 
Fields inherited from class bodhidharma.utilities.LargeProgressBarTaskMonitor
bottom_current_amount_completed, bottom_length_of_task, bottom_progress_message, bottom_time_started, middle_current_amount_completed, middle_length_of_task, middle_progress_message, middle_time_started, new_bottom_task_started, new_middle_task_started, new_top_task_started, task_canceled, task_completed, top_current_amount_completed, top_length_of_task, top_progress_message, top_time_started
 
Constructor Summary
ProgressBarTaskTrainMonitor(Recording[] all_eligible_recordings, boolean[] training_key, boolean report_training_results, ClassificationPanel classification_doer, boolean[][] multi_fold_training_keys, int multi_fold_current_fold)
          Basic constructor.
 
Method Summary
 java.lang.String[][][] getBottomTaskDurations(boolean want_raw_seconds)
          Returns the names and durations of each of the tasks appearing in the bottom progress text area.
 java.lang.String[][] getMiddleTaskDurations(boolean want_raw_seconds)
          Returns the names and durations of each of the tasks appearing in the middle progress text area.
 java.lang.String getOverallTaskTime(boolean want_raw_seconds)
          Returns the overall duration of the outer task.
 void go()
          Called from classification_doer to set up a SwingWorker thread that will initiate training.
 boolean isTrainingTimesAvailable()
          Returns whether or training times are available.
 void markTaskComplete()
          Called if the overall task is complete.
 void setBottomProgressValue(int progress_value)
          Update the progress of the bottom progress bar.
 void setProgressDialog(LargeProgressBarDialog training_indicator)
          Set the progress box so that it can be cancelled if an error occurs.
 void startBottomTask(int sub_tasks, java.lang.String message)
          Begin keeping track of a new bottom-level job with the given number of sub_tasks.
 void startMiddleTask(int sub_tasks, java.lang.String message)
          Begin keeping track of a new middle-level job with the given number of sub_tasks.
 void startTopTask(int sub_tasks, java.lang.String message)
          Begin keeping track of a new overall job with the given number of sub_tasks.
 
Methods inherited from class bodhidharma.utilities.LargeProgressBarTaskMonitor
findTimeWithProperUnits, getBottomCurrentAmountCompleted, getBottomLengthOfTask, getBottomTextMessage, getMiddleCurrentAmountCompleted, getMiddleLengthOfTask, getMiddleTextMessage, getTopCurrentAmountCompleted, getTopLengthOfTask, getTopTextMessage, isCancelled, isDone, startNewBottomProgress, startNewMiddleProgress, startNewTopProgress, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressBarTaskTrainMonitor

public ProgressBarTaskTrainMonitor(Recording[] all_eligible_recordings,
                                   boolean[] training_key,
                                   boolean report_training_results,
                                   ClassificationPanel classification_doer,
                                   boolean[][] multi_fold_training_keys,
                                   int multi_fold_current_fold)
Basic constructor. Same as superclass, and also sets fields needed to commence training.

Parameters:
all_eligible_recordings - Recordings that will be broken up into training and testing groups.
training_key - Which recordings are to be used for testing and which are to be used for training. Indice corresponds to that of the all_eligible_recordings parameter. Value of true means use for training. A value of null means that breakdown is randomly selected.
report_training_results - Whether or not training errors (i.e. classifier convergence) are reported. Overrides preferences settings.
classification_doer - ClassificationPanel used to perform training.
multi_fold_training_keys - Keys to be used in further folds. Null if only one fold in all is used.
multi_fold_current_fold - The current fold being processed if there are multiple folds. Value is irrelevant if there is only one fold in all.
Method Detail

go

public void go()
Called from classification_doer to set up a SwingWorker thread that will initiate training.

Specified by:
go in class LargeProgressBarTaskMonitor

setProgressDialog

public void setProgressDialog(LargeProgressBarDialog training_indicator)
Set the progress box so that it can be cancelled if an error occurs.


startTopTask

public void startTopTask(int sub_tasks,
                         java.lang.String message)
Begin keeping track of a new overall job with the given number of sub_tasks.


startMiddleTask

public void startMiddleTask(int sub_tasks,
                            java.lang.String message)
Begin keeping track of a new middle-level job with the given number of sub_tasks.


startBottomTask

public void startBottomTask(int sub_tasks,
                            java.lang.String message)
Begin keeping track of a new bottom-level job with the given number of sub_tasks.


setBottomProgressValue

public void setBottomProgressValue(int progress_value)
Update the progress of the bottom progress bar.


markTaskComplete

public void markTaskComplete()
Called if the overall task is complete. Stops processing and records final task times.

Overrides:
markTaskComplete in class LargeProgressBarTaskMonitor

isTrainingTimesAvailable

public boolean isTrainingTimesAvailable()
Returns whether or training times are available.


getMiddleTaskDurations

public java.lang.String[][] getMiddleTaskDurations(boolean want_raw_seconds)
Returns the names and durations of each of the tasks appearing in the middle progress text area. Last indice value of 0 for returned array corresponds to the name of a task and value of 2 to its duration.

Parameters:
want_raw_seconds - Task times reported in seconds if true, as formatted string if false.

getBottomTaskDurations

public java.lang.String[][][] getBottomTaskDurations(boolean want_raw_seconds)
Returns the names and durations of each of the tasks appearing in the bottom progress text area. First indice of returned array corresponds to the high level task, and the second to the lower level task for that high level task. A value of 0 for the third indice gives name of a task and the second its duration.

Parameters:
want_raw_seconds - Task times reported in seconds if true, as formatted string if false.

getOverallTaskTime

public java.lang.String getOverallTaskTime(boolean want_raw_seconds)
Returns the overall duration of the outer task.

Parameters:
want_raw_seconds - Time reported in seconds if true, as formatted string if false.