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
2589b988
Commit
2589b988
authored
Jun 17, 2019
by
Alison Carrera
Browse files
Removed predicted proba.
parent
fcf28d38
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
2589b988
...
...
@@ -22,12 +22,8 @@ onn_network.partial_fit(np.asarray([[0.8, 0.5]]), np.asarray([1]))
#Predict classes
predictions
=
onn_network
.
predict
(
np
.
asarray
([[
0.1
,
0.2
],
[
0.8
,
0.5
]]))
Predictions
--
array
([
1
,
1
])
Predictions
--
array
([
1
,
0
])
#Predict classes probabilities
predictions
=
onn_network
.
predict_proba
(
np
.
asarray
([[
0.1
,
0.2
],
[
0.8
,
0.5
]]))
Predictions
--
array
([[
0.5048331
,
0.50083154
],[
0.49516693
,
0.49916846
]],
dtype
=
float32
)
```
## New features
...
...
@@ -37,7 +33,6 @@ Predictions -- array([[0.5048331 , 0.50083154],[0.49516693, 0.49916846]], dtype=
## Contributors
-
[
Alison de Andrade Carrera
](
https://github.com/alison-carrera
)
-
[
Fábio Silva Vilas Boas
](
https://github.com/fabiosvb
)
## References
-
[
Online Deep Learning: Learning Deep Neural Networks on the Fly
](
https://arxiv.org/abs/1711.03705
)
onn/OnlineNeuralNetwork.py
View file @
2589b988
...
...
@@ -127,22 +127,19 @@ class ONN():
if
len
(
data
.
shape
)
!=
1
:
raise
Exception
(
"Wrong dimension for this Y data. It should have only one dimensions."
)
def
partial_fit
(
self
,
X_data
,
Y_data
,
show_loss
=
True
):
def
partial_fit
_
(
self
,
X_data
,
Y_data
,
show_loss
=
True
):
self
.
validate_input_X
(
X_data
)
self
.
validate_input_Y
(
Y_data
)
self
.
update_weights
(
X_data
,
Y_data
,
show_loss
)
def
predict_proba
(
self
,
X_data
):
self
.
validate_input_X
(
X_data
)
result
=
torch
.
softmax
(
torch
.
sum
(
torch
.
mul
(
self
.
alpha
.
view
(
self
.
max_num_hidden_layers
,
1
).
repeat
(
1
,
len
(
X_data
)).
view
(
self
.
max_num_hidden_layers
,
len
(
X_data
),
1
),
self
.
forward
(
X_data
)),
0
),
0
)
result
[
torch
.
isnan
(
result
)]
=
0
return
result
.
data
.
cpu
().
numpy
()
def
partial_fit
(
self
,
X_data
,
Y_data
,
show_loss
=
True
):
self
.
partial_fit_
(
X_data
,
Y_data
,
show_loss
)
def
predict
(
self
,
X_data
):
def
predict
_
(
self
,
X_data
):
self
.
validate_input_X
(
X_data
)
return
torch
.
argmax
(
torch
.
sum
(
torch
.
mul
(
self
.
alpha
.
view
(
self
.
max_num_hidden_layers
,
1
).
repeat
(
1
,
len
(
X_data
)).
view
(
self
.
max_num_hidden_layers
,
len
(
X_data
),
1
),
self
.
forward
(
X_data
)),
0
),
dim
=
1
).
cpu
().
numpy
()
def
predict
(
self
,
X_data
):
return
self
.
predict_
(
X_data
)
setup.py
View file @
2589b988
...
...
@@ -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.0.
5
'
,
version
=
'0.0.
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