@ -34,6 +34,8 @@ class Hardware :
pass
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 :
- provide a feature space , and rows ( matrix profile )
@ -257,8 +259,6 @@ class Input :
def decode ( self , _matrix , * * _args ) :
#
# _matrix binary matrix
# _values value space given the columns
# columns name of the columns ...
#
columns = _args [ ' columns ' ]
@ -268,8 +268,15 @@ class Input :
#@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()
#
# @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 ( )
# novalues = np.repeat(None,len(self._columns))
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 ( )
return pd . DataFrame ( x , columns = columns )