@ -34,6 +34,8 @@ class Hardware :
pass
pass
class Input :
class Input :
class NOVALUES :
RANDOM , IGNORE , ALWAYS = [ ' random ' , ' ignore ' , ' always ' ]
"""
"""
This class is designed to read data from a source and and perform a variet of operations :
This class is designed to read data from a source and and perform a variet of operations :
- provide a feature space , and rows ( matrix profile )
- provide a feature space , and rows ( matrix profile )
@ -257,8 +259,6 @@ class Input :
def decode ( self , _matrix , * * _args ) :
def decode ( self , _matrix , * * _args ) :
#
#
# _matrix binary matrix
# _matrix binary matrix
# _values value space given the columns
# columns name of the columns ...
#
#
columns = _args [ ' columns ' ]
columns = _args [ ' columns ' ]
@ -268,8 +268,15 @@ class Input :
#@TODO: Provide random values for things that are missing
#@TODO: Provide random values for things that are missing
# x = _matrix.apply(lambda row: _values[row.values == 1].tolist()[0] if (row.values == 1).sum() > 0 else np.repeat(None,len(self._columns)) ,axis=1).tolist()
# x = _matrix.apply(lambda row: _values[row.values == 1].tolist()[0] if (row.values == 1).sum() > 0 else np.repeat(None,len(self._columns)) ,axis=1).tolist()
novalues = _values [ np . random . choice ( len ( _values ) , 1 ) [ 0 ] ] . tolist ( )
#
# novalues = np.repeat(None,len(self._columns))
# @TODO: Provide a parameter to either:
# - missing = {outlier,random,none}
# - outlier: select an outlier, random: randomly select a value, none: do nothing ...
#
if np . random . choice ( [ 0 , 1 ] , 1 ) [ 0 ] :
novalues = _values [ np . random . choice ( len ( _values ) , 1 ) [ 0 ] ] . tolist ( )
else :
novalues = np . repeat ( None , len ( self . _columns ) )
x = _matrix . apply ( lambda row : _values [ row . values == 1 ] . tolist ( ) [ 0 ] if ( row . values == 1 ) . sum ( ) > 0 else novalues , axis = 1 ) . tolist ( )
x = _matrix . apply ( lambda row : _values [ row . values == 1 ] . tolist ( ) [ 0 ] if ( row . values == 1 ) . sum ( ) > 0 else novalues , axis = 1 ) . tolist ( )
return pd . DataFrame ( x , columns = columns )
return pd . DataFrame ( x , columns = columns )