geoist.snoopy package

Submodules

geoist.snoopy.anomaly_detector module

API for Anomaly Detector Module This module detects anomalies in a single time series.

class geoist.snoopy.anomaly_detector.AnomalyDetector(time_series, baseline_time_series=None, score_only=False, score_threshold=None, score_percent_threshold=None, algorithm_name=None, algorithm_params=None, refine_algorithm_name=None, refine_algorithm_params=None, algorithm_class=None)[源代码]

基类:object

get_all_scores()[源代码]

Get anomaly scores. :return: a TimeSeries object represents anomaly scores.

get_anomalies()[源代码]

Get anomalies. :return list: a list of Anomaly objects.

geoist.snoopy.constants module

Constants to use for geoist.snoopy

geoist.snoopy.constants.DEFAULT_DETECTOR_EMA_SIGNIFICANT = 0.94

Correlator Constants

geoist.snoopy.correlator module

API for Correlator Module This module finds correlation between two time series.

class geoist.snoopy.correlator.Correlator(time_series_a, time_series_b, time_period=None, use_anomaly_score=False, algorithm_name=None, algorithm_params=None)[源代码]

基类:object

get_correlation_result()[源代码]

Get correlation result. :return CorrelationResult: a CorrelationResult object.

is_correlated(threshold=0)[源代码]

Compare with a threshold to determine whether two timeseries correlate to each other. :return: a CorrelationResult object if two time series correlate otherwise false.

geoist.snoopy.exceptions module

Exception Classes

exception geoist.snoopy.exceptions.AlgorithmNotFound[源代码]

基类:Exception

Raise when algorithm can not be found.

exception geoist.snoopy.exceptions.InvalidDataFormat[源代码]

基类:Exception

Raise when data has invalid format.

exception geoist.snoopy.exceptions.NotEnoughDataPoints[源代码]

基类:Exception

Raise when there are not enough data points.

exception geoist.snoopy.exceptions.RequiredParametersNotPassed[源代码]

基类:Exception

Raise when algorithm can not be properly initialized because some required parameters are not passed in init.

geoist.snoopy.tsa module

geoist.snoopy.tsa.dejump(dt, th=None, fill_end=True, *args, **kwargs)[源代码]
geoist.snoopy.tsa.departure(data, freq='M')[源代码]

Calculate departure(ju4ping2 in Chinese)

参数
  • data (Series or 1-column DataFrame) -- Data to be processed

  • freq (str) -- M==Month,D==Day

返回

DataFrame

geoist.snoopy.tsa.despike(dt, th=None, fill_end=True, *args, **kwargs)[源代码]
geoist.snoopy.tsa.despike_v2(dt, th=None, fill_end=True, *args, **kwargs)[源代码]
geoist.snoopy.tsa.print_adf(res, data_name, file=<colorama.ansitowin32.StreamWrapper object>)[源代码]

geoist.snoopy.utils module

Utilities for snoopy

geoist.snoopy.utils.compute_ema(smoothing_factor, points)[源代码]

Compute exponential moving average of a list of points. :param float smoothing_factor: the smoothing factor. :param list points: the data points. :return list: all ema in a list.

geoist.snoopy.utils.pbinom(k, n)[源代码]

Compute cdf for binomial with prob = 0.5 compare to R pbinom :param k: :param n: :return: cumulative probability

geoist.snoopy.utils.qbinom(p, n)[源代码]

quantile function for binomial with probability of success 0.5 returns smallest k such that Prob(X <= k) >= p compare to R qbinom :param n: number :param p: quantile level :return: k

geoist.snoopy.utils.read_csv(csv_name)[源代码]

Read data from a csv file into a dictionary. :param str csv_name: path to a csv file. :return dict: a dictionary represents the data in file.

geoist.snoopy.utils.to_epoch(t_str)[源代码]

Covert a timestamp string to an epoch number. :param str t_str: a timestamp string. :return int: epoch number of the timestamp.

Module contents

class geoist.snoopy.Snoopy(anomalies, correlations)[源代码]

基类:object

get_root_causes()[源代码]

Get root causes. :return dict: a dict represents root causes for each anomaly.