Package rocca

Class RoccaClassifier

java.lang.Object
rocca.RoccaClassifier

public class RoccaClassifier extends Object
Rocca/Weka interface for classifying a contour

Author:
Michael Oswald
  • Field Details

  • Constructor Details

    • RoccaClassifier

      public RoccaClassifier(RoccaProcess roccaProcess)
      Create RoccaClassifier object for RoccaProcess

      Parameters:
      roccaProcess -
  • Method Details

    • classifyContour

      public void classifyContour(RoccaContourDataBlock rcdb)
      NO LONGER USED, since the addition of the RoccaRFModel object

      Classifies the passed contour

      Checks to make sure a classifier has been loaded, then runs the setAttributes method to match the passed contour to the parameter list expected by the classifier. Once the attribute vector has been created, the classifier is run and the results are saved to the datablock's classifiedAs field.

      Parameters:
      rcdb - RoccaContourDataBlock to be classified
    • classifyContour2

      public void classifyContour2(RoccaContourDataBlock rcdb)
      Classifies the passed contour

      Checks to make sure a classifier has been loaded, then calls the RoccaRFModel object to classify the contour. Clears the rcdb tree votes first, since the RccaRFModel object adds to the votes as it iterates through the different classifiers

      Parameters:
      rcdb - RoccaContourDataBlock to be classified
    • classifySighting

      public String classifySighting(String detectionHeader, String detectionStats)
      Use the event classifier to classify the current sighting
      Parameters:
      detectionStats - a String generated in the RoccaSidePanel object, containing
      Returns:
      the species classification
    • setUpClassifier

      public boolean setUpClassifier()
      Loads the Classifier model from the file specified in RoccaParameters
      Returns:
      boolean flag indicating success or failure of load
    • setAttributes

      public weka.core.DenseInstance setAttributes(RoccaContourDataBlock rcdb)
      Sets up the available datablock fields to match the classifier model

      Compares the fields in the passed RoccaContourDataBlack to the fields required for the classifier. If any fields are missing, an error is displayed and the method returns false. If all the fields are available, an Instance is created matching the order of the datablock fields to the order of the classifier fields.

      Parameters:
      rcdb - RoccaContourDataBlock to be classified
      Returns:
      Instance containing the values of the rcdb parameters that match the classifier attributes
    • setAttributes

      public weka.core.DenseInstance setAttributes(RoccaContourDataBlock rcdb, weka.core.Instances trainedDataset)
      Sets up the available datablock fields to match the classifier model

      Compares the fields in the passed RoccaContourDataBlack to the fields required for the classifier. If any fields are missing, an error is displayed and the method returns false. If all the fields are available, an Instance is created matching the order of the datablock fields to the order of the classifier fields.

      Parameters:
      rcdb - RoccaContourDataBlock to be classified
      trainedDataset - Instances containing the training data set
      Returns:
      Instance containing the values of the rcdb parameters that match the classifier attributes
    • areFieldsSet

      public boolean areFieldsSet()
    • setFieldsSet

      public void setFieldsSet(boolean fieldsSet)
    • getClassifierSpList

      public String[] getClassifierSpList()
      returns list of species classes. If variable is null, creates the list first
      Returns:
      String[] list of species
    • clearSpeciesList

      public void clearSpeciesList()
      Clears the species list for this classifier
    • generateSpList

      public String[] generateSpList()
      generates list of species classes. serialVersionUID = 24 2016/08/10 added check for whistle or click classifier 2021/05/11 instead of returning a null if we are not using classifiers, return a "No Classifier" species.
      Returns:
      String[] list of species
    • generateSpList_orig

      public String[] generateSpList_orig()
      generates list of species classes. If there are two classifiers, both lists will be combined into single list based on trigger class NOTE: this method is the original version, which loaded 2 separate classifier files. No longer used since RoccaRFModel class has been implemented, but I hate to delete the code...
      Returns:
      String[] list of species
    • getRFModel

      public RoccaRFModel getRFModel()
      Returns:
      the random forest model
    • setRFModel

      public void setRFModel(RoccaRFModel rfModel)
      Parameters:
      rfModel - the random forest Model to set