Package org.apache.spark.ml.regression
Class AFTSurvivalRegression
Object
org.apache.spark.ml.PipelineStage
org.apache.spark.ml.Estimator<M>
org.apache.spark.ml.Predictor<FeaturesType,Learner,M>
org.apache.spark.ml.regression.Regressor<Vector,AFTSurvivalRegression,AFTSurvivalRegressionModel>
org.apache.spark.ml.regression.AFTSurvivalRegression
- All Implemented Interfaces:
Serializable,org.apache.spark.internal.Logging,Params,HasAggregationDepth,HasFeaturesCol,HasFitIntercept,HasLabelCol,HasMaxBlockSizeInMB,HasMaxIter,HasPredictionCol,HasTol,PredictorParams,AFTSurvivalRegressionParams,DefaultParamsWritable,Identifiable,MLWritable
public class AFTSurvivalRegression
extends Regressor<Vector,AFTSurvivalRegression,AFTSurvivalRegressionModel>
implements AFTSurvivalRegressionParams, DefaultParamsWritable, org.apache.spark.internal.Logging
Fit a parametric survival regression model named accelerated failure time (AFT) model
(see
Accelerated failure time model (Wikipedia))
based on the Weibull distribution of the survival time.
Since 3.1.0, it supports stacking instances into blocks and using GEMV for better performance. The block size will be 1.0 MB, if param maxBlockSizeInMB is set 0.0 by default.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging
org.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal IntParamParam for suggested depth for treeAggregate (>= 2).Param for censor column name.Creates a copy of this instance with the same UID and some extra params.final BooleanParamParam for whether to fit an intercept term.static AFTSurvivalRegressionfinal DoubleParamParam for Maximum memory in MB for stacking input data into blocks.final IntParammaxIter()Param for maximum number of iterations (>= 0).final DoubleArrayParamParam for quantile probabilities array.Param for quantiles column name.static MLReader<T>read()setAggregationDepth(int value) Suggested depth for treeAggregate (greater than or equal to 2).setCensorCol(String value) setFitIntercept(boolean value) Set if we should fit the intercept Default is true.setMaxBlockSizeInMB(double value) Sets the value of parammaxBlockSizeInMB().setMaxIter(int value) Set the maximum number of iterations.setQuantileProbabilities(double[] value) setQuantilesCol(String value) setTol(double value) Set the convergence tolerance of iterations.final DoubleParamtol()Param for the convergence tolerance for iterative algorithms (>= 0).transformSchema(StructType schema) Check transform validity and derive the output schema from the input schema.uid()An immutable unique ID for the object and its derivatives.Methods inherited from class org.apache.spark.ml.Predictor
featuresCol, fit, labelCol, predictionCol, setFeaturesCol, setLabelCol, setPredictionColMethods inherited from class org.apache.spark.ml.PipelineStage
paramsMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.spark.ml.regression.AFTSurvivalRegressionParams
getCensorCol, getQuantileProbabilities, getQuantilesCol, hasQuantilesCol, validateAndTransformSchemaMethods inherited from interface org.apache.spark.ml.util.DefaultParamsWritable
writeMethods inherited from interface org.apache.spark.ml.param.shared.HasAggregationDepth
getAggregationDepthMethods inherited from interface org.apache.spark.ml.param.shared.HasFeaturesCol
featuresCol, getFeaturesColMethods inherited from interface org.apache.spark.ml.param.shared.HasFitIntercept
getFitInterceptMethods inherited from interface org.apache.spark.ml.param.shared.HasLabelCol
getLabelCol, labelColMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxBlockSizeInMB
getMaxBlockSizeInMBMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxIter
getMaxIterMethods inherited from interface org.apache.spark.ml.param.shared.HasPredictionCol
getPredictionCol, predictionColMethods inherited from interface org.apache.spark.ml.util.Identifiable
toStringMethods inherited from interface org.apache.spark.internal.Logging
initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContextMethods inherited from interface org.apache.spark.ml.util.MLWritable
saveMethods inherited from interface org.apache.spark.ml.param.Params
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwnMethods inherited from interface org.apache.spark.ml.PredictorParams
validateAndTransformSchema
-
Constructor Details
-
AFTSurvivalRegression
-
AFTSurvivalRegression
public AFTSurvivalRegression()
-
-
Method Details
-
load
-
read
-
censorCol
Description copied from interface:AFTSurvivalRegressionParamsParam for censor column name. The value of this column could be 0 or 1. If the value is 1, it means the event has occurred i.e. uncensored; otherwise censored.- Specified by:
censorColin interfaceAFTSurvivalRegressionParams- Returns:
- (undocumented)
-
quantileProbabilities
Description copied from interface:AFTSurvivalRegressionParamsParam for quantile probabilities array. Values of the quantile probabilities array should be in the range (0, 1) and the array should be non-empty.- Specified by:
quantileProbabilitiesin interfaceAFTSurvivalRegressionParams- Returns:
- (undocumented)
-
quantilesCol
Description copied from interface:AFTSurvivalRegressionParamsParam for quantiles column name. This column will output quantiles of corresponding quantileProbabilities if it is set.- Specified by:
quantilesColin interfaceAFTSurvivalRegressionParams- Returns:
- (undocumented)
-
maxBlockSizeInMB
Description copied from interface:HasMaxBlockSizeInMBParam for Maximum memory in MB for stacking input data into blocks. Data is stacked within partitions. If more than remaining data size in a partition then it is adjusted to the data size. Default 0.0 represents choosing optimal value, depends on specific algorithm. Must be >= 0..- Specified by:
maxBlockSizeInMBin interfaceHasMaxBlockSizeInMB- Returns:
- (undocumented)
-
aggregationDepth
Description copied from interface:HasAggregationDepthParam for suggested depth for treeAggregate (>= 2).- Specified by:
aggregationDepthin interfaceHasAggregationDepth- Returns:
- (undocumented)
-
fitIntercept
Description copied from interface:HasFitInterceptParam for whether to fit an intercept term.- Specified by:
fitInterceptin interfaceHasFitIntercept- Returns:
- (undocumented)
-
tol
Description copied from interface:HasTolParam for the convergence tolerance for iterative algorithms (>= 0). -
maxIter
Description copied from interface:HasMaxIterParam for maximum number of iterations (>= 0).- Specified by:
maxIterin interfaceHasMaxIter- Returns:
- (undocumented)
-
uid
Description copied from interface:IdentifiableAn immutable unique ID for the object and its derivatives.- Specified by:
uidin interfaceIdentifiable- Returns:
- (undocumented)
-
setCensorCol
-
setQuantileProbabilities
-
setQuantilesCol
-
setFitIntercept
Set if we should fit the intercept Default is true.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
setMaxIter
Set the maximum number of iterations. Default is 100.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
setTol
Set the convergence tolerance of iterations. Smaller value will lead to higher accuracy with the cost of more iterations. Default is 1E-6.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
setAggregationDepth
Suggested depth for treeAggregate (greater than or equal to 2). If the dimensions of features or the number of partitions are large, this param could be adjusted to a larger size. Default is 2.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
setMaxBlockSizeInMB
Sets the value of parammaxBlockSizeInMB(). Default is 0.0, then 1.0 MB will be chosen.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
transformSchema
Description copied from class:PipelineStageCheck transform validity and derive the output schema from the input schema.We check validity for interactions between parameters during
transformSchemaand raise an exception if any parameter value is invalid. Parameter value checks which do not depend on other parameters are handled byParam.validate().Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks.
- Overrides:
transformSchemain classPredictor<Vector,AFTSurvivalRegression, AFTSurvivalRegressionModel> - Parameters:
schema- (undocumented)- Returns:
- (undocumented)
-
copy
Description copied from interface:ParamsCreates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly. SeedefaultCopy().- Specified by:
copyin interfaceParams- Specified by:
copyin classPredictor<Vector,AFTSurvivalRegression, AFTSurvivalRegressionModel> - Parameters:
extra- (undocumented)- Returns:
- (undocumented)
-