This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
solving pendulum using actor-critic model | |
""" | |
import gym | |
import numpy as np | |
from keras.models import Sequential, Model | |
from keras.layers import Dense, Dropout, Input | |
from keras.layers.merge import Add, Multiply | |
from keras.optimizers import Adam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
import numpy as np | |
import random | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout | |
from keras.optimizers import Adam | |
from collections import deque | |
class DQN: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
__name__ = predict.py | |
__author__ = Yash Patel | |
__description__ = Does the prediction using the defined model and data | |
""" | |
import gym | |
import numpy as np | |
from data import gather_data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
__name__ = model.py | |
__author__ = Yash Patel | |
__description__ = Defines model to be trained on the Cartpole data, | |
predicting the directioal action to take given 4D observation state | |
""" | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
__name__ = data.py | |
__author__ = Yash Patel | |
__description__ = Gathers the data for the Cartpole environment into the | |
X and Y numpy arrays for training | |
""" | |
import gym | |
import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
__name__ = predict.py | |
__author__ = Yash Patel | |
__description__ = Full prediction code of OpenAI Cartpole environment using Keras | |
""" | |
import gym | |
import numpy as np | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
__name__ = predict.py | |
__author__ = Yash Patel | |
__description__ = Full prediction code of OpenAI Cartpole environment using Keras | |
""" | |
import gym | |
import numpy as np | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout |