voxseg_/extract_feats.py
def normalize(data: pd.DataFrame) -> pd.DataFrame:
    '''Function for normalizing features using z-score normalization.

    Args:
        data: A pd.DataFrame containing dataset information and features generated by extract().
    
    Returns:
        A pd.DataFrame containing normalized features and metadata.
    '''

    data = data.copy()
    mean_std = data['features'].groupby(data['recording-id']).apply(_get_mean_std)
    mean_std = mean_std.reset_index()
    if 'level_1' in mean_std.columns:
        mean_std = mean_std.drop(['level_1'], axis=1)
    else:
        mean_std = mean_std.drop(['index'], axis=1)
    if 'recording-id' in mean_std.columns:
        data = data.merge(mean_std, on='recording-id')
    else:
        data = pd.concat([data, mean_std], axis=1)
                
    print('--------------- Normalizing features --------------')
    data['normalized-features'] = data.apply(_calculate_norm, axis = 1)
    data = data.drop(['features', 'mean', 'std'], axis=1)
   
    return data
Function for normalizing features using z-score normalization.

    Args:
        data: A pd.DataFrame containing dataset information and features generated by extract().
    
    Returns:
        A pd.DataFrame containing normalized features and metadata.
    
Function for normalizing features using z-score normalization.
Function for normalizing features using z - score normalization .
def normalize(data: pd.DataFrame) -> pd.DataFrame:
    data = data.copy()
    mean_std = data['features'].groupby(data['recording-id']).apply(_get_mean_std)
    mean_std = mean_std.reset_index()
    if 'level_1' in mean_std.columns:
        mean_std = mean_std.drop(['level_1'], axis=1)
    else:
        mean_std = mean_std.drop(['index'], axis=1)
    if 'recording-id' in mean_std.columns:
        data = data.merge(mean_std, on='recording-id')
    else:
        data = pd.concat([data, mean_std], axis=1)
    print('--------------- Normalizing features --------------')
    data['normalized-features'] = data.apply(_calculate_norm, axis = 1)
    data = data.drop(['features', 'mean', 'std'], axis=1)
    return data
def normalize ( data : pd . DataFrame ) -> pd . DataFrame : data = data . copy ( ) mean_std = data [ 'features' ] . groupby ( data [ 'recording-id' ] ) . apply ( _get_mean_std ) mean_std = mean_std . reset_index ( ) if 'level_1' in mean_std . columns : mean_std = mean_std . drop ( [ 'level_1' ] , axis = 1 ) else : mean_std = mean_std . drop ( [ 'index' ] , axis = 1 ) if 'recording-id' in mean_std . columns : data = data . merge ( mean_std , on = 'recording-id' ) else : data = pd . concat ( [ data , mean_std ] , axis = 1 ) print ( '--------------- Normalizing features --------------' ) data [ 'normalized-features' ] = data . apply ( _calculate_norm , axis = 1 ) data = data . drop ( [ 'features' , 'mean' , 'std' ] , axis = 1 ) return data
Function for normalizing features using z-score normalization.
Function for normalizing features using z - score normalization .
'''Function for normalizing features using z-score normalization.

    Args:
        data: A pd.DataFrame containing dataset information and features generated by extract().
    
    Returns:
        A pd.DataFrame containing normalized features and metadata.
    '''
A pd.DataFrame containing normalized features and metadata.
A pd . DataFrame containing normalized features and metadata .
data
pd.DataFrame
A pd.DataFrame containing dataset information and features generated by extract().
A pd . DataFrame containing dataset information and features generated by extract () .