class gensim.models.RpModel(corpus, id2word=None, num_topics=300)[source]

Objects of this class allow building and maintaining a model for Random Projections (also known as Random Indexing). For theoretical background on RP, see:

Kanerva et al.: “Random indexing of text samples for Latent Semantic Analysis.”

The main methods are:

  1. constructor, which creates the random projection matrix
  2. the [] method, which transforms a simple count representation into the TfIdf space.
>>> rp = RpModel(corpus)
>>> print(rp[some_doc])

Model persistency is achieved via its load/save methods.


__init__(corpus[, id2word, num_topics]) id2word is a mapping from word ids (integers) to words (strings). It is
initialize(corpus) Initialize the random projection matrix.
load(fname[, mmap]) Load a previously saved object from file (also see save).
save(fname_or_handle[, separately, ...]) Save the object to file (also see load).