Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DAPPLE-2.0
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rania Talbi
DAPPLE-2.0
Commits
6fe99473
Commit
6fe99473
authored
3 years ago
by
rtalbi
Browse files
Options
Downloads
Patches
Plain Diff
non-privacy presrerving neural networks (finished code, started debug)
parent
64b78c68
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ML/NN/NN.cpp
+41
-8
41 additions, 8 deletions
ML/NN/NN.cpp
with
41 additions
and
8 deletions
ML/NN/NN.cpp
+
41
−
8
View file @
6fe99473
...
@@ -221,34 +221,67 @@ void NN::train () //
...
@@ -221,34 +221,67 @@ void NN::train () //
}
}
//todo : transform this method so that prediction happens for fa test batch
void
NN
::
Test
(
){
void
NN
::
Test
(
){
int
counter
=
0
;
int
counter
=
0
;
int
recordCounter
=
0
;
int
size
=
dt
->
test_size
;
int
size
=
dt
->
test_size
;
Record
*
record
;
Record
*
record
;
vector
<
Record
*>
XB
;
int
label
;
int
label
;
int
sizeBatch
=
batchSize
;
std
::
ofstream
classOutput
;
std
::
ofstream
classOutput
;
classOutput
.
open
(
logfile
);
classOutput
.
open
(
logfile
);
extTestBd
=
0
;
extTestBd
=
0
;
auto
begin
=
chrono
::
high_resolution_clock
::
now
();
auto
begin
=
chrono
::
high_resolution_clock
::
now
();
while
(
counter
<
size
)
{
while
(
counter
<
size
)
{
counter
++
;
if
(
size
-
counter
<
batchSize
)
sizeBatch
=
size
-
counter
;
label
=
predict
(
record
,
true
);
if
(
classOutput
.
is_open
())
for
(
recordCounter
=
0
;
recordCounter
<
sizeBatch
;
recordCounter
++
)
{
{
try
{
classOutput
<<
label
<<
endl
;
record
=
dt
->
getTrainRecord
();
XB
.
push_back
(
record
);
extTrainBd
+=
record
->
values
.
size
()
+
1
;
counter
++
;
}
catch
(
std
::
exception
const
&
e
)
{
cout
<<
e
.
what
()
<<
endl
;
}
}
vector
<
int
>
prediction
=
predict
(
XB
,
true
);
for
(
int
k
=
0
;
k
<
prediction
.
size
();
k
++
)
{
int
label
=
prediction
[
k
];
if
(
classOutput
.
is_open
())
{
classOutput
<<
label
<<
endl
;
}
}
for
(
int
i
=
0
;
i
<
XB
.
size
();
i
++
)
{
delete
XB
[
i
];
}
}
delete
record
;
XB
.
clear
();
}
}
auto
end
=
chrono
::
high_resolution_clock
::
now
();
auto
end
=
chrono
::
high_resolution_clock
::
now
();
std
::
chrono
::
duration
<
double
,
std
::
milli
>
duration
=
end
-
begin
;
std
::
chrono
::
duration
<
double
,
std
::
milli
>
duration
=
end
-
begin
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment