Module datarush.analytics
Class LogisticRegressionLearner
- java.lang.Object
- 
- com.pervasive.datarush.operators.AbstractLogicalOperator
- 
- com.pervasive.datarush.operators.CompositeOperator
- 
- com.pervasive.datarush.analytics.regression.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 SummaryConstructors Constructor Description LogisticRegressionLearner()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcompose(CompositionContext ctx)Compose the body of this operator.RecordPortgetInput()List<String>getLearningColumns()doublegetLearningRate()Gets the learning rate, alpha.intgetMaxDistinctNominalValues()Returns the maximum number of distinct nominal values to allow.intgetMaxIterations()PMMLPortgetModelOutput()doublegetRidge()longgetSeed()StringgetTargetColumn()doublegetTolerance()voidsetLearningColumns(List<String> learningColumns)Controls which fields are treated as independent variables.voidsetLearningRate(double learningRate)Set the learning rate that should be used at the start of the computation.voidsetMaxDistinctNominalValues(int maxDistinctNominalValues)Sets the maximum number of distinct nominal values to allow.voidsetMaxIterations(int maxIterations)Control the maximum number of iterations attempted before generating a model.voidsetRidge(double ridge)Sets the regularization constant, lambda.voidsetSeed(long seed)Sets the seed for the random numbers used by the algorithm.voidsetTargetColumn(String targetColumn)voidsetTolerance(double threshold)Sets the strictness of the convergence criterion, as a fraction of the total length of the coefficient vector.- 
Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperatordisableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
 
- 
 
- 
- 
- 
Method Detail- 
getLearningColumnspublic List<String> getLearningColumns() - Returns:
- the field names of the columns containing the independent variables
 
 - 
setLearningColumnspublic 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.
 
 - 
getTargetColumnpublic String getTargetColumn() - Returns:
- the field name of the dependent (predicted) variable.
 
 - 
setTargetColumnpublic void setTargetColumn(String targetColumn) - Parameters:
- targetColumn- the field name of the desired dependent (predicted) variable.
 
 - 
getInputpublic RecordPort getInput() - Returns:
- the input for training data
 
 - 
getModelOutputpublic PMMLPort getModelOutput() - Returns:
- the main output, a ModelPort for a Logistic Regression model
 
 - 
getMaxDistinctNominalValuespublic 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.
 
 - 
setMaxDistinctNominalValuespublic 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.
 - 
composeprotected void compose(CompositionContext ctx) Description copied from class:CompositeOperatorCompose the body of this operator. Implementations should do the following:- Perform any validation of configuration, input types, etc
- Instantiate and configure sub-operators, adding them to the provided context via
    the method OperatorComposable.add(O)
- 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:
- composein class- CompositeOperator
- Parameters:
- ctx- the context
 
 - 
getRidgepublic double getRidge() - Returns:
- the regularization constant (a.k.a lambda)
 
 - 
setRidgepublic 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.
 
 - 
getLearningRatepublic 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.
 
 - 
setLearningRatepublic 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.
 
 - 
getMaxIterationspublic int getMaxIterations() - Returns:
- the maximum number of iterations attempted before generating a model
 
 - 
setMaxIterationspublic 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
 
 - 
getTolerancepublic double getTolerance() - Returns:
- the strictness of the convergence criterion, as a fraction of the total length of the coefficient vector.
 
 - 
setTolerancepublic 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
 
 - 
getSeedpublic long getSeed() - Returns:
- the randomness seed used by the algorithm.
 
 - 
setSeedpublic 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
 
 
- 
 
-