type_conversion¶
Module: missions.nodes.type_manipulation.type_conversion
¶
Convert feature to prediction vectors and TimeSeries and vice versa
- Known issues
- No unit tests!
Inheritance diagram for pySPACE.missions.nodes.type_manipulation.type_conversion
:
Class Summary¶
Prediction2FeaturesNode ([name]) |
Use the prediction values as features |
Features2PredictionNode (class_labels, \*\*kwargs) |
Use the feature vectors as prediction values |
FeatureVector2TimeSeriesNode ([reshape]) |
Convert feature vector to time series |
Feature2MonoTimeSeriesNode ([store, retrain, ...]) |
Convert feature vector to time series with only one time stamp |
MonoTimeSeries2FeatureNode ([store, retrain, ...]) |
Convert time series with only one time stamp to feature vector |
CastDatatypeNode ([datatype, selected_channels]) |
Changes the datatype of the data |
Function Summary¶
uniquify_list (seq) |
Uniquify a list by preserving its original order |
Classes¶
Prediction2FeaturesNode
¶
-
class
pySPACE.missions.nodes.type_manipulation.type_conversion.
Prediction2FeaturesNode
(name='', **kwargs)[source]¶ Bases:
pySPACE.missions.nodes.base_node.BaseNode
Use the prediction values as features
This node converts the type
PredictionVector
to the typeFeatureVector
. This is needed, whenever one want to feed classification predictions into a node that expects feature vectors (e.g. gating functions).Parameters
name: String. A prefix of the new feature.
(optional, default: ‘’)
Exemplary Call
- node : Prediction2Features parameters : name : "SVM_"
Author: Mario Krell (Mario.Krell@dfki.de)
Created: 2010/08/06
POSSIBLE NODE NAMES: - Prediction2Features
- Prediction2FeaturesNode
POSSIBLE INPUT TYPES: - PredictionVector
Class Components Summary
_execute
(data)Extract the prediction features from the given data get_output_type
(input_type[, as_string])input_types
-
input_types
= ['PredictionVector']¶
Features2PredictionNode
¶
-
class
pySPACE.missions.nodes.type_manipulation.type_conversion.
Features2PredictionNode
(class_labels, **kwargs)[source]¶ Bases:
pySPACE.missions.nodes.base_node.BaseNode
Use the feature vectors as prediction values
This node converts the type
PredictionVector
to the typeFeatureVector
. The feature values are used as individual predictions and the labels are created based on the passed parameter “class_labels”.Parameters
class_labels: List of length two of class_labels
If a feature’s values is larger than 0, the second class label is used as the prediction vector’s label otherwise the first.
Exemplary Call
- node : Features2Prediction parameters : class_labels : ['Standard', 'Target']
Author: Jan Hendrik Metzen (jhm@informatik.uni-bremen.de)
Created: 2010/089/24
POSSIBLE NODE NAMES: - Features2PredictionNode
- Features2Prediction
POSSIBLE INPUT TYPES: - FeatureVector
Class Components Summary
_execute
(data)Extract the prediction features from the given data get_output_type
(input_type[, as_string])input_types
-
input_types
= ['FeatureVector']¶
FeatureVector2TimeSeriesNode
¶
-
class
pySPACE.missions.nodes.type_manipulation.type_conversion.
FeatureVector2TimeSeriesNode
(reshape=False, **kwargs)[source]¶ Bases:
pySPACE.missions.nodes.base_node.BaseNode
Convert feature vector to time series
This node converts the type
PredictionVector
toTimeSeries
. The feature values are extracted and put into their respective place of sensor name and time. The sampling_frequency is also calculated.Parameters
reshape: Assuming, that the data is in a simple structure (the features are sorted first by sensors and second by time), a simple reshape is required and no complex iteration over all entries. This speeds up the transformation and is turned on by this parameter.
If you are unsure, just leave the parameter as it is. With the first incoming sample, the structure will be checked and if possible the parameter changed.
If the structure of your data changes, you should reset this node.
(optional, default: False)
Exemplary Call
- node : FeatureVector2TimeSeries
Author: Mario Michael Krell
Created: 2011/09/23
Refactored: 2013/04/24
POSSIBLE NODE NAMES: - FeatureVector2TimeSeries
- Feature2TimeSeries
- LabeledFeature2TimeSeries
- FeatureVector2TimeSeriesNode
POSSIBLE INPUT TYPES: - FeatureVector
Class Components Summary
_execute
(data)Extract feature values from and match it to their respective sensor name and time get_output_type
(input_type[, as_string])input_types
-
input_types
= ['FeatureVector']¶
Feature2MonoTimeSeriesNode
¶
-
class
pySPACE.missions.nodes.type_manipulation.type_conversion.
Feature2MonoTimeSeriesNode
(store=False, retrain=False, input_dim=None, output_dim=None, dtype=None, kwargs_warning=True, **kwargs)[source]¶ Bases:
pySPACE.missions.nodes.base_node.BaseNode
Convert feature vector to time series with only one time stamp
This node converts the type FeatureVector to TimeSeries. No real mapping of the features to the corresponding times series place is done. Instead every feature is identified with a channel.
The purpose of this node is to enable the user to use time series nodes on feature vectors, especially on feature vectors without any time structure.
Exemplary Call
- node : Feature2MonoTimeSeries
Author: Mario Krell (mario.krell@dfki.de)
Created: 2012/08/31
POSSIBLE NODE NAMES: - Feature2MonoTimeSeriesNode
- Feature2MonoTimeSeries
POSSIBLE INPUT TYPES: - FeatureVector
Class Components Summary
_execute
(data)Identify feature names with channel names _invert
(data)The invert function is needed for the inverse node get_output_type
(input_type[, as_string])input_types
is_invertable
()Inversion is only a mapping of names -
input_types
= ['FeatureVector']¶
MonoTimeSeries2FeatureNode
¶
-
class
pySPACE.missions.nodes.type_manipulation.type_conversion.
MonoTimeSeries2FeatureNode
(store=False, retrain=False, input_dim=None, output_dim=None, dtype=None, kwargs_warning=True, **kwargs)[source]¶ Bases:
pySPACE.missions.nodes.type_manipulation.type_conversion.Feature2MonoTimeSeriesNode
Convert time series with only one time stamp to feature vector
This node converts the type TimeSeries to FeatureVector. Each channel is mapped to one feature.
The purpose of this node is to enable the user to use time series nodes on feature vectors. Especially on feature vectors without any time structure. Therefore this node is the back transformation from the
pySPACE.missions.nodes.type_manipulation.type_conversion.Feature2MonoTimeSeriesNode
Exemplary Call
- node : MonoTimeSeries2Feature
Author: Mario Krell (mario.krell@dfki.de)
Created: 2012/08/31
POSSIBLE NODE NAMES: - MonoTimeSeries2Feature
- MonoTimeSeries2FeatureNode
POSSIBLE INPUT TYPES: - TimeSeries
Class Components Summary
_execute
(data)Identify channel names with feature names _invert
(data)Irrelevant inversion introduced just for completeness get_output_type
(input_type[, as_string])input_types
-
input_types
= ['TimeSeries']¶
CastDatatypeNode
¶
-
class
pySPACE.missions.nodes.type_manipulation.type_conversion.
CastDatatypeNode
(datatype=<type 'numpy.int16'>, selected_channels=None, **kwargs)[source]¶ Bases:
pySPACE.missions.nodes.base_node.BaseNode
Changes the datatype of the data
- Parameters
datatype: Type to cast to.
(optional, default: “eval(numpy.float64)”)
Exemplary Call
- node : CastDatatype
Authors: Hendrik Woehrle (hendrik.woehrle@dfki.de)
Created: 2012/03/29
POSSIBLE NODE NAMES: - CastDatatypeNode
- CastDatatype
POSSIBLE INPUT TYPES: - TimeSeries
Class Components Summary
_execute
(data)Apply the cast get_output_type
(input_type[, as_string])input_types
-
input_types
= ['TimeSeries']¶