Python/High_acquisition_rate_TSFRESH/unified_bib.py
def tsfresh_NaN_filter(output_id,fft=False):
    """
    Given an output_id, this function
    withdraw all NaN features from the 
    TSFRESH extraction; 

    Inputs: 
        -output_id: str() -> the given id
        -fft: True or False -> filter fft features
    
    Outputs:
        - Saves via picklen in ./Kernel/ 
        an extraction dictonary without 
        features that generates NaN
    """

    df = tsfresh_chucksize_test(output_id)
    features = df.columns
    nan_columns = []
    for col in features:
        data = df.loc[:,col].values
        nan_test = np.isnan(data)
        aux  = col.split('__')[1].split('_')[0]
        if aux == 'fft' and fft == True:
            nan_columns.append(col)
        
        elif any(nan == True for nan in nan_test):
            nan_columns.append(col)

    print('Percentage of invalid features: ', len(nan_columns)*100/len(features))

    valid_features = []

    for i in range(len(features)):
        if features[i] not in nan_columns:
            valid_features.append(features[i])
            
    print('Percentage of valid features: ', len(valid_features)*100/len(features))

    valid_features_dict = from_columns(valid_features)

    with open('Kernel/valid_features_dict.pkl', 'wb') as f:
            pickle.dump(valid_features_dict, f)

    return

    Given an output_id, this function
    withdraw all NaN features from the 
    TSFRESH extraction; 

    Inputs: 
        -output_id: str() -> the given id
        -fft: True or False -> filter fft features
    
    Outputs:
        - Saves via picklen in ./Kernel/ 
        an extraction dictonary without 
        features that generates NaN
    
Given an output_id, this function
withdraw all NaN features from the
TSFRESH extraction.

> the given id
fft: True or False -> filter fft features

Saves via picklen in ./Kernel
an extraction dictonary without
features that generates NaN
Given an output_id this function withdraw all NaN features from the TSFRESH extraction . > the given id fft : True or False - > filter fft features Saves via picklen in . / Kernel an extraction dictonary without features that generates NaN
def tsfresh_NaN_filter(output_id,fft=False):
    df = tsfresh_chucksize_test(output_id)
    features = df.columns
    nan_columns = []
    for col in features:
        data = df.loc[:,col].values
        nan_test = np.isnan(data)
        aux  = col.split('__')[1].split('_')[0]
        if aux == 'fft' and fft == True:
            nan_columns.append(col)
        elif any(nan == True for nan in nan_test):
            nan_columns.append(col)
    print('Percentage of invalid features: ', len(nan_columns)*100/len(features))
    valid_features = []
    for i in range(len(features)):
        if features[i] not in nan_columns:
            valid_features.append(features[i])
    print('Percentage of valid features: ', len(valid_features)*100/len(features))
    valid_features_dict = from_columns(valid_features)
    with open('Kernel/valid_features_dict.pkl', 'wb') as f:
            pickle.dump(valid_features_dict, f)
    return
def tsfresh_NaN_filter ( output_id , fft = False ) : df = tsfresh_chucksize_test ( output_id ) features = df . columns nan_columns = [ ] for col in features : data = df . loc [ : , col ] . values nan_test = np . isnan ( data ) aux = col . split ( '__' ) [ 1 ] . split ( '_' ) [ 0 ] if aux == 'fft' and fft == True : nan_columns . append ( col ) elif any ( nan == True for nan in nan_test ) : nan_columns . append ( col ) print ( 'Percentage of invalid features: ' , len ( nan_columns ) * 100 / len ( features ) ) valid_features = [ ] for i in range ( len ( features ) ) : if features [ i ] not in nan_columns : valid_features . append ( features [ i ] ) print ( 'Percentage of valid features: ' , len ( valid_features ) * 100 / len ( features ) ) valid_features_dict = from_columns ( valid_features ) with open ( 'Kernel/valid_features_dict.pkl' , 'wb' ) as f : pickle . dump ( valid_features_dict , f ) return
Given an output_id, this function
withdraw all NaN features from the
TSFRESH extraction;
Given an output_id this function withdraw all NaN features from the TSFRESH extraction ;
"""
    Given an output_id, this function
    withdraw all NaN features from the 
    TSFRESH extraction; 

    Inputs: 
        -output_id: str() -> the given id
        -fft: True or False -> filter fft features
    
    Outputs:
        - Saves via picklen in ./Kernel/ 
        an extraction dictonary without 
        features that generates NaN
    """
output_id
fft