Class LogisticRegressionLearner

All Implemented Interfaces:
LogicalOperator

public class LogisticRegressionLearner extends CompositeOperator
Fits a multinomial logistic regression model to the training data. The output is a PMML model describing the resulting classification model.
  • Constructor Details

    • LogisticRegressionLearner

      public LogisticRegressionLearner()
  • Method Details

    • getLearningColumns

      public List<String> getLearningColumns()
      Returns:
      the field names of the columns containing the independent variables
    • setLearningColumns

      public void setLearningColumns(List<String> learningColumns)
      Controls which fields are treated as independent variables. Fields other than the learning and target columns are ignored
      Parameters:
      learningColumns - the names of the fields that are treated as independent variables.
    • getTargetColumn

      public String getTargetColumn()
      Returns:
      the field name of the dependent (predicted) variable.
    • setTargetColumn

      public void setTargetColumn(String targetColumn)
      Parameters:
      targetColumn - the field name of the desired dependent (predicted) variable.
    • getInput

      public RecordPort getInput()
      Returns:
      the input for training data
    • getModelOutput

      public PMMLPort getModelOutput()
      Returns:
      the main output, a ModelPort for a Logistic Regression model
    • getMaxDistinctNominalValues

      public int getMaxDistinctNominalValues()
      Returns the maximum number of distinct nominal values to allow. Attributes with more than this number of distinct values will be filtered from the model. The default is 1000.
      Returns:
      the maximum number of distinct nominal values to allow.
    • setMaxDistinctNominalValues

      public void setMaxDistinctNominalValues(int maxDistinctNominalValues)
      Sets the maximum number of distinct nominal values to allow. Attributes with more than this number of distinct values will be filtered from the model. The default is 1000.
    • compose

      protected void compose(CompositionContext ctx)
      Description copied from class: CompositeOperator
      Compose the body of this operator. Implementations should do the following:
      1. Perform any validation of configuration, input types, etc
      2. Instantiate and configure sub-operators, adding them to the provided context via the method OperatorComposable.add(O)
      3. Create necessary connections via the method OperatorComposable.connect(P, P). This includes connections from the composite's input ports to sub-operators, connections between sub-operators, and connections from sub-operators output ports to the composite's output ports
      Specified by:
      compose in class CompositeOperator
      Parameters:
      ctx - the context
    • getRidge

      public double getRidge()
      Returns:
      the regularization constant (a.k.a lambda)
    • setRidge

      public void setRidge(double ridge)
      Sets the regularization constant, lambda. The regularization constant penalizes very large coefficients and is sometimes necessary for convergence. The regularization constant MUST be at least 0 and less than 1 and SHOULD generally be small.
      Parameters:
      ridge - the desired regularization parameter.
      Throws:
      com.pervasive.datarush.graphs.physical.InvalidPropertyValueException - if ridge is not between 0 and 1.
    • getLearningRate

      public double getLearningRate()
      Gets the learning rate, alpha. Note that learning rates that are high enough to cause unstable behavior may be automatically reduced.
      Returns:
      the learning rate, alpha at the start of the computation.
    • setLearningRate

      public void setLearningRate(double learningRate)
      Set the learning rate that should be used at the start of the computation. This is a maximum value; the algorithm may reduce the learning rate if it is likely to result in divergence. The learning rate MUST be positive (or the algorithm won't work) and SHOULD be less than one (or it will probably diverge or waste time before being adjusted to something reasonable.)
      Parameters:
      learningRate - the learning rate alpha that should be used at the start of the computation.
      Throws:
      com.pervasive.datarush.graphs.physical.InvalidPropertyValueException - if the learning rate is set to 0 or less.
    • getMaxIterations

      public int getMaxIterations()
      Returns:
      the maximum number of iterations attempted before generating a model
    • setMaxIterations

      public void setMaxIterations(int maxIterations)
      Control the maximum number of iterations attempted before generating a model. In general, the number of iterations should be directly proportional to the available time and inversely proportional to the size of the data. (Note also that automatically adjusting the learning rate may require a full iteration)
      Parameters:
      maxIterations - the desired maximum number of passes over the dataset
      Throws:
      com.pervasive.datarush.graphs.physical.InvalidPropertyValueException - if maxIterations is set to a negative value
    • getTolerance

      public double getTolerance()
      Returns:
      the strictness of the convergence criterion, as a fraction of the total length of the coefficient vector.
    • setTolerance

      public void setTolerance(double threshold)
      Sets the strictness of the convergence criterion, as a fraction of the total length of the coefficient vector. Note that a threshold much higher than the learning rate (> alpha*sqrt(# training examples)), or larger than 1, is very likely to result in premature convergence detection. Set to 0 for a single-full-pass algorithm.
      Parameters:
      threshold - the desired convergence threshold
      Throws:
      com.pervasive.datarush.graphs.physical.InvalidPropertyValueException - if threshold is negative
    • getSeed

      public long getSeed()
      Returns:
      the randomness seed used by the algorithm.
    • setSeed

      public void setSeed(long seed)
      Sets the seed for the random numbers used by the algorithm. The main use of the seed is to randomly reorder the input. Note that even with the same seed, results may vary based on engine settings such as the number of partitions.
      Parameters:
      seed - the desired base seed for the random number generator