Class ContinuousDiscretizationSpec

java.lang.Object
edu.cmu.tetrad.data.ContinuousDiscretizationSpec
All Implemented Interfaces:
DiscretizationSpec, TetradSerializable, Serializable

public final class ContinuousDiscretizationSpec extends Object implements TetradSerializable, DiscretizationSpec
Specifies how a column (continuous or discrete) should be discretized. For a discrete column the mapping is int[] remap; for a continuous column the mapping is double[] cutoffs. The categories are the string labels for the categories. This is just a small immutable class that columns can map to in order to remember how discretizations were done so that the user doesn't have to keep typing in information over and over again.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Field Details

    • EVENLY_DISTRIBUTED_VALUES

      public static final int EVENLY_DISTRIBUTED_VALUES
      The types of discretization
      See Also:
    • EVENLY_DISTRIBUTED_INTERVALS

      public static final int EVENLY_DISTRIBUTED_INTERVALS
      Constant EVENLY_DISTRIBUTED_INTERVALS=2
      See Also:
    • NONE

      public static final int NONE
      Constant NONE=3
      See Also:
  • Constructor Details

    • ContinuousDiscretizationSpec

      public ContinuousDiscretizationSpec(double[] breakpoints, List<String> categories)
      Constructor for creating a ContinuousDiscretizationSpec object.
      Parameters:
      breakpoints - The array of breakpoints used for discretization.
      categories - The list of categories for the discretized data.
    • ContinuousDiscretizationSpec

      public ContinuousDiscretizationSpec(double[] breakpoints, List<String> categories, int method)
      Creates a ContinuousDiscretizationSpec object with the given breakpoints, categories, and method.
      Parameters:
      breakpoints - The array of breakpoints used for discretization.
      categories - The list of categories for the discretized data.
      method - The method used for discretization. Possible values are: - EVENLY_DISTRIBUTED_VALUES: 0 (evenly distributed values) - EVENLY_DISTRIBUTED_INTERVALS: 1 (evenly distributed intervals) - NONE: 2 (no discretization)
      Throws:
      NullPointerException - if breakpoints is null.
      IllegalArgumentException - if method is not one of the valid values.
  • Method Details

    • serializableInstance

      public static DiscretizationSpec serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a DiscretizationSpec object
    • getMethod

      public int getMethod()
      Returns the value of the method used for discretization.
      Returns:
      The method used for discretization.
    • setMethod

      public void setMethod(int method)
      Sets the method used for discretization.
      Parameters:
      method - The method used for discretization. Possible values are: - ContinuousDiscretizationSpec.EVENLY_DISTRIBUTED_VALUES (0): for evenly distributed values - ContinuousDiscretizationSpec.EVENLY_DISTRIBUTED_INTERVALS (1): for evenly distributed intervals - ContinuousDiscretizationSpec.NONE (2): for no discretization
      Throws:
      IllegalArgumentException - if method is not one of the valid values.
    • getCategories

      public List<String> getCategories()
      Retrieves the list of categories for the discretized data.
      Returns:
      The list of categories.
    • getBreakpoints

      public double[] getBreakpoints()
      Retrieves the array of breakpoints used for discretization.
      Returns:
      The array of breakpoints.