embeddingTrainer: Poincare-embedding trainer

Description Usage Arguments Value Examples

View source: R/embeddingTrainer.R

Description

This function performs optimization with respect to the objective function. Please refer to 'vignette' to find the equation for the objective function and detailed ideas(e.g. how to optimize).

Usage

1
2
embeddingTrainer(POS, NEG, entity, theta_dim = 2, N_epoch = 100,
  lr = 0.001, n_neg = 4)

Arguments

POS

- A 2-row positive relation matrix that contains positive relation entities columnwisely.

NEG

- A 2-row negative relation matrix that contains negative relation entities columnwisely.

entity

- A vector of all the entities in the tree-shape dataset.

theta_dim

- The dimension of the embedding space.

N_epoch

- The number of epochs.

lr

- The learning rate.

n_neg

- The number of negative samples for each iteration.

Value

A trained matrix theta.

Examples

1
2
3
4
statistics_yaml <- yaml::yaml.load(statistics)
statistics_tree <- data.tree::as.Node(statistics_yaml)
dataset <- dataLoader(statistics_tree)
embeddingTrainer(dataset$POS, dataset$NEG, dataset$entity, 2, 100, 0.001, 5)

hwchang1201/poincare.embeddings documentation built on Dec. 9, 2019, 1:30 p.m.