h2o.toFrame: Convert a word2vec model into an H2OFrame

View source: R/w2vutils.R

h2o.toFrameR Documentation

Convert a word2vec model into an H2OFrame

Description

Converts a given word2vec model into an H2OFrame. The frame represents learned word embeddings

Usage

h2o.toFrame(word2vec)

Arguments

word2vec

A word2vec model.

Examples

## Not run: 
h2o.init()

# Build a dummy word2vec model
data <- as.character(as.h2o(c("a", "b", "a")))
w2v_model <- h2o.word2vec(data, sent_sample_rate = 0, min_word_freq = 0, epochs = 1, vec_size = 2)

# Transform words to vectors and return average vector for each sentence
h2o.toFrame(w2v_model) # -> Frame made of 2 rows and 2 columns

## End(Not run)

h2o documentation built on May 29, 2024, 4:26 a.m.