Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Martin Řepa
bachelor-thesis
Commits
58614315
Commit
58614315
authored
Feb 12, 2019
by
Martin Řepa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct paths
parent
30791328
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
src/config.py
src/config.py
+3
-4
src/data/loader.py
src/data/loader.py
+3
-2
src/game_solver.py
src/game_solver.py
+1
-1
No files found.
src/config.py
View file @
58614315
from
pathlib
import
Path
from
typing
import
Callable
import
attr
...
...
@@ -30,9 +29,9 @@ class NeuralNetworkConfig:
@
attr
.
s
class
TrainingNnConfig
:
#
Path to
.csv file with scored data which will
be used as benign data
# in neural network training phase
benign_data_file_
path
:
Path
=
attr
.
ib
(
default
=
Path
(
'src/data/scored/
all_benign_scored.csv'
)
)
#
Name of
.csv file
in src/data/scored directory
with scored data which will
#
be used as benign data
in neural network training phase
benign_data_file_
name
:
str
=
attr
.
ib
(
default
=
'
all_benign_scored.csv'
)
# Number of benign records to be used
benign_data_count
:
int
=
attr
.
ib
(
default
=
1000
)
...
...
src/data/loader.py
View file @
58614315
from
os.path
import
dirname
from
pathlib
import
Path
import
numpy
as
np
import
pandas
def
np_arrays_from_scored_csv
(
file
:
Path
,
label
:
int
,
def
np_arrays_from_scored_csv
(
file
_name
:
str
,
label
:
int
,
count_max
:
int
=
None
,
shuffle
=
False
):
"""
Returns 2 x N array
...
...
@@ -13,7 +14,7 @@ def np_arrays_from_scored_csv(file: Path, label: int,
See usage in main
"""
content
=
pandas
.
read_csv
(
file
)
content
=
pandas
.
read_csv
(
Path
(
dirname
(
__file__
))
/
Path
(
'scored'
)
/
Path
(
file_name
)
)
batch
=
[]
labels
=
[]
...
...
src/game_solver.py
View file @
58614315
...
...
@@ -28,7 +28,7 @@ class GameSolver:
self
.
utility
=
conf
.
base_conf
.
utility_function
train
=
conf
.
nn_train_conf
self
.
benign_data
=
np_arrays_from_scored_csv
(
train
.
benign_data_file_
path
,
self
.
benign_data
=
np_arrays_from_scored_csv
(
train
.
benign_data_file_
name
,
0
,
train
.
benign_data_count
)
def
_get_trained_nn
(
self
,
attacker_features_x
:
List
[
List
[
float
]])
->
NeuralNetwork
:
...
...
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