Skip to content

Instantly share code, notes, and snippets.

View vivekpadia70's full-sized avatar
🏠
Working from home

vivekpadia70 vivekpadia70

🏠
Working from home
View GitHub Profile
env.close()
# 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'])
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())
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
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
sns.heatmap(df.corr())
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")
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")
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")
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")