Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SpartanBotsOutlab67
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roshan Rabinarayan
SpartanBotsOutlab67
Commits
70a324d1
Commit
70a324d1
authored
Oct 01, 2020
by
Sanchit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uploading q1-d and some part of q5
parent
533bbf2a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletion
+63
-1
q1/triwizard.py
q1/triwizard.py
+21
-1
q5/q5.py
q5/q5.py
+42
-0
No files found.
q1/triwizard.py
View file @
70a324d1
...
...
@@ -95,7 +95,27 @@ def alohomora(n, m):
# 'axis': str; axis ∈ {'X','Y','Z'}
# return type: float Ndarray; dim: Nx3
def
expelliarmus
(
arr
,
theta
,
axis
):
pass
angle
=
np
.
radians
(
-
theta
)
c
,
s
=
np
.
cos
(
angle
),
np
.
sin
(
angle
)
rot_array_x
=
np
.
array
([[
1
,
0
,
0
],
[
0
,
c
,
-
s
],
[
0
,
s
,
c
]])
rot_array_y
=
np
.
array
([[
c
,
0
,
s
],
[
0
,
1
,
0
],
[
-
s
,
0
,
c
]])
rot_array_z
=
np
.
array
([[
c
,
-
s
,
0
],
[
s
,
c
,
0
],
[
0
,
0
,
1
]])
if
axis
==
'X'
:
res
=
np
.
dot
(
mat
,
rot_array_x
)
return
(
res
.
round
(
decimals
=
2
))
if
axis
==
'Y'
:
res
=
np
.
dot
(
mat
,
rot_array_y
)
return
(
res
.
round
(
decimals
=
2
))
if
axis
==
'Z'
:
res
=
np
.
dot
(
mat
,
rot_array_z
)
return
(
res
.
round
(
decimals
=
2
))
# ---- Task (e) -------
...
...
q5/q5.py
View file @
70a324d1
import
pandas
as
pd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
csv
i1
=
[]
i2
=
[]
i3
=
[]
with
open
(
'data.csv'
,
newline
=
''
)
as
csvfile
:
csvreader
=
csv
.
reader
(
csvfile
)
for
row
in
csvreader
:
if
row
[
0
]
==
"instance-1"
:
i1
.
append
(
row
)
elif
row
[
0
]
==
"instance-2"
:
i2
.
append
(
row
)
elif
row
[
0
]
==
"instance-3"
:
i3
.
append
(
row
)
instance_1
=
pd
.
DataFrame
(
i1
)
instance_1
.
columns
=
[
'instance'
,
'algorithm'
,
'random_seed'
,
'epsilon'
,
'horizon'
,
'regret'
]
instance_2
=
pd
.
DataFrame
(
i2
)
instance_3
=
pd
.
DataFrame
(
i3
)
#instance_1.set_index('horizon', inplace=True)
#instance_1.groupby(['algorithm'])['regret'].plot(legend=True)
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
12
,
5
))
for
key
,
grp
in
instance_1
.
groupby
([
'algorithm'
]):
ax
.
plot
(
grp
[
'horizon'
],
grp
[
'regret'
],
label
=
key
,
marker
=
'o'
)
ax
.
legend
()
plt
.
xscale
(
"log"
)
plt
.
yscale
(
"log"
)
plt
.
show
()
#grouped_df=instance_1.groupby(['algorithm'])
#for key, item in grouped_df:
#print(grouped_df.get_group(key), "\n\n")
#instance_1.plot(kind='scatter',x='horizon',y='regret',color='red')
#plt.xscale("log")
#plt.yscale("log")
#plt.show()
#data.groupby(level="instance",axis=0)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment