public class Word2VecModel extends Model<Word2VecModel> implements MLWritable
Word2Vec.| Modifier and Type | Method and Description |
|---|---|
Word2VecModel |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
DataFrame |
findSynonyms(String word,
int num)
Find "num" number of words closest in similarity to the given word.
|
DataFrame |
findSynonyms(Vector word,
int num)
Find "num" number of words closest to similarity to the given vector representation
of the word.
|
String |
getInputCol() |
int |
getMaxIter() |
int |
getMinCount() |
int |
getNumPartitions() |
String |
getOutputCol() |
long |
getSeed() |
double |
getStepSize() |
DataFrame |
getVectors()
Returns a dataframe with two fields, "word" and "vector", with "word" being a String and
and the vector the DenseVector that it is mapped to.
|
int |
getVectorSize() |
int |
getWindowSize() |
Param<String> |
inputCol()
Param for input column name.
|
static Word2VecModel |
load(String path) |
IntParam |
maxIter()
Param for maximum number of iterations (>= 0).
|
IntParam |
minCount()
The minimum number of times a token must appear to be included in the word2vec model's
vocabulary.
|
IntParam |
numPartitions()
Number of partitions for sentences of words.
|
Param<String> |
outputCol()
Param for output column name.
|
static MLReader<Word2VecModel> |
read() |
LongParam |
seed()
Param for random seed.
|
Word2VecModel |
setInputCol(String value) |
Word2VecModel |
setOutputCol(String value) |
DoubleParam |
stepSize()
Param for Step size to be used for each iteration of optimization..
|
DataFrame |
transform(DataFrame dataset)
Transform a sentence column to a vector column to represent the whole sentence.
|
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.
|
IntParam |
vectorSize()
The dimension of the code that you want to transform from words.
|
IntParam |
windowSize()
The window size (context words from [-window, window]) default 5.
|
MLWriter |
write()
Returns an
MLWriter instance for this ML instance. |
transform, transform, transformequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn, validateParamstoStringsaveinitializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarningpublic static MLReader<Word2VecModel> read()
public static Word2VecModel load(String path)
public String uid()
Identifiableuid in interface Identifiablepublic DataFrame getVectors()
public DataFrame findSynonyms(String word, int num)
word - (undocumented)num - (undocumented)public DataFrame findSynonyms(Vector word, int num)
word - (undocumented)num - (undocumented)public Word2VecModel setInputCol(String value)
public Word2VecModel setOutputCol(String value)
public DataFrame transform(DataFrame dataset)
transform in class Transformerdataset - (undocumented)public StructType transformSchema(StructType schema)
PipelineStageDerives the output schema from the input schema.
transformSchema in class PipelineStageschema - (undocumented)public Word2VecModel copy(ParamMap extra)
Paramscopy in interface Paramscopy in class Model<Word2VecModel>extra - (undocumented)defaultCopy()public MLWriter write()
MLWritableMLWriter instance for this ML instance.write in interface MLWritablepublic IntParam vectorSize()
public int getVectorSize()
public IntParam windowSize()
public int getWindowSize()
public IntParam numPartitions()
public int getNumPartitions()
public IntParam minCount()
public int getMinCount()
public StructType validateAndTransformSchema(StructType schema)
schema - (undocumented)public Param<String> inputCol()
public String getInputCol()
public Param<String> outputCol()
public String getOutputCol()
public IntParam maxIter()
public int getMaxIter()
public DoubleParam stepSize()
public double getStepSize()
public LongParam seed()
public long getSeed()