Class MultilayerPerceptronClassifier
Object
org.apache.spark.ml.PipelineStage
org.apache.spark.ml.Estimator<M>
org.apache.spark.ml.Predictor<FeaturesType,E,M>
  
org.apache.spark.ml.classification.Classifier<FeaturesType,E,M>
  
org.apache.spark.ml.classification.ProbabilisticClassifier<Vector,MultilayerPerceptronClassifier,MultilayerPerceptronClassificationModel>
  
org.apache.spark.ml.classification.MultilayerPerceptronClassifier
- All Implemented Interfaces:
- Serializable,- org.apache.spark.internal.Logging,- ClassifierParams,- MultilayerPerceptronParams,- ProbabilisticClassifierParams,- Params,- HasBlockSize,- HasFeaturesCol,- HasLabelCol,- HasMaxIter,- HasPredictionCol,- HasProbabilityCol,- HasRawPredictionCol,- HasSeed,- HasSolver,- HasStepSize,- HasThresholds,- HasTol,- PredictorParams,- DefaultParamsWritable,- Identifiable,- MLWritable
public class MultilayerPerceptronClassifier
extends ProbabilisticClassifier<Vector,MultilayerPerceptronClassifier,MultilayerPerceptronClassificationModel>
implements MultilayerPerceptronParams, DefaultParamsWritable  
Classifier trainer based on the Multilayer Perceptron.
 Each layer has sigmoid activation function, output layer has softmax.
 Number of inputs has to be equal to the size of feature vectors.
 Number of outputs has to be equal to the total number of labels.
 
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.spark.internal.Loggingorg.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal IntParamParam for block size for stacking input data in matrices.Creates a copy of this instance with the same UID and some extra params.The initial weights of the model.final IntArrayParamlayers()Layer sizes including input size and output size.final IntParammaxIter()Param for maximum number of iterations (>= 0).static MLReader<T>read()final LongParamseed()Param for random seed.setBlockSize(int value) Sets the value of paramblockSize().setInitialWeights(Vector value) Sets the value of paraminitialWeights().setLayers(int[] value) Sets the value of paramlayers().setMaxIter(int value) Set the maximum number of iterations.setSeed(long value) Set the seed for weights initialization if weights are not setSets the value of paramsolver().setStepSize(double value) Sets the value of paramstepSize()(applicable only for solver "gd").setTol(double value) Set the convergence tolerance of iterations.solver()The solver algorithm for optimization.stepSize()Param for Step size to be used for each iteration of optimization (> 0).final DoubleParamtol()Param for the convergence tolerance for iterative algorithms (>= 0).uid()An immutable unique ID for the object and its derivatives.Methods inherited from class org.apache.spark.ml.classification.ProbabilisticClassifierprobabilityCol, setProbabilityCol, setThresholds, thresholdsMethods inherited from class org.apache.spark.ml.classification.ClassifierrawPredictionCol, setRawPredictionColMethods inherited from class org.apache.spark.ml.PredictorfeaturesCol, fit, labelCol, predictionCol, setFeaturesCol, setLabelCol, setPredictionCol, transformSchemaMethods inherited from class org.apache.spark.ml.PipelineStageparamsMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.spark.ml.util.DefaultParamsWritablewriteMethods inherited from interface org.apache.spark.ml.param.shared.HasBlockSizegetBlockSizeMethods inherited from interface org.apache.spark.ml.param.shared.HasFeaturesColfeaturesCol, getFeaturesColMethods inherited from interface org.apache.spark.ml.param.shared.HasLabelColgetLabelCol, labelColMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxItergetMaxIterMethods inherited from interface org.apache.spark.ml.param.shared.HasPredictionColgetPredictionCol, predictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasProbabilityColgetProbabilityCol, probabilityColMethods inherited from interface org.apache.spark.ml.param.shared.HasRawPredictionColgetRawPredictionCol, rawPredictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasStepSizegetStepSizeMethods inherited from interface org.apache.spark.ml.param.shared.HasThresholdsgetThresholds, thresholdsMethods inherited from interface org.apache.spark.ml.util.IdentifiabletoStringMethods inherited from interface org.apache.spark.internal.LogginginitializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logBasedOnLevel, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, MDC, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContextMethods inherited from interface org.apache.spark.ml.util.MLWritablesaveMethods inherited from interface org.apache.spark.ml.classification.MultilayerPerceptronParamsgetInitialWeights, getLayersMethods inherited from interface org.apache.spark.ml.param.Paramsclear, copyValues, defaultCopy, defaultParamMap, estimateMatadataSize, 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.classification.ProbabilisticClassifierParamsvalidateAndTransformSchema
- 
Constructor Details- 
MultilayerPerceptronClassifier
- 
MultilayerPerceptronClassifierpublic MultilayerPerceptronClassifier()
 
- 
- 
Method Details- 
load
- 
read
- 
layersDescription copied from interface:MultilayerPerceptronParamsLayer sizes including input size and output size.- Specified by:
- layersin interface- MultilayerPerceptronParams
- Returns:
- (undocumented)
 
- 
solverDescription copied from interface:MultilayerPerceptronParamsThe solver algorithm for optimization. Supported options: "gd" (minibatch gradient descent) or "l-bfgs". Default: "l-bfgs"- Specified by:
- solverin interface- HasSolver
- Specified by:
- solverin interface- MultilayerPerceptronParams
- Returns:
- (undocumented)
 
- 
initialWeightsDescription copied from interface:MultilayerPerceptronParamsThe initial weights of the model.- Specified by:
- initialWeightsin interface- MultilayerPerceptronParams
- Returns:
- (undocumented)
 
- 
blockSizeDescription copied from interface:HasBlockSizeParam for block size for stacking input data in matrices. Data is stacked within partitions. If block size is more than remaining data in a partition then it is adjusted to the size of this data..- Specified by:
- blockSizein interface- HasBlockSize
- Returns:
- (undocumented)
 
- 
stepSizeDescription copied from interface:HasStepSizeParam for Step size to be used for each iteration of optimization (> 0).- Specified by:
- stepSizein interface- HasStepSize
- Returns:
- (undocumented)
 
- 
tolDescription copied from interface:HasTolParam for the convergence tolerance for iterative algorithms (>= 0).
- 
maxIterDescription copied from interface:HasMaxIterParam for maximum number of iterations (>= 0).- Specified by:
- maxIterin interface- HasMaxIter
- Returns:
- (undocumented)
 
- 
seedDescription copied from interface:HasSeedParam for random seed.
- 
uidDescription copied from interface:IdentifiableAn immutable unique ID for the object and its derivatives.- Specified by:
- uidin interface- Identifiable
- Returns:
- (undocumented)
 
- 
setLayersSets the value of paramlayers().- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
setBlockSizeSets the value of paramblockSize(). Default is 128.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
setSolverSets the value of paramsolver(). Default is "l-bfgs".- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
setMaxIterSet the maximum number of iterations. Default is 100.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
setTolSet 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)
 
- 
setSeedSet the seed for weights initialization if weights are not set- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
setInitialWeightsSets the value of paraminitialWeights().- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
setStepSizeSets the value of paramstepSize()(applicable only for solver "gd"). Default is 0.03.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
copyDescription 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 interface- Params
- Specified by:
- copyin class- Predictor<Vector,- MultilayerPerceptronClassifier, - MultilayerPerceptronClassificationModel> 
- Parameters:
- extra- (undocumented)
- Returns:
- (undocumented)
 
 
-