Skip to main content

Two word embedding mapping compatible with OpenAI gym.

Project description

OpenAI gym Embedding world

An eight-dimensional hypercube graph.

Build Status

Two word embedding mapping compatible with OpenAI gym.


  • Python 3.5+
  • OpenAI Gym
  • NumPy
  • Gensim

Install environment on anaconda

$ conda env create -f gym-embedding-world/environment.yml
$ source embedding-world
$ pip install -e gym-embedding-world/.

Install environment on colab

!git clone ""
!pip install -e gym-embedding-world/.
!mv gym-embedding-world gym-embedding-world-org
!cp -r gym-embedding-world-org/embedding_world /content
!ls embedding_world


$ python >>> import gym
$ python >>> import embedding_world
$ python >>> env = gym.make('embedding_world-v0')
$ python >>> env.set_paths(embedding_from_file="... YOUR EMBEDDING PATH TO MAP FROM IT  ...",
                           embedding_to_file  ="... YOUR EMBEDDING PATH TO MAP TO IT  .....")
$ python >>> env.production_is_off()
$ python >>> env.set_sentences('... YOUR SENTENCE TO TRANSLATE FROM IT ...', 
                               '... YOUR SENTENCE TO TRANSLATE TO IT .....')
$ python >>> state, reward, done, info = env.step('dim(0)+1')


Embedding world is a simple environment based on OpenAI gym, that loads two-word embedding e.g. Stanfrod GloVe or facebook fastText models with N-dimension and moves from one word(s) embedding-location to the other embedding using an agent actions such that actions that could be taken are 2N + 1 actions {dimension(i)+1, dimension(i)-1} {pickup}i in range from 1 to N

which deterministically cause the corresponding state transitions but actions that would take an agent of the grid leave a state unchanged. The reward is negative for all transition until the goal is reached. The terminal state(goal) is represented in a vector/s.

This environment has been built as part of a graduation project at University of Alexandria, Department of Computer Science

Please use this bibtex if you want to cite this repository in your publications:

    author = {Samir Moustafa},
    title = {Embedding Environment for OpenAI Gym},
    year = {2019},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {\url{}}

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gym-embedding-world, version
Filename, size File type Python version Upload date Hashes
Filename, size gym-embedding_world- (7.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page