test_source_nodes

Module: missions.nodes.source.test_source_nodes

Source nodes to generate test data with specific properties

Using these nodes, the data with defined properties can be used to have a ‘ground truth’. This can be used to test the properties and functionality of entire node chains.

Inheritance diagram for pySPACE.missions.nodes.source.test_source_nodes:

Inheritance diagram of pySPACE.missions.nodes.source.test_source_nodes

Class Summary

SimpleTimeSeriesSourceNode(\*args, \*\*kwargs) A simple test class for unit tests
DataGenerationTimeSeriesSourceNode([...]) Generate data of two classes for testing

Classes

SimpleTimeSeriesSourceNode

class pySPACE.missions.nodes.source.test_source_nodes.SimpleTimeSeriesSourceNode(*args, **kwargs)[source]

Bases: pySPACE.missions.nodes.source.time_series_source.TimeSeriesSourceNode

A simple test class for unit tests

Generates the same data for test and training.

POSSIBLE NODE NAMES:
 
  • SimpleTimeSeriesSource
  • Simple_Test_Source
  • SimpleTimeSeriesSourceNode
POSSIBLE INPUT TYPES:
 
  • TimeSeries

Class Components Summary

request_data_for_testing() Returns the data that can be used for testing of subsequent nodes
__init__(*args, **kwargs)[source]
request_data_for_testing()[source]

Returns the data that can be used for testing of subsequent nodes

DataGenerationTimeSeriesSourceNode

class pySPACE.missions.nodes.source.test_source_nodes.DataGenerationTimeSeriesSourceNode(ir_generator='Adder([Sine(), GaussianNoise()])', nir_generator='GaussianNoise()', ir_items=100, nir_items=100, ir_drift_vector=None, nir_drift_vector=None, channel_names=None, num_channels=16, ir_label='Target', nir_label='Standard', time_points=100, sampling_frequency=1000, shuffle=True, **kwargs)[source]

Bases: pySPACE.missions.nodes.source.time_series_source.TimeSeriesSourceNode

Generate data of two classes for testing

This node can generate data according to the specifications of two different DataGenerators.

It generates objects of the type TimeSeries

Parameters
ir_generator:

A generator of type DataGenerator for data items of the information relevant class. If it is specified in a node chain, it should be given as a string.

(optional, default: 100)

nir_generator:

A generator of type DataGenerator for data items of the not information relevant class. If it is specified in a node chain, it should be given as a string.

(optional, default: 100)

ir_items:

Number of items that should be generated for the ir class.

(optional, default: 100)

nir_items:

Number of items that should be generated for the non ir class.

(optional, default: 100)

channel_names:

List of strings for the channel names. Determines also the number of generated channels.

(optional)

num_channels:

Number of channels. Unused, if channel_names is set.

(optional, default: 16)

ir_label:

The label for the ir_class.

(optional, default: ‘Target’)

nir_label:

The label for the ir_class.

(optional, default: ‘Standard’)

shuffle:

If the data items for the two classes are shuffled.

(optional, default: True)

time_points:

Number of points per channel in a generated TimeSeries object.

(optional, default: 100)

sampling_frequency:
 

Sampling rate of the generated data. Important for sines etc.

A generated time series object has a temporal length of time_points/sampling_frequency

(optional, default: 1000)

ir_drift_vector:
 

Drift of the ir class data. Specify a vector (numpy array) of shape (time_points,num_channels) and the a linear drift in this direction will be added to the generated data: [0 * ir_drift_vector] added to first sample, [1/(ir_items+nir_items) * ir_drift_vector] to the second sample [...] and so on, until [1 * ir_drift_vector] added to last sample.

The specification of the drift vector in the specification can, e.g., be done like this: ir_drift_vector : “eval(__import__(‘numpy’).asarray([[1,1],[2,2]]))”

(optional, default: None)

nir_drift_vector:
 

Drift of the ir class data. See ir_drift_vector.

(optional, default: None)

Exemplary Call

-
    node : Data_Generation_Source
    parameters :
        ir_generator : "Adder([SineGenerator(),GaussianNoiseGenerator()])"
        nir_generator : "GaussianNoiseGenerator()"
Author:

Hendrik Woehrle

Created:

201/07/27

POSSIBLE NODE NAMES:
 
  • DataGenerationTimeSeriesSourceNode
  • DataGenerationTimeSeriesSource
  • Data_Generation_Source
POSSIBLE INPUT TYPES:
 
  • TimeSeries

Class Components Summary

generate_data_set() Generate a dataset using the given generators
set_input_dataset(dataset) Instead of using a given dataset, a new one is generated
__init__(ir_generator='Adder([Sine(), GaussianNoise()])', nir_generator='GaussianNoise()', ir_items=100, nir_items=100, ir_drift_vector=None, nir_drift_vector=None, channel_names=None, num_channels=16, ir_label='Target', nir_label='Standard', time_points=100, sampling_frequency=1000, shuffle=True, **kwargs)[source]
set_input_dataset(dataset)[source]

Instead of using a given dataset, a new one is generated

generate_data_set()[source]

Generate a dataset using the given generators