tsadmetrics 0.1.8__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tsadmetrics-0.1.8/tsadmetrics.egg-info → tsadmetrics-0.1.9}/PKG-INFO +1 -1
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/pyproject.toml +1 -1
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/setup.py +1 -1
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/_integral_interval.py +22 -22
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/nabscore.py +2 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9/tsadmetrics.egg-info}/PKG-INFO +1 -1
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/MANIFEST.in +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/README.md +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/activate_this.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2html.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2html4.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2html5.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2latex.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2man.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2odt.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2odt_prepstyles.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2pseudoxml.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2s5.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2xetex.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rst2xml.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/entorno/bin/rstpep2html.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/setup.cfg +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tests/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tests/test_binary.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tests/test_non_binary.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/_affiliation_zone.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/_single_ground_truth_event.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/generics.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/metrics.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/auc_roc_pr_plot.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/discontinuity_graph.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/DataManage/File_IO.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/DataManage/Range.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/DataManage/Time_Plot.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/DataManage/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/etapr.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/tapr.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/latency_sparsity_aware.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/metrics.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/base/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/base/time_series_metrics.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/basic_metrics_ts.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/__init__.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/fscore.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/precision.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/precision_recall.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/recall.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/tests.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/threshold_plt.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/time_tolerant.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/vus_utils.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/binary_metrics.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/metric_utils.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/non_binary_metrics.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/py.typed +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/utils.py +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics.egg-info/SOURCES.txt +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics.egg-info/dependency_links.txt +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics.egg-info/requires.txt +0 -0
- {tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics.egg-info/top_level.txt +0 -0
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="tsadmetrics",
|
8
|
-
version="0.1.
|
8
|
+
version="0.1.9",
|
9
9
|
author="Pedro Rafael Velasco Priego",
|
10
10
|
author_email="i12veprp@uco.es",
|
11
11
|
description="A library for time series anomaly detection metrics and evaluation.",
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/_integral_interval.py
RENAMED
@@ -125,13 +125,13 @@ def get_pivot_j(I, J):
|
|
125
125
|
def integral_mini_interval(I, J):
|
126
126
|
"""
|
127
127
|
In the specific case where interval I is located outside J,
|
128
|
-
integral of distance from x to J over the interval x
|
128
|
+
integral of distance from x to J over the interval x in I.
|
129
129
|
This is the *integral* i.e. the sum.
|
130
130
|
It's not the mean (not divided by the length of I yet)
|
131
131
|
|
132
132
|
:param I: a interval (start, stop), or None
|
133
133
|
:param J: a non empty interval, with empty intersection with I
|
134
|
-
:return: the integral of distances d(x, J) over x
|
134
|
+
:return: the integral of distances d(x, J) over x in I
|
135
135
|
"""
|
136
136
|
if I is None:
|
137
137
|
return(0)
|
@@ -144,14 +144,14 @@ def integral_mini_interval(I, J):
|
|
144
144
|
def integral_interval_distance(I, J):
|
145
145
|
"""
|
146
146
|
For any non empty intervals I, J, compute the
|
147
|
-
integral of distance from x to J over the interval x
|
147
|
+
integral of distance from x to J over the interval x in I.
|
148
148
|
This is the *integral* i.e. the sum.
|
149
149
|
It's not the mean (not divided by the length of I yet)
|
150
150
|
The interval I can intersect J or not
|
151
151
|
|
152
152
|
:param I: a interval (start, stop), or None
|
153
153
|
:param J: a non empty interval
|
154
|
-
:return: the integral of distances d(x, J) over x
|
154
|
+
:return: the integral of distances d(x, J) over x in I
|
155
155
|
"""
|
156
156
|
# I and J are single intervals (not generic sets)
|
157
157
|
# I is a predicted interval in the range of affiliation of J
|
@@ -178,15 +178,15 @@ def integral_mini_interval_P_CDFmethod__min_piece(I, J, E):
|
|
178
178
|
"""
|
179
179
|
Helper of `integral_mini_interval_Pprecision_CDFmethod`
|
180
180
|
In the specific case where interval I is located outside J,
|
181
|
-
compute the integral
|
181
|
+
compute the integral $int_{d_min}^{d_max} min(m, x) dx$, with:
|
182
182
|
- m the smallest distance from J to E,
|
183
|
-
- d_min the smallest distance d(x, J) from x
|
184
|
-
- d_max the largest distance d(x, J) from x
|
183
|
+
- d_min the smallest distance d(x, J) from x in I to J
|
184
|
+
- d_max the largest distance d(x, J) from x in I to J
|
185
185
|
|
186
186
|
:param I: a single predicted interval, a non empty interval (start, stop)
|
187
187
|
:param J: ground truth interval, a non empty interval, with empty intersection with I
|
188
188
|
:param E: the affiliation/influence zone for J, represented as a couple (start, stop)
|
189
|
-
:return: the integral
|
189
|
+
:return: the integral $int_{d_min}^{d_max} min(m, x) dx$
|
190
190
|
"""
|
191
191
|
if interval_intersection(I, J) is not None:
|
192
192
|
raise ValueError('I and J should have a void intersection')
|
@@ -214,13 +214,13 @@ def integral_mini_interval_Pprecision_CDFmethod(I, J, E):
|
|
214
214
|
"""
|
215
215
|
Integral of the probability of distances over the interval I.
|
216
216
|
In the specific case where interval I is located outside J,
|
217
|
-
compute the integral
|
217
|
+
compute the integral $int_{x in I} Fbar(dist(x,J)) dx$.
|
218
218
|
This is the *integral* i.e. the sum (not the mean)
|
219
219
|
|
220
220
|
:param I: a single predicted interval, a non empty interval (start, stop)
|
221
221
|
:param J: ground truth interval, a non empty interval, with empty intersection with I
|
222
222
|
:param E: the affiliation/influence zone for J, represented as a couple (start, stop)
|
223
|
-
:return: the integral
|
223
|
+
:return: the integral $int_{x in I} Fbar(dist(x,J)) dx$
|
224
224
|
"""
|
225
225
|
integral_min_piece = integral_mini_interval_P_CDFmethod__min_piece(I, J, E)
|
226
226
|
|
@@ -244,13 +244,13 @@ def integral_mini_interval_Pprecision_CDFmethod(I, J, E):
|
|
244
244
|
def integral_interval_probaCDF_precision(I, J, E):
|
245
245
|
"""
|
246
246
|
Integral of the probability of distances over the interval I.
|
247
|
-
Compute the integral
|
247
|
+
Compute the integral $int_{x in I} Fbar(dist(x,J)) dx$.
|
248
248
|
This is the *integral* i.e. the sum (not the mean)
|
249
249
|
|
250
250
|
:param I: a single (non empty) predicted interval in the zone of affiliation of J
|
251
251
|
:param J: ground truth interval
|
252
252
|
:param E: affiliation/influence zone for J
|
253
|
-
:return: the integral
|
253
|
+
:return: the integral $int_{x in I} Fbar(dist(x,J)) dx$
|
254
254
|
"""
|
255
255
|
# I and J are single intervals (not generic sets)
|
256
256
|
def f(I_cut):
|
@@ -307,13 +307,13 @@ def integral_mini_interval_Precall_CDFmethod(I, J, E):
|
|
307
307
|
"""
|
308
308
|
Integral of the probability of distances over the interval J.
|
309
309
|
In the specific case where interval J is located outside I,
|
310
|
-
compute the integral
|
310
|
+
compute the integral $int_{y in J} Fbar_y(dist(y,I)) dy$.
|
311
311
|
This is the *integral* i.e. the sum (not the mean)
|
312
312
|
|
313
313
|
:param I: a single (non empty) predicted interval
|
314
314
|
:param J: ground truth (non empty) interval, with empty intersection with I
|
315
315
|
:param E: the affiliation/influence zone for J, represented as a couple (start, stop)
|
316
|
-
:return: the integral
|
316
|
+
:return: the integral $int_{y in J} Fbar_y(dist(y,I)) dy$
|
317
317
|
"""
|
318
318
|
# The interval J should be located outside I
|
319
319
|
# (so it's either the left piece or the right piece w.r.t I)
|
@@ -377,7 +377,7 @@ def integral_mini_interval_Precall_CDFmethod(I, J, E):
|
|
377
377
|
# j_bb_min j_bb_max j_ba_min j_ba_max j_ab_min j_ab_max j_aa_min j_aa_max
|
378
378
|
# (with `b` for before and `a` for after in the previous variable names)
|
379
379
|
|
380
|
-
# vs e_mean m = min(t-e_min, e_max-t) d=|i_pivot-t| min(d,m)
|
380
|
+
# vs e_mean m = min(t-e_min, e_max-t) d=|i_pivot-t| min(d,m) int min(d,m)dt int d dt int_(min(d,m)+d)dt int_{t in J}(min(d,m)+d)dt
|
381
381
|
# Case J_before_closeE & i_pivot after J before t-e_min i_pivot-t min(i_pivot-t,t-e_min) = t-e_min t^2/2-e_min*t i_pivot*t-t^2/2 t^2/2-e_min*t+i_pivot*t-t^2/2 = (i_pivot-e_min)*t (i_pivot-e_min)*tB - (i_pivot-e_min)*tA = (i_pivot-e_min)*(tB-tA)
|
382
382
|
# Case J_before_closeI & i_pivot after J before t-e_min i_pivot-t min(i_pivot-t,t-e_min) = i_pivot-t i_pivot*t-t^2/2 i_pivot*t-t^2/2 i_pivot*t-t^2/2+i_pivot*t-t^2/2 = 2*i_pivot*t-t^2 2*i_pivot*tB-tB^2 - 2*i_pivot*tA + tA^2 = 2*i_pivot*(tB-tA) - (tB^2 - tA^2)
|
383
383
|
# Case J_after_closeI & i_pivot after J after e_max-t i_pivot-t min(i_pivot-t,e_max-t) = i_pivot-t i_pivot*t-t^2/2 i_pivot*t-t^2/2 i_pivot*t-t^2/2+i_pivot*t-t^2/2 = 2*i_pivot*t-t^2 2*i_pivot*tB-tB^2 - 2*i_pivot*tA + tA^2 = 2*i_pivot*(tB-tA) - (tB^2 - tA^2)
|
@@ -406,12 +406,12 @@ def integral_mini_interval_Precall_CDFmethod(I, J, E):
|
|
406
406
|
out_integral_min_dm_plus_d = _sum_wo_nan(out_parts) # integral on all J, i.e. sum of the disjoint parts
|
407
407
|
|
408
408
|
# We have for each point t of J:
|
409
|
-
#
|
409
|
+
# bar{F}_{t, recall}(d) = 1 - (1/|E|) * (min(d,m) + d)
|
410
410
|
# Since t is a single-point here, and we are in the case where i_pivot is inside E.
|
411
411
|
# The integral is then given by:
|
412
|
-
# C =
|
413
|
-
# =
|
414
|
-
# = |J| - (1/|E|) * [
|
412
|
+
# C = int_{t in J} bar{F}_{t, recall}(D(t)) dt
|
413
|
+
# = int_{t in J} 1 - (1/|E|) * (min(d,m) + d) dt
|
414
|
+
# = |J| - (1/|E|) * [int_{t in J} (min(d,m) + d) dt]
|
415
415
|
# = |J| - (1/|E|) * out_integral_min_dm_plus_d
|
416
416
|
DeltaJ = max(J) - min(J)
|
417
417
|
DeltaE = max(E) - min(E)
|
@@ -422,17 +422,17 @@ def integral_mini_interval_Precall_CDFmethod(I, J, E):
|
|
422
422
|
def integral_interval_probaCDF_recall(I, J, E):
|
423
423
|
"""
|
424
424
|
Integral of the probability of distances over the interval J.
|
425
|
-
Compute the integral
|
425
|
+
Compute the integral $int_{y in J} Fbar_y(dist(y,I)) dy$.
|
426
426
|
This is the *integral* i.e. the sum (not the mean)
|
427
427
|
|
428
428
|
:param I: a single (non empty) predicted interval
|
429
429
|
:param J: ground truth (non empty) interval
|
430
430
|
:param E: the affiliation/influence zone for J
|
431
|
-
:return: the integral
|
431
|
+
:return: the integral $int_{y in J} Fbar_y(dist(y,I)) dy$
|
432
432
|
"""
|
433
433
|
# I and J are single intervals (not generic sets)
|
434
434
|
# E is the outside affiliation interval of J (even for recall!)
|
435
|
-
# (in particular J
|
435
|
+
# (in particular J subset E)
|
436
436
|
#
|
437
437
|
# J is the portion of the ground truth affiliated to I
|
438
438
|
# I is a predicted interval (can be outside E possibly since it's recall)
|
@@ -176,6 +176,8 @@ class Sweeper(object):
|
|
176
176
|
unweightedScore = -1.0
|
177
177
|
else:
|
178
178
|
numerator = abs(prevWindowRightIndex - i)
|
179
|
+
if prevWindowWidth==1:
|
180
|
+
prevWindowWidth+=1
|
179
181
|
denominator = float(prevWindowWidth - 1)
|
180
182
|
positionPastWindow = numerator / denominator
|
181
183
|
unweightedScore = scaledSigmoid(positionPastWindow)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/affiliation/_affiliation_zone.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/DataManage/File_IO.py
RENAMED
File without changes
|
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/DataManage/Time_Plot.py
RENAMED
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/eTaPR_pkg/DataManage/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/base/time_series_metrics.py
RENAMED
File without changes
|
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/__init__.py
RENAMED
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/fscore.py
RENAMED
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/precision.py
RENAMED
File without changes
|
File without changes
|
{tsadmetrics-0.1.8 → tsadmetrics-0.1.9}/tsadmetrics/_tsadeval/prts/time_series_metrics/recall.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|