Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions DDPG/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def parser(self):
help='Play using pre-trained models'
)
argcomplete.autocomplete(argparser)
args = argparser.parse_args()

return args
return argparser.parse_args()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Agent.parser refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)


def initialize_env(self, args):
self.env_name = args.env
Expand Down Expand Up @@ -139,8 +137,7 @@ def save_model(self, model):
return

def load_model(self):
model = None
return model
return None
Comment on lines -142 to +140
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Agent.load_model refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)


def play(self):
model = self.load_model()
Expand Down
4 changes: 1 addition & 3 deletions DQN/q_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def parser(self):
help='Number of episodes to run'
)
argcomplete.autocomplete(argparser)
args = argparser.parse_args()

return args
return argparser.parse_args()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Agent.parser refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)


def initialize_env(self, args):
self.env_name = args.env
Expand Down
10 changes: 4 additions & 6 deletions GenericNN/cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def init_population(initial_games,name):
#init_population()

def neural_network_model():
model = tf.keras.Sequential([
return tf.keras.Sequential([
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function neural_network_model refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

tf.keras.layers.Dense(128, activation='relu', input_shape=(4,)),
tf.keras.layers.Dropout(drop),
tf.keras.layers.Dense(256, activation='relu'),
Expand All @@ -74,7 +74,6 @@ def neural_network_model():
tf.keras.layers.Dropout(drop),
tf.keras.layers.Dense(2, activation='softmax')
])
return model

def play(model):
number_games = 10
Expand Down Expand Up @@ -132,8 +131,7 @@ def train_model(x_train, y_train, x_test, y_test):
return model

def loadmodel(name):
model = tf.keras.models.load_model(name)
return model
return tf.keras.models.load_model(name)
Comment on lines -135 to +134
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function loadmodel refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)


def lets_play():
#generate_data_sets()
Expand All @@ -151,7 +149,7 @@ def lets_play():


def some_random_games_first():
for episode in range(5):
for _ in range(5):
Comment on lines -154 to +152
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function some_random_games_first refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

env.reset()
for t in range(goal_steps):
env.render()
Expand All @@ -163,7 +161,7 @@ def some_random_games_first():
env.close()

def env_test():
for i_episode in range(20):
for _ in range(20):
Comment on lines -166 to +164
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function env_test refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

observation = env.reset()
for t in range(100):
env.render()
Expand Down
4 changes: 1 addition & 3 deletions Q-table/q_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ def parser(self):
help='Size of state space'
)
argcomplete.autocomplete(argparser)
args = argparser.parse_args()

return args
return argparser.parse_args()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function QLearning.parser refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)


def initialize_env(self, args):
self.env = args.env
Expand Down