Util

Here is a list of classes in the package.

Overview:

class neural_network.DataSplitter(path: str, proportions: List[int])[source]

Class to split a dataset into training, validation and testing, given a split ratio.

__init__(path: str, proportions: List[int])[source]

Constructor method

Parameters:
  • path (str) – Path to the .csv file containing the data

  • proportions (List) – The proportions in the sequence training:validation:testing

split() Tuple[DataFrame, ...][source]

Main method for the class - splits the data into train:valid:test

Returns:

A tuple containing the training, validation and testing dataframes or fewer if fewer proportions have been passed

Return type:

Tuple[pd.DataFrame, …]

class neural_network.Partitioner(n: int, m: int)[source]

Class to randomly partition n integers into sets of size m

__call__() List[List[int]][source]

Shuffles all integers from 0 to n - 1 and creates a partition of this list.

Returns:

The partitioned list

Return type:

List[List[int]]

__init__(n: int, m: int)[source]

Constructor method

Parameters:
  • n (int) – Number of integers

  • m (int) – Size of each set

class neural_network.WeightedPartitioner(n: int, m: int, df: DataFrame, do_regression: bool = False, bins: int = 10)[source]

Class to create m sets from a list of n integers weighted by which ground truth class each integer lies in

__call__() List[List[int]][source]

Uses weights for each class to create sets of size m containing integers (sampled with replacement).

Returns:

The list of sets

Return type:

List[List[int]]

__init__(n: int, m: int, df: DataFrame, do_regression: bool = False, bins: int = 10)[source]

Constructor method

Parameters:
  • n (int) – Number of integers

  • m (int) – Number of sets for the partition

  • df (pd.DataFrame) – The classes for the integers

  • do_regression (bool) – Whether we are partitioning regressional or classificational data

  • bins (int) – If regression is True, this represents the number of bins to split the data in to. Otherwise, this parameter is ignored