Algorithm module¶
This module contains several Class. The main purpose of the module is to provide a clear training interface. It will train several models with several distinct configs and choose the best one. After this, it will create a ModelTrainer class ready to train the entire model.
Methods¶
Here is shown all the different methods to use with dataset class
-
class
kgeserver.algorithm.
ModelTrainer
(dataset, ncomp=150, afs='sigmoid', trainer_type=<class 'skge.base.PairwiseStochasticTrainer'>, model_type=<class 'skge.transe.TransE'>, eval_type=<class 'kgeserver.algorithm.TransEEval'>, **kwargs)[source]¶ Creates a Model from a dataset and trains it
-
class
kgeserver.algorithm.
Algorithm
(dataset, thread_limiter=4)[source]¶ Generate several models to test and choose the right one
-
find_best
(margins=[0.2, 2.0], ncomps=range(50, 100, 20), model_types=[<class 'skge.hole.HolE'>, <class 'skge.transe.TransE'>], **kwargs)[source]¶ Find the best training params for a given dataset
This method makes several trains with different models and parameters, and returns a ModelTrainer Instance. :param list margins: A list of all margins to try :param list ncomps: A list of latent components :param list model_types: A list of models
-
Experiment class¶
This class is a modified version of the file which can be found on https://github.com/mnick/holographic-embeddings/tree/master/kg/base.py, and was created by Maximilian Nickel mnick@mit.edu.
Methods¶
Here is shown all the different methods to use with experiment class
-
class
kgeserver.experiment.
Experiment
(dataset, th_num=0, train_all=False, margin=2.0, init='nunif', lr=0.1, max_epochs=500, ne=1, nbatches=100, fout=None, fin=None, test_all=50, no_pairwise=False, mode='rank', sampler='random-mode', **k)[source]¶