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.

Requirements:

  • 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 "https://github.com/SamirMoustafa/gym-embedding-world.git"
!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

Usage

$ 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-v0

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:

@misc{embedding_world,
    author = {Samir Moustafa},
    title = {Embedding Environment for OpenAI Gym},
    year = {2019},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {\url{https://github.com/SamirMoustafa/gym-embedding-world}}
}

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
gym-embedding_world-0.0.4.0.tar.gz (7.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page