public class MultilayerPerceptronClassifier extends Predictor<Vector,MultilayerPerceptronClassifier,MultilayerPerceptronClassificationModel>
Constructor and Description |
---|
MultilayerPerceptronClassifier() |
MultilayerPerceptronClassifier(java.lang.String uid) |
Modifier and Type | Method and Description |
---|---|
protected static <T> T |
$(Param<T> param) |
static IntParam |
blockSize() |
IntParam |
blockSize()
Block size for stacking input data in matrices to speed up the computation.
|
static Params |
clear(Param<?> param) |
MultilayerPerceptronClassifier |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
protected static <T extends Params> |
copyValues(T to,
ParamMap extra) |
protected static <T extends Params> |
copyValues$default$2() |
protected static <T extends Params> |
defaultCopy(ParamMap extra) |
static java.lang.String |
explainParam(Param<?> param) |
static java.lang.String |
explainParams() |
protected static RDD<LabeledPoint> |
extractLabeledPoints(Dataset<?> dataset) |
static ParamMap |
extractParamMap() |
static ParamMap |
extractParamMap(ParamMap extra) |
static Param<java.lang.String> |
featuresCol() |
Param<java.lang.String> |
featuresCol()
Param for features column name.
|
static M |
fit(Dataset<?> dataset) |
static M |
fit(Dataset<?> dataset,
ParamMap paramMap) |
static scala.collection.Seq<M> |
fit(Dataset<?> dataset,
ParamMap[] paramMaps) |
static M |
fit(Dataset<?> dataset,
ParamPair<?> firstParamPair,
ParamPair<?>... otherParamPairs) |
static M |
fit(Dataset<?> dataset,
ParamPair<?> firstParamPair,
scala.collection.Seq<ParamPair<?>> otherParamPairs) |
static <T> scala.Option<T> |
get(Param<T> param) |
static int |
getBlockSize() |
int |
getBlockSize() |
static <T> scala.Option<T> |
getDefault(Param<T> param) |
static java.lang.String |
getFeaturesCol() |
java.lang.String |
getFeaturesCol() |
static java.lang.String |
getLabelCol() |
java.lang.String |
getLabelCol() |
static int[] |
getLayers() |
int[] |
getLayers() |
static int |
getMaxIter() |
static java.lang.String |
getOptimizer() |
java.lang.String |
getOptimizer() |
static <T> T |
getOrDefault(Param<T> param) |
static Param<java.lang.Object> |
getParam(java.lang.String paramName) |
static java.lang.String |
getPredictionCol() |
java.lang.String |
getPredictionCol() |
static long |
getSeed() |
static double |
getStepSize() |
static double |
getTol() |
static Vector |
getWeights() |
Vector |
getWeights() |
static <T> boolean |
hasDefault(Param<T> param) |
static boolean |
hasParam(java.lang.String paramName) |
protected static void |
initializeLogIfNecessary(boolean isInterpreter) |
static boolean |
isDefined(Param<?> param) |
static boolean |
isSet(Param<?> param) |
protected static boolean |
isTraceEnabled() |
static Param<java.lang.String> |
labelCol() |
Param<java.lang.String> |
labelCol()
Param for label column name.
|
static IntArrayParam |
layers() |
IntArrayParam |
layers()
Layer sizes including input size and output size.
|
static MultilayerPerceptronClassifier |
load(java.lang.String path) |
protected static org.slf4j.Logger |
log() |
protected static void |
logDebug(scala.Function0<java.lang.String> msg) |
protected static void |
logDebug(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logError(scala.Function0<java.lang.String> msg) |
protected static void |
logError(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logInfo(scala.Function0<java.lang.String> msg) |
protected static void |
logInfo(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static java.lang.String |
logName() |
protected static void |
logTrace(scala.Function0<java.lang.String> msg) |
protected static void |
logTrace(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logWarning(scala.Function0<java.lang.String> msg) |
protected static void |
logWarning(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
static IntParam |
maxIter() |
static Param<?>[] |
params() |
static Param<java.lang.String> |
predictionCol() |
Param<java.lang.String> |
predictionCol()
Param for prediction column name.
|
static void |
save(java.lang.String path) |
static LongParam |
seed() |
static <T> Params |
set(Param<T> param,
T value) |
protected static Params |
set(ParamPair<?> paramPair) |
protected static Params |
set(java.lang.String param,
java.lang.Object value) |
MultilayerPerceptronClassifier |
setBlockSize(int value) |
protected static <T> Params |
setDefault(Param<T> param,
T value) |
protected static Params |
setDefault(scala.collection.Seq<ParamPair<?>> paramPairs) |
static Learner |
setFeaturesCol(java.lang.String value) |
static Learner |
setLabelCol(java.lang.String value) |
MultilayerPerceptronClassifier |
setLayers(int[] value) |
MultilayerPerceptronClassifier |
setMaxIter(int value)
Set the maximum number of iterations.
|
static Learner |
setPredictionCol(java.lang.String value) |
MultilayerPerceptronClassifier |
setSeed(long value)
Set the seed for weights initialization if weights are not set
|
MultilayerPerceptronClassifier |
setTol(double value)
Set the convergence tolerance of iterations.
|
MultilayerPerceptronClassifier |
setWeights(Vector value)
Sets the model weights.
|
static Param<java.lang.String> |
solver() |
Param<java.lang.String> |
solver()
Allows setting the solver: minibatch gradient descent (gd) or l-bfgs.
|
static DoubleParam |
stepSize() |
static DoubleParam |
tol() |
static java.lang.String |
toString() |
protected MultilayerPerceptronClassificationModel |
train(Dataset<?> dataset)
Train a model using the given dataset and parameters.
|
static StructType |
transformSchema(StructType schema) |
protected static StructType |
transformSchema(StructType schema,
boolean logging) |
java.lang.String |
uid()
An immutable unique ID for the object and its derivatives.
|
protected static StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType) |
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType)
Validates and transforms the input schema with the provided param map.
|
static void |
validateParams() |
static Param<Vector> |
weights() |
Param<Vector> |
weights()
Model weights.
|
static MLWriter |
write() |
extractLabeledPoints, fit, setFeaturesCol, setLabelCol, setPredictionCol, transformSchema
transformSchema
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn, validateParams
toString
public MultilayerPerceptronClassifier(java.lang.String uid)
public MultilayerPerceptronClassifier()
public static MultilayerPerceptronClassifier load(java.lang.String path)
public static java.lang.String toString()
public static Param<?>[] params()
public static void validateParams()
public static java.lang.String explainParam(Param<?> param)
public static java.lang.String explainParams()
public static final boolean isSet(Param<?> param)
public static final boolean isDefined(Param<?> param)
public static boolean hasParam(java.lang.String paramName)
public static Param<java.lang.Object> getParam(java.lang.String paramName)
protected static final Params set(java.lang.String param, java.lang.Object value)
public static final <T> scala.Option<T> get(Param<T> param)
public static final <T> T getOrDefault(Param<T> param)
protected static final <T> T $(Param<T> param)
public static final <T> scala.Option<T> getDefault(Param<T> param)
public static final <T> boolean hasDefault(Param<T> param)
public static final ParamMap extractParamMap()
protected static java.lang.String logName()
protected static org.slf4j.Logger log()
protected static void logInfo(scala.Function0<java.lang.String> msg)
protected static void logDebug(scala.Function0<java.lang.String> msg)
protected static void logTrace(scala.Function0<java.lang.String> msg)
protected static void logWarning(scala.Function0<java.lang.String> msg)
protected static void logError(scala.Function0<java.lang.String> msg)
protected static void logInfo(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logDebug(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logTrace(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logWarning(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logError(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static boolean isTraceEnabled()
protected static void initializeLogIfNecessary(boolean isInterpreter)
protected static StructType transformSchema(StructType schema, boolean logging)
public static M fit(Dataset<?> dataset, ParamPair<?> firstParamPair, scala.collection.Seq<ParamPair<?>> otherParamPairs)
public static M fit(Dataset<?> dataset, ParamPair<?> firstParamPair, ParamPair<?>... otherParamPairs)
public static final Param<java.lang.String> labelCol()
public static final java.lang.String getLabelCol()
public static final Param<java.lang.String> featuresCol()
public static final java.lang.String getFeaturesCol()
public static final Param<java.lang.String> predictionCol()
public static final java.lang.String getPredictionCol()
protected static StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
public static Learner setLabelCol(java.lang.String value)
public static Learner setFeaturesCol(java.lang.String value)
public static Learner setPredictionCol(java.lang.String value)
public static M fit(Dataset<?> dataset)
public static StructType transformSchema(StructType schema)
protected static RDD<LabeledPoint> extractLabeledPoints(Dataset<?> dataset)
public static final LongParam seed()
public static final long getSeed()
public static final IntParam maxIter()
public static final int getMaxIter()
public static final DoubleParam tol()
public static final double getTol()
public static final DoubleParam stepSize()
public static final double getStepSize()
public static final IntArrayParam layers()
public static final int[] getLayers()
public static final IntParam blockSize()
public static final int getBlockSize()
public static final Param<java.lang.String> solver()
public static final java.lang.String getOptimizer()
public static final Vector getWeights()
public static void save(java.lang.String path) throws java.io.IOException
java.io.IOException
public static MLWriter write()
public java.lang.String uid()
Identifiable
uid
in interface Identifiable
public MultilayerPerceptronClassifier setLayers(int[] value)
public MultilayerPerceptronClassifier setBlockSize(int value)
public MultilayerPerceptronClassifier setMaxIter(int value)
value
- (undocumented)public MultilayerPerceptronClassifier setTol(double value)
value
- (undocumented)public MultilayerPerceptronClassifier setSeed(long value)
value
- (undocumented)public MultilayerPerceptronClassifier setWeights(Vector value)
value
- (undocumented)public MultilayerPerceptronClassifier copy(ParamMap extra)
Params
copy
in interface Params
copy
in class Predictor<Vector,MultilayerPerceptronClassifier,MultilayerPerceptronClassificationModel>
extra
- (undocumented)defaultCopy()
protected MultilayerPerceptronClassificationModel train(Dataset<?> dataset)
fit()
to avoid dealing with schema validation
and copying parameters into the model.
train
in class Predictor<Vector,MultilayerPerceptronClassifier,MultilayerPerceptronClassificationModel>
dataset
- Training datasetpublic IntArrayParam layers()
public int[] getLayers()
public IntParam blockSize()
public int getBlockSize()
public Param<java.lang.String> solver()
public java.lang.String getOptimizer()
public Param<Vector> weights()
public Vector getWeights()
public StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
schema
- input schemafitting
- whether this is in fittingfeaturesDataType
- SQL DataType for FeaturesType.
E.g., VectorUDT
for vector features.public Param<java.lang.String> labelCol()
public java.lang.String getLabelCol()
public Param<java.lang.String> featuresCol()
public java.lang.String getFeaturesCol()
public Param<java.lang.String> predictionCol()
public java.lang.String getPredictionCol()