Commit 58614315 authored by Martin Řepa's avatar Martin Řepa

Correct paths

parent 30791328
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)
......
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 = []
......
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment