Package adams.core

Class MOAHelper


  • public class MOAHelper
    extends Object
    Helper class for MOA related stuff.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Summary

      Constructors 
      Constructor Description
      MOAHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equalAttributes​(com.yahoo.labs.samoa.instances.Attribute attr1, com.yahoo.labs.samoa.instances.Attribute attr2)
      Checks to see if both attributes are the same.
      static boolean equalHeaders​(com.yahoo.labs.samoa.instances.Instances inst1, com.yahoo.labs.samoa.instances.Instances inst2)
      Checks to see if the headers for two instances are equal.
      static double[] fixVotes​(double[] votes, com.yahoo.labs.samoa.instances.Instance inst)
      Fixes the votes array if the length differs from the number of class labels defined in the header information of the dataset.
      static com.yahoo.labs.samoa.instances.Attribute toMOAAttribute​(weka.core.Attribute attribute)
      Converts a WEKA attribute to a MOA attribute.
      static com.yahoo.labs.samoa.instances.Instance toMOAInstance​(weka.core.Instance inst)
      Converts a WEKA instance into a MOA instance.
      static com.yahoo.labs.samoa.instances.Instances toMOAInstances​(weka.core.Instances instances)
      Converts a set of WEKA instances into a set of MOA instances.
      static weka.core.Attribute toWEKAAttribute​(com.yahoo.labs.samoa.instances.Attribute attribute)
      Converts a MOA attribute into a WEKA attribute.
      static weka.core.Instance toWEKAInstance​(com.yahoo.labs.samoa.instances.Instance inst)
      Converts a MOA instance into a WEKA instance.
      static weka.core.Instances toWEKAInstances​(com.yahoo.labs.samoa.instances.Instances instances)
      Converts a set of MOA instances into a set of WEKA instances.
    • Constructor Detail

      • MOAHelper

        public MOAHelper()
    • Method Detail

      • fixVotes

        public static double[] fixVotes​(double[] votes,
                                        com.yahoo.labs.samoa.instances.Instance inst)
        Fixes the votes array if the length differs from the number of class labels defined in the header information of the dataset.
        Parameters:
        votes - the votes to fix
        inst - the instance to get the dataset information from
        Returns:
        the (potentially) fixed votes array
      • toMOAInstances

        public static com.yahoo.labs.samoa.instances.Instances toMOAInstances​(weka.core.Instances instances)
        Converts a set of WEKA instances into a set of MOA instances.
        Parameters:
        instances - The WEKA instances to convert.
        Returns:
        The MOA instances.
      • toMOAInstance

        public static com.yahoo.labs.samoa.instances.Instance toMOAInstance​(weka.core.Instance inst)
        Converts a WEKA instance into a MOA instance.
        Parameters:
        inst - The WEKA instance to convert.
        Returns:
        A MOA instance.
      • toMOAAttribute

        public static com.yahoo.labs.samoa.instances.Attribute toMOAAttribute​(weka.core.Attribute attribute)
        Converts a WEKA attribute to a MOA attribute. Only handles nominal, numeric and date attributes.
        Parameters:
        attribute - The WEKA attribute to convert.
        Returns:
        The MOA attribute.
      • toWEKAInstances

        public static weka.core.Instances toWEKAInstances​(com.yahoo.labs.samoa.instances.Instances instances)
        Converts a set of MOA instances into a set of WEKA instances.
        Parameters:
        instances - The instances to convert.
        Returns:
        The WEKA instances.
      • toWEKAInstance

        public static weka.core.Instance toWEKAInstance​(com.yahoo.labs.samoa.instances.Instance inst)
        Converts a MOA instance into a WEKA instance.
        Parameters:
        inst - The MOA instance to convert.
        Returns:
        A WEKA instance.
      • toWEKAAttribute

        public static weka.core.Attribute toWEKAAttribute​(com.yahoo.labs.samoa.instances.Attribute attribute)
        Converts a MOA attribute into a WEKA attribute.
        Parameters:
        attribute - The MOA attribute to convert.
        Returns:
        The WEKA attribute.
      • equalHeaders

        public static boolean equalHeaders​(com.yahoo.labs.samoa.instances.Instances inst1,
                                           com.yahoo.labs.samoa.instances.Instances inst2)
        Checks to see if the headers for two instances are equal.
        Parameters:
        inst1 - One instance header.
        inst2 - The other instance header.
        Returns:
        Whether the headers are the same.
      • equalAttributes

        public static boolean equalAttributes​(com.yahoo.labs.samoa.instances.Attribute attr1,
                                              com.yahoo.labs.samoa.instances.Attribute attr2)
        Checks to see if both attributes are the same.
        Parameters:
        attr1 - One attribute to check.
        attr2 - The other attribute to check.
        Returns:
        Whether the attributes are the same.