|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.apache.spark.mllib.feature.Word2VecModel
public class Word2VecModel
:: Experimental :: Word2Vec model
Method Summary | |
---|---|
scala.Tuple2<String,Object>[] |
findSynonyms(String word,
int num)
Find synonyms of a word |
scala.Tuple2<String,Object>[] |
findSynonyms(Vector vector,
int num)
Find synonyms of the vector representation of a word |
scala.collection.immutable.Map<String,float[]> |
getVectors()
Returns a map of words to their vector representations. |
static Word2VecModel |
load(SparkContext sc,
String path)
|
void |
save(SparkContext sc,
String path)
Save this model to the given path. |
Vector |
transform(String word)
Transforms a word to its vector representation |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Word2VecModel load(SparkContext sc, String path)
public void save(SparkContext sc, String path)
Saveable
This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/
The model may be loaded using Loader.load
.
save
in interface Saveable
sc
- Spark context used to save model data.path
- Path specifying the directory in which to save this model.
If the directory already exists, this method throws an exception.public Vector transform(String word)
word
- a word
public scala.Tuple2<String,Object>[] findSynonyms(String word, int num)
word
- a wordnum
- number of synonyms to find
public scala.Tuple2<String,Object>[] findSynonyms(Vector vector, int num)
vector
- vector representation of a wordnum
- number of synonyms to find
public scala.collection.immutable.Map<String,float[]> getVectors()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |