lore_sa.neighgen.RandomGenerator

class lore_sa.neighgen.RandomGenerator(bbox=None, dataset=None, encoder=None, ocr=0.1)[source]

Random Generator creates neighbor instances by generating random values starting from the instance to explain

__init__(bbox=None, dataset=None, encoder=None, ocr=0.1)[source]

Methods

__init__([bbox, dataset, encoder, ocr])

balance_neigh(x, Z, num_samples)

check_generated([filter_function, check_fuction])

It contains the logic to check the requirements for generated data

generate(x, num_instances, descriptor)

random generation of new instances.

generate_synthetic_instance([from_z, mutpb])

abstract check_generated(filter_function=None, check_fuction=None)

It contains the logic to check the requirements for generated data

generate(x, num_instances, descriptor)[source]

random generation of new instances. The starting instance x is only used to detect the value type of each feature, in order to generate new values only for numeric features.

Parameters
  • x[dict] – the starting instance from the real dataset

  • num_instances[int] – the number of instances to generate

  • descriptor[dict] – data descriptor as generated from a Dataset object. The list (or range) associated to each key is used to randomly choice an element within the list.

Return [TabularDataset]

a tabular dataset instance with the new data generated