src.dackar.anomalies.t_score ============================ .. py:module:: src.dackar.anomalies.t_score .. autoapi-nested-parse:: Created on July, 2025 @author: wangc, mandd Attributes ---------- .. autoapisummary:: src.dackar.anomalies.t_score.logger Functions --------- .. autoapisummary:: src.dackar.anomalies.t_score.getL src.dackar.anomalies.t_score.omega src.dackar.anomalies.t_score.choice src.dackar.anomalies.t_score.t_score src.dackar.anomalies.t_score.MMD_test src.dackar.anomalies.t_score.event2TStest Module Contents --------------- .. py:data:: logger .. py:function:: getL(loc, window, array, type) Method designed to extract a portion of a time series :param loc: int, reference location in the time series for the selected portion :param window: np.array, size of the selected portion of the time series :param array: np.array, original time series :param type: string, type of the selected portion of the time series (rear or front) :returns: np array, size of the selected portion of the time series :rtype: timeseriesPortion .. py:function:: omega(window, array, Nsamples) Method designed to extract set of portions of a time series :param window: np.array, size of the selected portion of the time series :param array: np.array, original time series :param Nsamples: int, number of portions to be selected :returns: np.array, set of Nsamples portions of a time series :rtype: omegaSet .. py:function:: choice(array, Nsamples) Method designed to randomly choose Nsamples out of an array (replace is set to True) :param array: np.array, array of values to be sampled :param Nsamples: int, number of elements of array to be selected :returns: np.array, set of Nsamples elements randomly chosen from array :rtype: sampled .. py:function:: t_score(array_front, array_rear) Method designed to calculate the statistical difference between two arrays using t-test :param array_front: np.array, first array :param array_rear: np.array, second array :returns: float, outcome of t-test :rtype: tscore .. py:function:: MMD_test(test_array, omegaSet, iterations, alphaTest, alphaOmegaset, printFlag=True) Method designed to calculate the statistical difference between an array and a set of arrays using the Maximum Mean Discrepancy testing method :param test_array: np.array, array of values to be tested against omegaSet :param omegaSet: np.ndarray or list, population of arrays :param iterations: int, number of iterartions required to compute MMD^2_u :param alphaTest: float, acceptance value for hypothesis testing (single array testing) :param alphaOmegaset: float, acceptance value for hypothesis testing (omegaSet testing) :param printFlag: bool, flag to plot MMD distribution :returns: float, p-value obtained from MMD testing testOutput: bool, logical outcome of MMD testing :rtype: p_value .. py:function:: event2TStest(E_loc, TS, iterations, alphaTest, alphaOmegaset, windowSize, omegaSize, returnMinPval=False) Method designed to assess temporal correlation of an event E and a time series TS :param E_loc: int, temporal location of event E :param TS: np.array, univariate time series :param iterations: int, number of iterartions required to compute MMD^2_u :param alphaTest: float, acceptance value for hypothesis testing (single array testing) :param alphaOmegaset: float, acceptance value for hypothesis testing (omegaSet testing) :param windowSize: int, size of time window prior and after event occurence :param omegaSize: int, number of samples from time series TS :param returnMinPval: bool, flag that indictae whether to return p-value of MMD assessment :returns: string, outcome of the event to timeseries temporal analysis minPval: float, p-value of MMD assessment :rtype: relation