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 Link icon

  • Constructor Details Link icon

    • RoccaClassifier Link icon

      public RoccaClassifier(RoccaProcess roccaProcess)
      Create RoccaClassifier object for RoccaProcess

      Parameters:
      roccaProcess -
  • Method Details Link icon

    • classifyContour Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

      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 Link icon

      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 Link icon

      public boolean areFieldsSet()
    • setFieldsSet Link icon

      public void setFieldsSet(boolean fieldsSet)
    • getClassifierSpList Link icon

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

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

      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 Link icon

      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 Link icon

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

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