public final class Word2Vec extends Estimator<Word2VecModel> implements DefaultParamsWritable
Map(String, Vector)
, i.e. transforms a word into a code for further
natural language processing or machine learning process.Modifier and Type | Method and Description |
---|---|
static Params |
clear(Param<?> param) |
Word2Vec |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
static String |
explainParam(Param<?> param) |
static String |
explainParams() |
static ParamMap |
extractParamMap() |
static ParamMap |
extractParamMap(ParamMap extra) |
Word2VecModel |
fit(Dataset<?> dataset)
Fits a model to the input data.
|
static <T> scala.Option<T> |
get(Param<T> param) |
static <T> scala.Option<T> |
getDefault(Param<T> param) |
static String |
getInputCol() |
static int |
getMaxIter() |
static int |
getMaxSentenceLength() |
int |
getMaxSentenceLength() |
static int |
getMinCount() |
int |
getMinCount() |
static int |
getNumPartitions() |
int |
getNumPartitions() |
static <T> T |
getOrDefault(Param<T> param) |
static String |
getOutputCol() |
static Param<Object> |
getParam(String paramName) |
static long |
getSeed() |
static double |
getStepSize() |
static int |
getVectorSize() |
int |
getVectorSize() |
static int |
getWindowSize() |
int |
getWindowSize() |
static <T> boolean |
hasDefault(Param<T> param) |
static boolean |
hasParam(String paramName) |
static Param<String> |
inputCol() |
static boolean |
isDefined(Param<?> param) |
static boolean |
isSet(Param<?> param) |
static Word2Vec |
load(String path) |
static IntParam |
maxIter() |
static IntParam |
maxSentenceLength() |
IntParam |
maxSentenceLength()
Sets the maximum length (in words) of each sentence in the input data.
|
static IntParam |
minCount() |
IntParam |
minCount()
The minimum number of times a token must appear to be included in the word2vec model's
vocabulary.
|
static IntParam |
numPartitions() |
IntParam |
numPartitions()
Number of partitions for sentences of words.
|
static Param<String> |
outputCol() |
static Param<?>[] |
params() |
static void |
save(String path) |
static LongParam |
seed() |
static <T> Params |
set(Param<T> param,
T value) |
Word2Vec |
setInputCol(String value) |
Word2Vec |
setMaxIter(int value) |
Word2Vec |
setMaxSentenceLength(int value) |
Word2Vec |
setMinCount(int value) |
Word2Vec |
setNumPartitions(int value) |
Word2Vec |
setOutputCol(String value) |
Word2Vec |
setSeed(long value) |
Word2Vec |
setStepSize(double value) |
Word2Vec |
setVectorSize(int value) |
Word2Vec |
setWindowSize(int value) |
static DoubleParam |
stepSize() |
static String |
toString() |
StructType |
transformSchema(StructType schema)
:: DeveloperApi ::
|
String |
uid()
An immutable unique ID for the object and its derivatives.
|
StructType |
validateAndTransformSchema(StructType schema)
Validate and transform the input schema.
|
static IntParam |
vectorSize() |
IntParam |
vectorSize()
The dimension of the code that you want to transform from words.
|
static IntParam |
windowSize() |
IntParam |
windowSize()
The window size (context words from [-window, window]).
|
static MLWriter |
write() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInputCol, inputCol
getOutputCol, outputCol
getMaxIter, maxIter
getStepSize, stepSize
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
toString
write
save
initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public static Word2Vec load(String path)
public static String toString()
public static Param<?>[] params()
public static String explainParam(Param<?> param)
public static String explainParams()
public static final boolean isSet(Param<?> param)
public static final boolean isDefined(Param<?> param)
public static boolean hasParam(String paramName)
public static Param<Object> getParam(String paramName)
public static final <T> scala.Option<T> get(Param<T> param)
public static final <T> T getOrDefault(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()
public static final Param<String> inputCol()
public static final String getInputCol()
public static final Param<String> outputCol()
public static final String getOutputCol()
public static final IntParam maxIter()
public static final int getMaxIter()
public static DoubleParam stepSize()
public static final double getStepSize()
public static final LongParam seed()
public static final long getSeed()
public static final IntParam vectorSize()
public static int getVectorSize()
public static final IntParam windowSize()
public static int getWindowSize()
public static final IntParam numPartitions()
public static int getNumPartitions()
public static final IntParam minCount()
public static int getMinCount()
public static final IntParam maxSentenceLength()
public static int getMaxSentenceLength()
public static void save(String path) throws java.io.IOException
java.io.IOException
public static MLWriter write()
public String uid()
Identifiable
uid
in interface Identifiable
public Word2Vec setInputCol(String value)
public Word2Vec setOutputCol(String value)
public Word2Vec setVectorSize(int value)
public Word2Vec setWindowSize(int value)
public Word2Vec setStepSize(double value)
public Word2Vec setNumPartitions(int value)
public Word2Vec setMaxIter(int value)
public Word2Vec setSeed(long value)
public Word2Vec setMinCount(int value)
public Word2Vec setMaxSentenceLength(int value)
public Word2VecModel fit(Dataset<?> dataset)
Estimator
fit
in class Estimator<Word2VecModel>
dataset
- (undocumented)public StructType transformSchema(StructType schema)
PipelineStage
Check transform validity and derive the output schema from the input schema.
We check validity for interactions between parameters during transformSchema
and
raise an exception if any parameter value is invalid. Parameter value checks which
do not depend on other parameters are handled by Param.validate()
.
Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks.
transformSchema
in class PipelineStage
schema
- (undocumented)public Word2Vec copy(ParamMap extra)
Params
defaultCopy()
.copy
in interface Params
copy
in class Estimator<Word2VecModel>
extra
- (undocumented)public IntParam vectorSize()
public int getVectorSize()
public IntParam windowSize()
public int getWindowSize()
public IntParam numPartitions()
public int getNumPartitions()
public IntParam minCount()
public int getMinCount()
public IntParam maxSentenceLength()
maxSentenceLength
size.
Default: 1000public int getMaxSentenceLength()
public StructType validateAndTransformSchema(StructType schema)
schema
- (undocumented)