This file contains 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
env.close() |
This file contains 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
# Using Epsilon Greedy Policy | |
policy = EpsGreedyQPolicy() | |
# Using Sequential memory with limit of 50000 | |
memory = SequentialMemory(limit=50000, window_length=1) | |
# Initializing DQNAgent | |
dqn = DQNAgent(model=model, nb_actions=nb_actions, memory=memory, nb_steps_warmup=10, target_model_update=1e-2, policy=policy) | |
dqn.compile(Adam(lr=1e-3), metrics=['mae']) |
This file contains 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
model = Sequential() | |
model.add(Flatten(input_shape=(1,) + env.observation_space.shape)) | |
model.add(Dense(16)) | |
model.add(Activation('relu')) | |
model.add(Dense(nb_actions)) | |
model.add(Activation('linear')) | |
print(model.summary()) |
This file contains 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
ENV_NAME = 'Breakout-ram-v0' | |
# Get the environment | |
env = gym.make(ENV_NAME) | |
np.random.seed(33) | |
env.seed(33) | |
# Extract the number of actions available in Breakout, i.e. left and right | |
nb_actions = env.action_space.n |
This file contains 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 numpy as np | |
import gym | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation, Flatten | |
from keras.optimizers import Adam | |
from rl.agents.dqn import DQNAgent | |
from rl.policy import EpsGreedyQPolicy | |
from rl.memory import SequentialMemory |
This file contains 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
sns.heatmap(df.corr()) |
This file contains 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
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k') | |
sns.scatterplot(full_df["Longtitude"], full_df["Lattitude"], hue=full_df["Regionname"]) | |
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.2) | |
plt.title("Lattitude to Longitude for Regionname") |
This file contains 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
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k') | |
sns.scatterplot(full_df["Longtitude"], full_df["Lattitude"], hue=full_df["Type"]) | |
plt.title("Lattitude to Longitude for Type of room") |
This file contains 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
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k') | |
sns.scatterplot(full_df["Longtitude"], full_df["Lattitude"], hue=full_df["Price"], size=full_df["Landsize"]) | |
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.2) | |
plt.title("Lattitude to Longitude with Price and Landsize") |
This file contains 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
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k') | |
sns.violinplot(full_df['Type'], full_df['Price']) | |
plt.title("Violin plot for Type to Price") |