Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
张 建国
onn在线训练
Commits
9b22fa8c
Commit
9b22fa8c
authored
Jun 27, 2019
by
Alison Carrera
Browse files
Fixed bug in ths impression and reward subtraction.
parent
32eee798
Changes
2
Show whitespace changes
Inline
Side-by-side
onn/OnlineNeuralNetwork.py
View file @
9b22fa8c
...
...
@@ -185,7 +185,8 @@ class ONN_THS(ONN):
def
predict
(
self
,
X_data
):
pred
=
self
.
predict_
(
X_data
)[
0
]
rewards_0
=
self
.
n_impressions
-
self
.
n_rewards
theta_value
=
np
.
random
.
beta
(
self
.
n_rewards
,
rewards_0
+
1
)
rewards_0
[
rewards_0
<=
0
]
=
1
theta_value
=
np
.
random
.
beta
(
self
.
n_rewards
,
rewards_0
)
ranked_arms
=
np
.
flip
(
np
.
argsort
(
theta_value
),
axis
=
0
)
chosen_arm
=
ranked_arms
[
0
].
item
()
self
.
n_impressions
[
chosen_arm
]
+=
1
...
...
setup.py
View file @
9b22fa8c
...
...
@@ -6,7 +6,7 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description
=
f
.
read
()
setup
(
name
=
'onn'
,
version
=
'0.1.
5
'
,
version
=
'0.1.
6
'
,
description
=
'Online Neural Network'
,
url
=
'https://github.com/alison-carrera/onn'
,
author
=
'Alison Carrera'
,
...
...
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