Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b1835bf

Browse files
Merge branch 'avinashkranjan:master' into master
2 parents fdc6be7 + 08f346f commit b1835bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+166911
-171
lines changed

‎.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

‎.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: 🐛 Bug Report
2+
description: Report a bug report
3+
title: '[Bug]: '
4+
labels: ['🔧 goal: fix']
5+
body:
6+
- type: textarea
7+
id: what-happened
8+
attributes:
9+
label: Describe the bug
10+
placeholder: A clear and concise description of what the bug is.
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: steps-to-reproduce
15+
attributes:
16+
label: Steps to reproduce the behavior
17+
placeholder: |
18+
1. Go to '...'
19+
2. Click on '....'
20+
3. Scroll down to '....'
21+
4. See error
22+
validations:
23+
required: false
24+
- type: textarea
25+
id: expected-behaviour
26+
attributes:
27+
label: Expected behavior
28+
placeholder: A clear and concise description of what you expected to happen.
29+
validations:
30+
required: true
31+
- type: textarea
32+
id: screenshots
33+
attributes:
34+
label: Screenshots
35+
placeholder: If applicable, add screenshots to help explain your problem.
36+
validations:
37+
required: false
38+
- type: dropdown
39+
id: device
40+
attributes:
41+
label: Device?
42+
multiple: true
43+
options:
44+
- Desktop
45+
- Mobile
46+
- type: dropdown
47+
id: operating-system
48+
attributes:
49+
label: Which OS are affected?
50+
multiple: true
51+
options:
52+
- Mac
53+
- Windows
54+
- Linux
55+
- type: textarea
56+
id: version
57+
attributes:
58+
label: Enter the version of your web browser
59+
placeholder: Version
60+
validations:
61+
required: true
62+
- type: dropdown
63+
id: browsers
64+
attributes:
65+
label: Which browsers are affected?
66+
multiple: true
67+
options:
68+
- Firefox
69+
- Chrome
70+
- Safari
71+
- Microsoft Edge
72+
- Brave
73+
- Other
74+
- type: textarea
75+
id: additional-info
76+
attributes:
77+
label: Additional context
78+
placeholder: Add any other context about the problem here.
79+
validations:
80+
required: false
81+
- type: checkboxes
82+
id: terms
83+
attributes:
84+
label: 'Record'
85+
options:
86+
- label: I agree to follow this project's Code of Conduct
87+
required: true
88+
- label: I'm a GSSoC'23 contributor
89+
- label: I want to work on this issue

‎.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ✨ Feature Request
2+
description: Suggest a feature request
3+
title: '[Feat]: '
4+
labels: ['⭐ goal: addition']
5+
body:
6+
- type: textarea
7+
id: what-feature
8+
attributes:
9+
label: Is your feature request related to a problem? Please describe.
10+
placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: solution
15+
attributes:
16+
label: Describe the solution you'd like.
17+
placeholder: A clear and concise description of what you want to happen.
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: alternatives
22+
attributes:
23+
label: Describe alternatives you've considered.
24+
placeholder: A clear and concise description of any alternative solutions or features you've considered.
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: screenshots
29+
attributes:
30+
label: Show us the magic with screenshots
31+
placeholder: Attach screenshots to visualize your idea
32+
validations:
33+
required: false
34+
- type: checkboxes
35+
id: terms
36+
attributes:
37+
label: 'Record'
38+
options:
39+
- label: I agree to follow this project's Code of Conduct
40+
required: true
41+
- label: I'm a GSSoC'23 contributor
42+
- label: I want to work on this issue
43+

‎.github/ISSUE_TEMPLATE/script-addition.md

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: ✨ Script Addition
2+
description: Describe this Script you want to add
3+
title: '[Script]: '
4+
labels: ['⭐ goal: Script-addition']
5+
body:
6+
- type: textarea
7+
id: Aim
8+
attributes:
9+
label: Aim
10+
placeholder: What is the objective of the Script
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: Details
15+
attributes:
16+
label: Details
17+
placeholder: What the features will your script have
18+
validations:
19+
required: true
20+
- type: checkboxes
21+
id: terms
22+
attributes:
23+
label: 'Record'
24+
options:
25+
- label: I agree to follow this project's Code of Conduct
26+
required: true
27+
- label: I'm a GSSoC'23 contributor
28+
- label: I want to work on this issue
29+
30+

‎.github/workflows/py_lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
# Checkout the code base #
3737
##########################
3838
- name: Checkout Code
39-
uses: actions/checkout@v2
39+
uses: actions/checkout@v3
4040
with:
4141
# Full git history is needed to get a proper list of changed files within `super-linter`
4242
fetch-depth: 0
@@ -45,7 +45,7 @@ jobs:
4545
# Run Linter against code base #
4646
################################
4747
- name: Lint Code Base
48-
uses: github/super-linter@v3
48+
uses: github/super-linter@v5
4949
env:
5050
VALIDATE_ALL_CODEBASE: false
5151
VALIDATE_PYTHON: true
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Fri Jun 4 18:02:01 2021
4+
5+
@author: Ayush
6+
"""
7+
8+
import gym
9+
import numpy as np
10+
from IPython.display import clear_output
11+
12+
env = gym.make('Taxi-v3')
13+
14+
episodes = 10
15+
for episode in range(1,episodes):
16+
state = env.reset()
17+
done= False
18+
score=0
19+
20+
while not done:
21+
env.render()
22+
state,reward,done,info = env.step(env.action_space.sample())
23+
score += reward
24+
clear_output(wait=True)
25+
print('Episode: {}\nScore: {}'.format(episode, score))
26+
env.close()
27+
28+
#Creating Q-Table
29+
actions = env.action_space.n
30+
state = env.observation_space.n
31+
32+
q_table = np.zeros((state,actions))
33+
34+
#q_table.shape
35+
#q_table
36+
37+
#Parameters for Q-Learning
38+
num_episodes = 10000
39+
max_steps_per_episode =1000
40+
learning_rate=0.01
41+
discount_rate = 0.99
42+
exploration_rate=1
43+
max_exploration_rate = 1
44+
min_exploration_rate = 0.01
45+
exploration_decay_rate= 0.01
46+
47+
rewards_all_episodes = []
48+
49+
#Q-Learning Algorithm
50+
import random
51+
for episode in range(num_episodes):
52+
state = env.reset()
53+
done = False
54+
reward_current_episode = 0
55+
56+
for step in range(max_steps_per_episode):
57+
#Exploration vs Exploitation trade-off
58+
exploration_threshold = random.uniform(0,1)
59+
if exploration_threshold > exploration_rate:
60+
action = np.argmax(q_table[state,:])
61+
else:
62+
action = env.action_space.sample()
63+
new_state,reward,done,info = env.step(action)
64+
65+
#Update Q-Table
66+
q_table[state,action] = q_table[state,action]*(1-learning_rate)+ learning_rate*(reward + discount_rate * np.max(q_table[new_state, :]))
67+
state=new_state
68+
reward_current_episode += reward
69+
70+
if done== True:
71+
break
72+
exploration_rate = min_exploration_rate + \
73+
(max_exploration_rate- min_exploration_rate) * np.exp(-exploration_decay_rate * episode)
74+
rewards_all_episodes.append(reward_current_episode)
75+
print("***** Training Finished *****")
76+
77+
q_table
78+
79+
#Calculate and print average reward per thousand episodes
80+
rewards_per_thousand_episodes = np.split(np.array(rewards_all_episodes), num_episodes/1000)
81+
count = 1000
82+
83+
print("Average per thousand episodes")
84+
85+
for r in rewards_per_thousand_episodes:
86+
print(count, ":", str(sum(r/1000)))
87+
count+=1000
88+
89+
# Visualize Agent
90+
import time
91+
for episode in range(3):
92+
status = env.reset()
93+
done = False
94+
print("Episode is: "+ str(episode))
95+
time.sleep(1)
96+
97+
for step in range(max_steps_per_episode):
98+
clear_output(wait=True)
99+
env.render()
100+
time.sleep(.4)
101+
102+
action = np.argmax(q_table[state,:])
103+
104+
new_state, reward, done, info = env.step(action)
105+
106+
if done:
107+
clear_output(wait=True)
108+
env.render()
109+
if reward == 1:
110+
print("****Reached Goal****")
111+
time.sleep(2)
112+
clear_output(wait=True)
113+
else:
114+
print("****Failed****")
115+
time.sleep(2)
116+
clear_output(wait=True)
117+
118+
break
119+
state=new_state
120+
env.close()
121+
122+
123+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /