ai.h2o.sparkling.ml.params.H2OGLMParams.scala Maven / Gradle / Ivy
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ai.h2o.sparkling.ml.params
import hex.glm.GLMModel.GLMParameters
import ai.h2o.sparkling.H2OFrame
import hex.glm.GLMModel.GLMParameters.Family
import hex.glm.GLMModel.GLMParameters.Solver
import hex.glm.GLMModel.GLMParameters.MissingValuesHandling
import hex.glm.GLMModel.GLMParameters.Influence
import hex.glm.GLMModel.GLMParameters.Link
import hex.glm.GLMModel.GLMParameters.DispersionMethod
import hex.Model.Parameters.FoldAssignmentScheme
import hex.ScoreKeeper.StoppingMetric
import hex.MultinomialAucType
trait H2OGLMParams
extends H2OAlgoParamsBase
with HasRandomCols
with HasIgnoredCols
with HasPlugValues
with HasBetaConstraints
with HasInteractionPairs
with HasLinearConstraints {
protected def paramTag = reflect.classTag[GLMParameters]
//
// Parameter definitions
//
protected val seed = longParam(
name = "seed",
doc = """Seed for pseudo random number generator (if applicable).""")
protected val family = stringParam(
name = "family",
doc = """Family. Use binomial for classification with logistic regression, others are for regression problems. Possible values are ``"AUTO"``, ``"gaussian"``, ``"binomial"``, ``"fractionalbinomial"``, ``"quasibinomial"``, ``"poisson"``, ``"gamma"``, ``"multinomial"``, ``"tweedie"``, ``"ordinal"``, ``"negativebinomial"``.""")
protected val randomFamily = nullableStringArrayParam(
name = "randomFamily",
doc = """Random Component Family array. One for each random component. Only support gaussian for now. Possible values are ``"AUTO"``, ``"gaussian"``, ``"binomial"``, ``"fractionalbinomial"``, ``"quasibinomial"``, ``"poisson"``, ``"gamma"``, ``"multinomial"``, ``"tweedie"``, ``"ordinal"``, ``"negativebinomial"``.""")
protected val tweedieVariancePower = doubleParam(
name = "tweedieVariancePower",
doc = """Tweedie variance power.""")
protected val dispersionLearningRate = doubleParam(
name = "dispersionLearningRate",
doc = """Dispersion learning rate is only valid for tweedie family dispersion parameter estimation using ml. It must be > 0. This controls how much the dispersion parameter estimate is to be changed when the calculated loglikelihood actually decreases with the new dispersion. In this case, instead of setting new dispersion = dispersion + change, we set new dispersion = dispersion + dispersion_learning_rate * change. Defaults to 0.5.""")
protected val tweedieLinkPower = doubleParam(
name = "tweedieLinkPower",
doc = """Tweedie link power.""")
protected val theta = doubleParam(
name = "theta",
doc = """Theta.""")
protected val solver = stringParam(
name = "solver",
doc = """AUTO will set the solver based on given data and the other parameters. IRLSM is fast on on problems with small number of predictors and for lambda-search with L1 penalty, L_BFGS scales better for datasets with many columns. Possible values are ``"AUTO"``, ``"IRLSM"``, ``"L_BFGS"``, ``"COORDINATE_DESCENT_NAIVE"``, ``"COORDINATE_DESCENT"``, ``"GRADIENT_DESCENT_LH"``, ``"GRADIENT_DESCENT_SQERR"``.""")
protected val alphaValue = nullableDoubleArrayParam(
name = "alphaValue",
doc = """Distribution of regularization between the L1 (Lasso) and L2 (Ridge) penalties. A value of 1 for alpha represents Lasso regression, a value of 0 produces Ridge regression, and anything in between specifies the amount of mixing between the two. Default value of alpha is 0 when SOLVER = 'L-BFGS'; 0.5 otherwise.""")
protected val lambdaValue = nullableDoubleArrayParam(
name = "lambdaValue",
doc = """Regularization strength.""")
protected val lambdaSearch = booleanParam(
name = "lambdaSearch",
doc = """Use lambda search starting at lambda max, given lambda is then interpreted as lambda min.""")
protected val earlyStopping = booleanParam(
name = "earlyStopping",
doc = """Stop early when there is no more relative improvement on train or validation (if provided).""")
protected val nlambdas = intParam(
name = "nlambdas",
doc = """Number of lambdas to be used in a search. Default indicates: If alpha is zero, with lambda search set to True, the value of nlamdas is set to 30 (fewer lambdas are needed for ridge regression) otherwise it is set to 100.""")
protected val scoreIterationInterval = intParam(
name = "scoreIterationInterval",
doc = """Perform scoring for every score_iteration_interval iterations.""")
protected val standardize = booleanParam(
name = "standardize",
doc = """Standardize numeric columns to have zero mean and unit variance.""")
protected val coldStart = booleanParam(
name = "coldStart",
doc = """Only applicable to multiple alpha/lambda values. If false, build the next model for next set of alpha/lambda values starting from the values provided by current model. If true will start GLM model from scratch.""")
protected val missingValuesHandling = stringParam(
name = "missingValuesHandling",
doc = """Handling of missing values. Either MeanImputation, Skip or PlugValues. Possible values are ``"MeanImputation"``, ``"PlugValues"``, ``"Skip"``.""")
protected val influence = nullableStringParam(
name = "influence",
doc = """If set to dfbetas will calculate the difference in beta when a datarow is included and excluded in the dataset. Possible values are ``"dfbetas"``.""")
protected val nonNegative = booleanParam(
name = "nonNegative",
doc = """Restrict coefficients (not intercept) to be non-negative.""")
protected val maxIterations = intParam(
name = "maxIterations",
doc = """Maximum number of iterations. Value should >=1. A value of 0 is only set when only the model coefficient names and model coefficient dimensions are needed.""")
protected val betaEpsilon = doubleParam(
name = "betaEpsilon",
doc = """Converge if beta changes less (using L-infinity norm) than beta esilon. ONLY applies to IRLSM solver.""")
protected val objectiveEpsilon = doubleParam(
name = "objectiveEpsilon",
doc = """Converge if objective value changes less than this. Default (of -1.0) indicates: If lambda_search is set to True the value of objective_epsilon is set to .0001. If the lambda_search is set to False and lambda is equal to zero, the value of objective_epsilon is set to .000001, for any other value of lambda the default value of objective_epsilon is set to .0001.""")
protected val gradientEpsilon = doubleParam(
name = "gradientEpsilon",
doc = """Converge if objective changes less (using L-infinity norm) than this, ONLY applies to L-BFGS solver. Default (of -1.0) indicates: If lambda_search is set to False and lambda is equal to zero, the default value of gradient_epsilon is equal to .000001, otherwise the default value is .0001. If lambda_search is set to True, the conditional values above are 1E-8 and 1E-6 respectively.""")
protected val objReg = doubleParam(
name = "objReg",
doc = """Likelihood divider in objective value computation, default (of -1.0) will set it to 1/nobs.""")
protected val link = stringParam(
name = "link",
doc = """Link function. Possible values are ``"family_default"``, ``"identity"``, ``"logit"``, ``"log"``, ``"inverse"``, ``"tweedie"``, ``"multinomial"``, ``"ologit"``, ``"oprobit"``, ``"ologlog"``.""")
protected val dispersionParameterMethod = stringParam(
name = "dispersionParameterMethod",
doc = """Method used to estimate the dispersion parameter for Tweedie, Gamma and Negative Binomial only. Possible values are ``"pearson"``, ``"ml"``, ``"deviance"``.""")
protected val randomLink = nullableStringArrayParam(
name = "randomLink",
doc = """Link function array for random component in HGLM. Possible values are ``"family_default"``, ``"identity"``, ``"logit"``, ``"log"``, ``"inverse"``, ``"tweedie"``, ``"multinomial"``, ``"ologit"``, ``"oprobit"``, ``"ologlog"``.""")
protected val startval = nullableDoubleArrayParam(
name = "startval",
doc = """double array to initialize fixed and random coefficients for HGLM, coefficients for GLM. If standardize is true, the standardized coefficients should be used. Otherwise, use the regular coefficients.""")
protected val calcLike = booleanParam(
name = "calcLike",
doc = """if true, will return likelihood function value.""")
protected val generateVariableInflationFactors = booleanParam(
name = "generateVariableInflationFactors",
doc = """if true, will generate variable inflation factors for numerical predictors. Default to false.""")
protected val intercept = booleanParam(
name = "intercept",
doc = """Include constant term in the model.""")
protected val buildNullModel = booleanParam(
name = "buildNullModel",
doc = """If set, will build a model with only the intercept. Default to false.""")
protected val fixDispersionParameter = booleanParam(
name = "fixDispersionParameter",
doc = """Only used for Tweedie, Gamma and Negative Binomial GLM. If set, will use the dispsersion parameter in init_dispersion_parameter as the standard error and use it to calculate the p-values. Default to false.""")
protected val initDispersionParameter = doubleParam(
name = "initDispersionParameter",
doc = """Only used for Tweedie, Gamma and Negative Binomial GLM. Store the initial value of dispersion parameter. If fix_dispersion_parameter is set, this value will be used in the calculation of p-values.""")
protected val HGLM = booleanParam(
name = "HGLM",
doc = """If set to true, will return HGLM model. Otherwise, normal GLM model will be returned.""")
protected val prior = doubleParam(
name = "prior",
doc = """Prior probability for y==1. To be used only for logistic regression iff the data has been sampled and the mean of response does not reflect reality.""")
protected val lambdaMinRatio = doubleParam(
name = "lambdaMinRatio",
doc = """Minimum lambda used in lambda search, specified as a ratio of lambda_max (the smallest lambda that drives all coefficients to zero). Default indicates: if the number of observations is greater than the number of variables, then lambda_min_ratio is set to 0.0001; if the number of observations is less than the number of variables, then lambda_min_ratio is set to 0.01.""")
protected val maxActivePredictors = intParam(
name = "maxActivePredictors",
doc = """Maximum number of active predictors during computation. Use as a stopping criterion to prevent expensive model building with many predictors. Default indicates: If the IRLSM solver is used, the value of max_active_predictors is set to 5000 otherwise it is set to 100000000.""")
protected val interactions = nullableStringArrayParam(
name = "interactions",
doc = """A list of predictor column indices to interact. All pairwise combinations will be computed for the list.""")
protected val balanceClasses = booleanParam(
name = "balanceClasses",
doc = """Balance training data class counts via over/under-sampling (for imbalanced data).""")
protected val classSamplingFactors = nullableFloatArrayParam(
name = "classSamplingFactors",
doc = """Desired over/under-sampling ratios per class (in lexicographic order). If not specified, sampling factors will be automatically computed to obtain class balance during training. Requires balance_classes.""")
protected val maxAfterBalanceSize = floatParam(
name = "maxAfterBalanceSize",
doc = """Maximum relative size of the training data after balancing class counts (can be less than 1.0). Requires balance_classes.""")
protected val maxConfusionMatrixSize = intParam(
name = "maxConfusionMatrixSize",
doc = """[Deprecated] Maximum size (# classes) for confusion matrices to be printed in the Logs.""")
protected val computePValues = booleanParam(
name = "computePValues",
doc = """Request p-values computation, p-values work only with IRLSM solver.""")
protected val fixTweedieVariancePower = booleanParam(
name = "fixTweedieVariancePower",
doc = """If true, will fix tweedie variance power value to the value set in tweedie_variance_power.""")
protected val removeCollinearCols = booleanParam(
name = "removeCollinearCols",
doc = """In case of linearly dependent columns, remove the dependent columns.""")
protected val dispersionEpsilon = doubleParam(
name = "dispersionEpsilon",
doc = """If changes in dispersion parameter estimation or loglikelihood value is smaller than dispersion_epsilon, will break out of the dispersion parameter estimation loop using maximum likelihood.""")
protected val tweedieEpsilon = doubleParam(
name = "tweedieEpsilon",
doc = """In estimating tweedie dispersion parameter using maximum likelihood, this is used to choose the lower and upper indices in the approximating of the infinite series summation.""")
protected val maxIterationsDispersion = intParam(
name = "maxIterationsDispersion",
doc = """Control the maximum number of iterations in the dispersion parameter estimation loop using maximum likelihood.""")
protected val generateScoringHistory = booleanParam(
name = "generateScoringHistory",
doc = """If set to true, will generate scoring history for GLM. This may significantly slow down the algo.""")
protected val initOptimalGlm = booleanParam(
name = "initOptimalGlm",
doc = """If true, will initialize coefficients with values derived from GLM runs without linear constraints. Only available for linear constraints.""")
protected val separateLinearBeta = booleanParam(
name = "separateLinearBeta",
doc = """If true, will keep the beta constraints and linear constraints separate. After new coefficients are found, first beta constraints will be applied followed by the application of linear constraints. Note that the beta constraints in this case will not be part of the objective function. If false, will combine the beta and linear constraints.""")
protected val constraintEta0 = doubleParam(
name = "constraintEta0",
doc = """For constrained GLM only. It affects the setting of eta_k+1=eta_0/power(ck+1, alpha).""")
protected val constraintTau = doubleParam(
name = "constraintTau",
doc = """For constrained GLM only. It affects the setting of c_k+1=tau*c_k.""")
protected val constraintAlpha = doubleParam(
name = "constraintAlpha",
doc = """For constrained GLM only. It affects the setting of eta_k = eta_0/pow(c_0, alpha).""")
protected val constraintBeta = doubleParam(
name = "constraintBeta",
doc = """For constrained GLM only. It affects the setting of eta_k+1 = eta_k/pow(c_k, beta).""")
protected val constraintC0 = doubleParam(
name = "constraintC0",
doc = """For constrained GLM only. It affects the initial setting of epsilon_k = 1/c_0.""")
protected val modelId = nullableStringParam(
name = "modelId",
doc = """Destination id for this model; auto-generated if not specified.""")
protected val nfolds = intParam(
name = "nfolds",
doc = """Number of folds for K-fold cross-validation (0 to disable or >= 2).""")
protected val keepCrossValidationModels = booleanParam(
name = "keepCrossValidationModels",
doc = """Whether to keep the cross-validation models.""")
protected val keepCrossValidationPredictions = booleanParam(
name = "keepCrossValidationPredictions",
doc = """Whether to keep the predictions of the cross-validation models.""")
protected val keepCrossValidationFoldAssignment = booleanParam(
name = "keepCrossValidationFoldAssignment",
doc = """Whether to keep the cross-validation fold assignment.""")
protected val labelCol = stringParam(
name = "labelCol",
doc = """Response variable column.""")
protected val weightCol = nullableStringParam(
name = "weightCol",
doc = """Column with observation weights. Giving some observation a weight of zero is equivalent to excluding it from the dataset; giving an observation a relative weight of 2 is equivalent to repeating that row twice. Negative weights are not allowed. Note: Weights are per-row observation weights and do not increase the size of the data frame. This is typically the number of times a row is repeated, but non-integer values are supported as well. During training, rows with higher weights matter more, due to the larger loss function pre-factor. If you set weight = 0 for a row, the returned prediction frame at that row is zero and this is incorrect. To get an accurate prediction, remove all rows with weight == 0.""")
protected val offsetCol = nullableStringParam(
name = "offsetCol",
doc = """Offset column. This will be added to the combination of columns before applying the link function.""")
protected val foldCol = nullableStringParam(
name = "foldCol",
doc = """Column with cross-validation fold index assignment per observation.""")
protected val foldAssignment = stringParam(
name = "foldAssignment",
doc = """Cross-validation fold assignment scheme, if fold_column is not specified. The 'Stratified' option will stratify the folds based on the response variable, for classification problems. Possible values are ``"AUTO"``, ``"Random"``, ``"Modulo"``, ``"Stratified"``.""")
protected val ignoreConstCols = booleanParam(
name = "ignoreConstCols",
doc = """Ignore constant columns.""")
protected val scoreEachIteration = booleanParam(
name = "scoreEachIteration",
doc = """Whether to score during each iteration of model training.""")
protected val checkpoint = nullableStringParam(
name = "checkpoint",
doc = """Model checkpoint to resume training with.""")
protected val stoppingRounds = intParam(
name = "stoppingRounds",
doc = """Early stopping based on convergence of stopping_metric. Stop if simple moving average of length k of the stopping_metric does not improve for k:=stopping_rounds scoring events (0 to disable).""")
protected val maxRuntimeSecs = doubleParam(
name = "maxRuntimeSecs",
doc = """Maximum allowed runtime in seconds for model training. Use 0 to disable.""")
protected val stoppingMetric = stringParam(
name = "stoppingMetric",
doc = """Metric to use for early stopping (AUTO: logloss for classification, deviance for regression and anomaly_score for Isolation Forest). Note that custom and custom_increasing can only be used in GBM and DRF with the Python client. Possible values are ``"AUTO"``, ``"deviance"``, ``"logloss"``, ``"MSE"``, ``"RMSE"``, ``"MAE"``, ``"RMSLE"``, ``"AUC"``, ``"AUCPR"``, ``"lift_top_group"``, ``"misclassification"``, ``"mean_per_class_error"``, ``"anomaly_score"``, ``"AUUC"``, ``"ATE"``, ``"ATT"``, ``"ATC"``, ``"qini"``, ``"custom"``, ``"custom_increasing"``.""")
protected val stoppingTolerance = doubleParam(
name = "stoppingTolerance",
doc = """Relative tolerance for metric-based stopping criterion (stop if relative improvement is not at least this much).""")
protected val gainsliftBins = intParam(
name = "gainsliftBins",
doc = """Gains/Lift table number of bins. 0 means disabled.. Default value -1 means automatic binning.""")
protected val customMetricFunc = nullableStringParam(
name = "customMetricFunc",
doc = """Reference to custom evaluation function, format: `language:keyName=funcName`.""")
protected val exportCheckpointsDir = nullableStringParam(
name = "exportCheckpointsDir",
doc = """Automatically export generated models to this directory.""")
protected val aucType = stringParam(
name = "aucType",
doc = """Set default multinomial AUC type. Possible values are ``"AUTO"``, ``"NONE"``, ``"MACRO_OVR"``, ``"WEIGHTED_OVR"``, ``"MACRO_OVO"``, ``"WEIGHTED_OVO"``.""")
//
// Default values
//
setDefault(
seed -> -1L,
family -> Family.AUTO.name(),
randomFamily -> null,
tweedieVariancePower -> 0.0,
dispersionLearningRate -> 0.5,
tweedieLinkPower -> 1.0,
theta -> 1.0e-10,
solver -> Solver.AUTO.name(),
alphaValue -> null,
lambdaValue -> null,
lambdaSearch -> false,
earlyStopping -> true,
nlambdas -> -1,
scoreIterationInterval -> -1,
standardize -> true,
coldStart -> false,
missingValuesHandling -> MissingValuesHandling.MeanImputation.name(),
influence -> null,
nonNegative -> false,
maxIterations -> -1,
betaEpsilon -> 1.0e-4,
objectiveEpsilon -> -1.0,
gradientEpsilon -> -1.0,
objReg -> -1.0,
link -> Link.family_default.name(),
dispersionParameterMethod -> DispersionMethod.pearson.name(),
randomLink -> null,
startval -> null,
calcLike -> false,
generateVariableInflationFactors -> false,
intercept -> true,
buildNullModel -> false,
fixDispersionParameter -> false,
initDispersionParameter -> 1.0,
HGLM -> false,
prior -> -1.0,
lambdaMinRatio -> -1.0,
maxActivePredictors -> -1,
interactions -> null,
balanceClasses -> false,
classSamplingFactors -> null,
maxAfterBalanceSize -> 5.0f,
maxConfusionMatrixSize -> 20,
computePValues -> false,
fixTweedieVariancePower -> true,
removeCollinearCols -> false,
dispersionEpsilon -> 1.0e-4,
tweedieEpsilon -> 8.0e-17,
maxIterationsDispersion -> 3000,
generateScoringHistory -> false,
initOptimalGlm -> false,
separateLinearBeta -> false,
constraintEta0 -> 0.1258925,
constraintTau -> 10.0,
constraintAlpha -> 0.1,
constraintBeta -> 0.9,
constraintC0 -> 10.0,
modelId -> null,
nfolds -> 0,
keepCrossValidationModels -> true,
keepCrossValidationPredictions -> false,
keepCrossValidationFoldAssignment -> false,
labelCol -> "label",
weightCol -> null,
offsetCol -> null,
foldCol -> null,
foldAssignment -> FoldAssignmentScheme.AUTO.name(),
ignoreConstCols -> true,
scoreEachIteration -> false,
checkpoint -> null,
stoppingRounds -> 0,
maxRuntimeSecs -> 0.0,
stoppingMetric -> StoppingMetric.AUTO.name(),
stoppingTolerance -> 0.001,
gainsliftBins -> -1,
customMetricFunc -> null,
exportCheckpointsDir -> null,
aucType -> MultinomialAucType.AUTO.name())
//
// Getters
//
def getSeed(): Long = $(seed)
def getFamily(): String = $(family)
def getRandomFamily(): Array[String] = $(randomFamily)
def getTweedieVariancePower(): Double = $(tweedieVariancePower)
def getDispersionLearningRate(): Double = $(dispersionLearningRate)
def getTweedieLinkPower(): Double = $(tweedieLinkPower)
def getTheta(): Double = $(theta)
def getSolver(): String = $(solver)
def getAlphaValue(): Array[Double] = $(alphaValue)
def getLambdaValue(): Array[Double] = $(lambdaValue)
def getLambdaSearch(): Boolean = $(lambdaSearch)
def getEarlyStopping(): Boolean = $(earlyStopping)
def getNlambdas(): Int = $(nlambdas)
def getScoreIterationInterval(): Int = $(scoreIterationInterval)
def getStandardize(): Boolean = $(standardize)
def getColdStart(): Boolean = $(coldStart)
def getMissingValuesHandling(): String = $(missingValuesHandling)
def getInfluence(): String = $(influence)
def getNonNegative(): Boolean = $(nonNegative)
def getMaxIterations(): Int = $(maxIterations)
def getBetaEpsilon(): Double = $(betaEpsilon)
def getObjectiveEpsilon(): Double = $(objectiveEpsilon)
def getGradientEpsilon(): Double = $(gradientEpsilon)
def getObjReg(): Double = $(objReg)
def getLink(): String = $(link)
def getDispersionParameterMethod(): String = $(dispersionParameterMethod)
def getRandomLink(): Array[String] = $(randomLink)
def getStartval(): Array[Double] = $(startval)
def getCalcLike(): Boolean = $(calcLike)
def getGenerateVariableInflationFactors(): Boolean = $(generateVariableInflationFactors)
def getIntercept(): Boolean = $(intercept)
def getBuildNullModel(): Boolean = $(buildNullModel)
def getFixDispersionParameter(): Boolean = $(fixDispersionParameter)
def getInitDispersionParameter(): Double = $(initDispersionParameter)
def getHGLM(): Boolean = $(HGLM)
def getPrior(): Double = $(prior)
def getLambdaMinRatio(): Double = $(lambdaMinRatio)
def getMaxActivePredictors(): Int = $(maxActivePredictors)
def getInteractions(): Array[String] = $(interactions)
def getBalanceClasses(): Boolean = $(balanceClasses)
def getClassSamplingFactors(): Array[Float] = $(classSamplingFactors)
def getMaxAfterBalanceSize(): Float = $(maxAfterBalanceSize)
def getMaxConfusionMatrixSize(): Int = $(maxConfusionMatrixSize)
def getComputePValues(): Boolean = $(computePValues)
def getFixTweedieVariancePower(): Boolean = $(fixTweedieVariancePower)
def getRemoveCollinearCols(): Boolean = $(removeCollinearCols)
def getDispersionEpsilon(): Double = $(dispersionEpsilon)
def getTweedieEpsilon(): Double = $(tweedieEpsilon)
def getMaxIterationsDispersion(): Int = $(maxIterationsDispersion)
def getGenerateScoringHistory(): Boolean = $(generateScoringHistory)
def getInitOptimalGlm(): Boolean = $(initOptimalGlm)
def getSeparateLinearBeta(): Boolean = $(separateLinearBeta)
def getConstraintEta0(): Double = $(constraintEta0)
def getConstraintTau(): Double = $(constraintTau)
def getConstraintAlpha(): Double = $(constraintAlpha)
def getConstraintBeta(): Double = $(constraintBeta)
def getConstraintC0(): Double = $(constraintC0)
def getModelId(): String = $(modelId)
def getNfolds(): Int = $(nfolds)
def getKeepCrossValidationModels(): Boolean = $(keepCrossValidationModels)
def getKeepCrossValidationPredictions(): Boolean = $(keepCrossValidationPredictions)
def getKeepCrossValidationFoldAssignment(): Boolean = $(keepCrossValidationFoldAssignment)
def getLabelCol(): String = $(labelCol)
def getWeightCol(): String = $(weightCol)
def getOffsetCol(): String = $(offsetCol)
def getFoldCol(): String = $(foldCol)
def getFoldAssignment(): String = $(foldAssignment)
def getIgnoreConstCols(): Boolean = $(ignoreConstCols)
def getScoreEachIteration(): Boolean = $(scoreEachIteration)
def getCheckpoint(): String = $(checkpoint)
def getStoppingRounds(): Int = $(stoppingRounds)
def getMaxRuntimeSecs(): Double = $(maxRuntimeSecs)
def getStoppingMetric(): String = $(stoppingMetric)
def getStoppingTolerance(): Double = $(stoppingTolerance)
def getGainsliftBins(): Int = $(gainsliftBins)
def getCustomMetricFunc(): String = $(customMetricFunc)
def getExportCheckpointsDir(): String = $(exportCheckpointsDir)
def getAucType(): String = $(aucType)
//
// Setters
//
def setSeed(value: Long): this.type = {
set(seed, value)
}
def setFamily(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[Family](value)
set(family, validated)
}
def setRandomFamily(value: Array[String]): this.type = {
val validated = EnumParamValidator.getValidatedEnumValues[hex.glm.GLMModel.GLMParameters.Family](value, nullEnabled = true)
set(randomFamily, validated)
}
def setTweedieVariancePower(value: Double): this.type = {
set(tweedieVariancePower, value)
}
def setDispersionLearningRate(value: Double): this.type = {
set(dispersionLearningRate, value)
}
def setTweedieLinkPower(value: Double): this.type = {
set(tweedieLinkPower, value)
}
def setTheta(value: Double): this.type = {
set(theta, value)
}
def setSolver(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[Solver](value)
set(solver, validated)
}
def setAlphaValue(value: Array[Double]): this.type = {
set(alphaValue, value)
}
def setLambdaValue(value: Array[Double]): this.type = {
set(lambdaValue, value)
}
def setLambdaSearch(value: Boolean): this.type = {
set(lambdaSearch, value)
}
def setEarlyStopping(value: Boolean): this.type = {
set(earlyStopping, value)
}
def setNlambdas(value: Int): this.type = {
set(nlambdas, value)
}
def setScoreIterationInterval(value: Int): this.type = {
set(scoreIterationInterval, value)
}
def setStandardize(value: Boolean): this.type = {
set(standardize, value)
}
def setColdStart(value: Boolean): this.type = {
set(coldStart, value)
}
def setMissingValuesHandling(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[MissingValuesHandling](value)
set(missingValuesHandling, validated)
}
def setInfluence(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[Influence](value)
set(influence, validated)
}
def setNonNegative(value: Boolean): this.type = {
set(nonNegative, value)
}
def setMaxIterations(value: Int): this.type = {
set(maxIterations, value)
}
def setBetaEpsilon(value: Double): this.type = {
set(betaEpsilon, value)
}
def setObjectiveEpsilon(value: Double): this.type = {
set(objectiveEpsilon, value)
}
def setGradientEpsilon(value: Double): this.type = {
set(gradientEpsilon, value)
}
def setObjReg(value: Double): this.type = {
set(objReg, value)
}
def setLink(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[Link](value)
set(link, validated)
}
def setDispersionParameterMethod(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[DispersionMethod](value)
set(dispersionParameterMethod, validated)
}
def setRandomLink(value: Array[String]): this.type = {
val validated = EnumParamValidator.getValidatedEnumValues[hex.glm.GLMModel.GLMParameters.Link](value, nullEnabled = true)
set(randomLink, validated)
}
def setStartval(value: Array[Double]): this.type = {
set(startval, value)
}
def setCalcLike(value: Boolean): this.type = {
set(calcLike, value)
}
def setGenerateVariableInflationFactors(value: Boolean): this.type = {
set(generateVariableInflationFactors, value)
}
def setIntercept(value: Boolean): this.type = {
set(intercept, value)
}
def setBuildNullModel(value: Boolean): this.type = {
set(buildNullModel, value)
}
def setFixDispersionParameter(value: Boolean): this.type = {
set(fixDispersionParameter, value)
}
def setInitDispersionParameter(value: Double): this.type = {
set(initDispersionParameter, value)
}
def setHGLM(value: Boolean): this.type = {
set(HGLM, value)
}
def setPrior(value: Double): this.type = {
set(prior, value)
}
def setLambdaMinRatio(value: Double): this.type = {
set(lambdaMinRatio, value)
}
def setMaxActivePredictors(value: Int): this.type = {
set(maxActivePredictors, value)
}
def setInteractions(value: Array[String]): this.type = {
set(interactions, value)
}
def setBalanceClasses(value: Boolean): this.type = {
set(balanceClasses, value)
}
def setClassSamplingFactors(value: Array[Float]): this.type = {
set(classSamplingFactors, value)
}
def setMaxAfterBalanceSize(value: Float): this.type = {
set(maxAfterBalanceSize, value)
}
def setMaxConfusionMatrixSize(value: Int): this.type = {
set(maxConfusionMatrixSize, value)
}
def setComputePValues(value: Boolean): this.type = {
set(computePValues, value)
}
def setFixTweedieVariancePower(value: Boolean): this.type = {
set(fixTweedieVariancePower, value)
}
def setRemoveCollinearCols(value: Boolean): this.type = {
set(removeCollinearCols, value)
}
def setDispersionEpsilon(value: Double): this.type = {
set(dispersionEpsilon, value)
}
def setTweedieEpsilon(value: Double): this.type = {
set(tweedieEpsilon, value)
}
def setMaxIterationsDispersion(value: Int): this.type = {
set(maxIterationsDispersion, value)
}
def setGenerateScoringHistory(value: Boolean): this.type = {
set(generateScoringHistory, value)
}
def setInitOptimalGlm(value: Boolean): this.type = {
set(initOptimalGlm, value)
}
def setSeparateLinearBeta(value: Boolean): this.type = {
set(separateLinearBeta, value)
}
def setConstraintEta0(value: Double): this.type = {
set(constraintEta0, value)
}
def setConstraintTau(value: Double): this.type = {
set(constraintTau, value)
}
def setConstraintAlpha(value: Double): this.type = {
set(constraintAlpha, value)
}
def setConstraintBeta(value: Double): this.type = {
set(constraintBeta, value)
}
def setConstraintC0(value: Double): this.type = {
set(constraintC0, value)
}
def setModelId(value: String): this.type = {
set(modelId, value)
}
def setNfolds(value: Int): this.type = {
set(nfolds, value)
}
def setKeepCrossValidationModels(value: Boolean): this.type = {
set(keepCrossValidationModels, value)
}
def setKeepCrossValidationPredictions(value: Boolean): this.type = {
set(keepCrossValidationPredictions, value)
}
def setKeepCrossValidationFoldAssignment(value: Boolean): this.type = {
set(keepCrossValidationFoldAssignment, value)
}
def setLabelCol(value: String): this.type = {
set(labelCol, value)
}
def setWeightCol(value: String): this.type = {
set(weightCol, value)
}
def setOffsetCol(value: String): this.type = {
set(offsetCol, value)
}
def setFoldCol(value: String): this.type = {
set(foldCol, value)
}
def setFoldAssignment(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[FoldAssignmentScheme](value)
set(foldAssignment, validated)
}
def setIgnoreConstCols(value: Boolean): this.type = {
set(ignoreConstCols, value)
}
def setScoreEachIteration(value: Boolean): this.type = {
set(scoreEachIteration, value)
}
def setCheckpoint(value: String): this.type = {
set(checkpoint, value)
}
def setStoppingRounds(value: Int): this.type = {
set(stoppingRounds, value)
}
def setMaxRuntimeSecs(value: Double): this.type = {
set(maxRuntimeSecs, value)
}
def setStoppingMetric(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[StoppingMetric](value)
set(stoppingMetric, validated)
}
def setStoppingTolerance(value: Double): this.type = {
set(stoppingTolerance, value)
}
def setGainsliftBins(value: Int): this.type = {
set(gainsliftBins, value)
}
def setCustomMetricFunc(value: String): this.type = {
set(customMetricFunc, value)
}
def setExportCheckpointsDir(value: String): this.type = {
set(exportCheckpointsDir, value)
}
def setAucType(value: String): this.type = {
val validated = EnumParamValidator.getValidatedEnumValue[MultinomialAucType](value)
set(aucType, validated)
}
override private[sparkling] def getH2OAlgorithmParams(trainingFrame: H2OFrame): Map[String, Any] = {
super.getH2OAlgorithmParams(trainingFrame) ++ getH2OGLMParams(trainingFrame)
}
private[sparkling] def getH2OGLMParams(trainingFrame: H2OFrame): Map[String, Any] = {
Map(
"seed" -> getSeed(),
"family" -> getFamily(),
"rand_family" -> getRandomFamily(),
"tweedie_variance_power" -> getTweedieVariancePower(),
"dispersion_learning_rate" -> getDispersionLearningRate(),
"tweedie_link_power" -> getTweedieLinkPower(),
"theta" -> getTheta(),
"solver" -> getSolver(),
"alpha" -> getAlphaValue(),
"lambda" -> getLambdaValue(),
"lambda_search" -> getLambdaSearch(),
"early_stopping" -> getEarlyStopping(),
"nlambdas" -> getNlambdas(),
"score_iteration_interval" -> getScoreIterationInterval(),
"standardize" -> getStandardize(),
"cold_start" -> getColdStart(),
"missing_values_handling" -> getMissingValuesHandling(),
"influence" -> getInfluence(),
"non_negative" -> getNonNegative(),
"max_iterations" -> getMaxIterations(),
"beta_epsilon" -> getBetaEpsilon(),
"objective_epsilon" -> getObjectiveEpsilon(),
"gradient_epsilon" -> getGradientEpsilon(),
"obj_reg" -> getObjReg(),
"link" -> getLink(),
"dispersion_parameter_method" -> getDispersionParameterMethod(),
"rand_link" -> getRandomLink(),
"startval" -> getStartval(),
"calc_like" -> getCalcLike(),
"generate_variable_inflation_factors" -> getGenerateVariableInflationFactors(),
"intercept" -> getIntercept(),
"build_null_model" -> getBuildNullModel(),
"fix_dispersion_parameter" -> getFixDispersionParameter(),
"init_dispersion_parameter" -> getInitDispersionParameter(),
"HGLM" -> getHGLM(),
"prior" -> getPrior(),
"lambda_min_ratio" -> getLambdaMinRatio(),
"max_active_predictors" -> getMaxActivePredictors(),
"interactions" -> getInteractions(),
"balance_classes" -> getBalanceClasses(),
"class_sampling_factors" -> getClassSamplingFactors(),
"max_after_balance_size" -> getMaxAfterBalanceSize(),
"max_confusion_matrix_size" -> getMaxConfusionMatrixSize(),
"compute_p_values" -> getComputePValues(),
"fix_tweedie_variance_power" -> getFixTweedieVariancePower(),
"remove_collinear_columns" -> getRemoveCollinearCols(),
"dispersion_epsilon" -> getDispersionEpsilon(),
"tweedie_epsilon" -> getTweedieEpsilon(),
"max_iterations_dispersion" -> getMaxIterationsDispersion(),
"generate_scoring_history" -> getGenerateScoringHistory(),
"init_optimal_glm" -> getInitOptimalGlm(),
"separate_linear_beta" -> getSeparateLinearBeta(),
"constraint_eta0" -> getConstraintEta0(),
"constraint_tau" -> getConstraintTau(),
"constraint_alpha" -> getConstraintAlpha(),
"constraint_beta" -> getConstraintBeta(),
"constraint_c0" -> getConstraintC0(),
"model_id" -> getModelId(),
"nfolds" -> getNfolds(),
"keep_cross_validation_models" -> getKeepCrossValidationModels(),
"keep_cross_validation_predictions" -> getKeepCrossValidationPredictions(),
"keep_cross_validation_fold_assignment" -> getKeepCrossValidationFoldAssignment(),
"response_column" -> getLabelCol(),
"weights_column" -> getWeightCol(),
"offset_column" -> getOffsetCol(),
"fold_column" -> getFoldCol(),
"fold_assignment" -> getFoldAssignment(),
"ignore_const_cols" -> getIgnoreConstCols(),
"score_each_iteration" -> getScoreEachIteration(),
"checkpoint" -> getCheckpoint(),
"stopping_rounds" -> getStoppingRounds(),
"max_runtime_secs" -> getMaxRuntimeSecs(),
"stopping_metric" -> getStoppingMetric(),
"stopping_tolerance" -> getStoppingTolerance(),
"gainslift_bins" -> getGainsliftBins(),
"custom_metric_func" -> getCustomMetricFunc(),
"export_checkpoints_dir" -> getExportCheckpointsDir(),
"auc_type" -> getAucType()) +++
getRandomColsParam(trainingFrame) +++
getIgnoredColsParam(trainingFrame) +++
getPlugValuesParam(trainingFrame) +++
getBetaConstraintsParam(trainingFrame) +++
getInteractionPairsParam(trainingFrame) +++
getLinearConstraintsParam(trainingFrame)
}
override private[sparkling] def getSWtoH2OParamNameMap(): Map[String, String] = {
super.getSWtoH2OParamNameMap() ++
Map(
"seed" -> "seed",
"family" -> "family",
"randomFamily" -> "rand_family",
"tweedieVariancePower" -> "tweedie_variance_power",
"dispersionLearningRate" -> "dispersion_learning_rate",
"tweedieLinkPower" -> "tweedie_link_power",
"theta" -> "theta",
"solver" -> "solver",
"alphaValue" -> "alpha",
"lambdaValue" -> "lambda",
"lambdaSearch" -> "lambda_search",
"earlyStopping" -> "early_stopping",
"nlambdas" -> "nlambdas",
"scoreIterationInterval" -> "score_iteration_interval",
"standardize" -> "standardize",
"coldStart" -> "cold_start",
"missingValuesHandling" -> "missing_values_handling",
"influence" -> "influence",
"nonNegative" -> "non_negative",
"maxIterations" -> "max_iterations",
"betaEpsilon" -> "beta_epsilon",
"objectiveEpsilon" -> "objective_epsilon",
"gradientEpsilon" -> "gradient_epsilon",
"objReg" -> "obj_reg",
"link" -> "link",
"dispersionParameterMethod" -> "dispersion_parameter_method",
"randomLink" -> "rand_link",
"startval" -> "startval",
"calcLike" -> "calc_like",
"generateVariableInflationFactors" -> "generate_variable_inflation_factors",
"intercept" -> "intercept",
"buildNullModel" -> "build_null_model",
"fixDispersionParameter" -> "fix_dispersion_parameter",
"initDispersionParameter" -> "init_dispersion_parameter",
"HGLM" -> "HGLM",
"prior" -> "prior",
"lambdaMinRatio" -> "lambda_min_ratio",
"maxActivePredictors" -> "max_active_predictors",
"interactions" -> "interactions",
"balanceClasses" -> "balance_classes",
"classSamplingFactors" -> "class_sampling_factors",
"maxAfterBalanceSize" -> "max_after_balance_size",
"maxConfusionMatrixSize" -> "max_confusion_matrix_size",
"computePValues" -> "compute_p_values",
"fixTweedieVariancePower" -> "fix_tweedie_variance_power",
"removeCollinearCols" -> "remove_collinear_columns",
"dispersionEpsilon" -> "dispersion_epsilon",
"tweedieEpsilon" -> "tweedie_epsilon",
"maxIterationsDispersion" -> "max_iterations_dispersion",
"generateScoringHistory" -> "generate_scoring_history",
"initOptimalGlm" -> "init_optimal_glm",
"separateLinearBeta" -> "separate_linear_beta",
"constraintEta0" -> "constraint_eta0",
"constraintTau" -> "constraint_tau",
"constraintAlpha" -> "constraint_alpha",
"constraintBeta" -> "constraint_beta",
"constraintC0" -> "constraint_c0",
"modelId" -> "model_id",
"nfolds" -> "nfolds",
"keepCrossValidationModels" -> "keep_cross_validation_models",
"keepCrossValidationPredictions" -> "keep_cross_validation_predictions",
"keepCrossValidationFoldAssignment" -> "keep_cross_validation_fold_assignment",
"labelCol" -> "response_column",
"weightCol" -> "weights_column",
"offsetCol" -> "offset_column",
"foldCol" -> "fold_column",
"foldAssignment" -> "fold_assignment",
"ignoreConstCols" -> "ignore_const_cols",
"scoreEachIteration" -> "score_each_iteration",
"checkpoint" -> "checkpoint",
"stoppingRounds" -> "stopping_rounds",
"maxRuntimeSecs" -> "max_runtime_secs",
"stoppingMetric" -> "stopping_metric",
"stoppingTolerance" -> "stopping_tolerance",
"gainsliftBins" -> "gainslift_bins",
"customMetricFunc" -> "custom_metric_func",
"exportCheckpointsDir" -> "export_checkpoints_dir",
"aucType" -> "auc_type")
}
}