Exemplo n.º 1
0
def find_confidence(segment: pd.Series) -> (float, float):
    segment = utils.check_nan_values(segment)
    segment_min = min(segment)
    segment_max = max(segment)
    height = segment_max - segment_min
    if height:
        return (CONFIDENCE_FACTOR * height, height)
    else:
        return (0, 0)
Exemplo n.º 2
0
def get_correlation(segments: list, av_model: list, data: pd.Series, window_size: int) -> list:
    labeled_segment = []
    correlation_list = []
    p_value_list = []
    for segment in segments:
        labeled_segment = utils.get_interval(data, segment, window_size)
        labeled_segment = utils.subtract_min_without_nan(labeled_segment)
        labeled_segment = utils.check_nan_values(labeled_segment)
        correlation = pearsonr(labeled_segment, av_model)
        correlation_list.append(correlation[0])
        p_value_list.append(correlation[1])
    return correlation_list
Exemplo n.º 3
0
def get_convolve(segments: list, av_model: list, data: pd.Series, window_size: int) -> list:
    labeled_segment = []
    convolve_list = []
    for segment in segments:
        labeled_segment = utils.get_interval(data, segment, window_size)
        labeled_segment = utils.subtract_min_without_nan(labeled_segment)
        labeled_segment = utils.check_nan_values(labeled_segment)
        auto_convolve = scipy.signal.fftconvolve(labeled_segment, labeled_segment)
        convolve_segment = scipy.signal.fftconvolve(labeled_segment, av_model)
        if len(auto_convolve) > 0:
            convolve_list.append(max(auto_convolve))
        if len(convolve_segment) > 0:
            convolve_list.append(max(convolve_segment))
    return convolve_list