test_feature_normalization

Module: tests.unittests.nodes.postprocessing.test_feature_normalization

A module that tests the postprocessing node

Author:Andrei Ignat (Andrei_Cristian.Ignat@dfki.de)
Created:2014/06/06

Inheritance diagram for pySPACE.tests.unittests.nodes.postprocessing.test_feature_normalization:

Inheritance diagram of pySPACE.tests.unittests.nodes.postprocessing.test_feature_normalization

Classes

GaussianFeatureNormalizationTestCase

class pySPACE.tests.unittests.nodes.postprocessing.test_feature_normalization.GaussianFeatureNormalizationTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

initializes the GaussianFeatureNormalizationNode

test_no_change()[source]

checks what the node does to already Gaussian data

Principle

1) generate data points for the FeatureVector which already follow the Gaussian distribution 2) train the node using these data points 3) stop the training in order to compute the multiplication variable and the translation variable

In theory, since the data is already Gaussian generated:
  • the multiplication factor should be 1
  • the translation factor should be 0
test_gaussian_normalization()[source]

HistogramFeatureNormalizationTestCase

class pySPACE.tests.unittests.nodes.postprocessing.test_feature_normalization.HistogramFeatureNormalizationTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_no_change()[source]

checks the effect on an already normalized set

Principle
The default data set which we import here is already normalized and as such, the multiplication and translation factors should have no effect on that specific data set.
test_histogram_normalization()[source]

EuclideanFeatureNormalizationTestCase

class pySPACE.tests.unittests.nodes.postprocessing.test_feature_normalization.EuclideanFeatureNormalizationTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_normalization()[source]

compares the FeatureVector result with a manually computed one

Principle
Try to see for int and float data points whether the normalized arrays are the same as the ones obtained by running the nodes

InfinityNormFeatureVisualizationTestCase

class pySPACE.tests.unittests.nodes.postprocessing.test_feature_normalization.InfinityNormFeatureVisualizationTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_normalization()[source]

compares the FeatureVector result with a manually computed one

Principle
Each data point is divided by the maximum data point among the features

OutlierFeatureNormalizationTestCase

class pySPACE.tests.unittests.nodes.postprocessing.test_feature_normalization.OutlierFeatureNormalizationTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_no_outliers()[source]

runs the OutlierFeatureNormalizationNode with no outliers

Principle
No point in the training data set will be considered to be an outlier in the present case. In other words, this test only checks whether the resulting FeatureVector contains data points only within the [0,1] range
test_with_outliers()[source]

test how the class reacts when part of the data is excluded

Principle

In this test, we exclude half of the elements in each feature of the feature vector. The test itself therefore lies in seeing whether the middle half of the dataset is normalized between 0 and 1.

This happens if the following conditions are met:

  • the translation factor excludes(in this particular case) the first and last quarter of the data set
  • the multiplication factor normalizes the array by considering the maximum value to be half of the initial maximum value

The example is best understood by delving into the source code.