Comments (4)
Dear @janthmueller,
Unfortunately, there is no automatic way to get the anomaly type annotations for already generated time series when there are multiple types defined. GutenTAG chooses a random position (with some constraints) for each anomaly in the specified region ("beginning", "middle", "end"); they are not sorted. You should be able to visually tell them apart, though.
However, I think you could modify GutenTAG to include the anomaly types in the datasets and re-generate the benchmark datasets. You won't be able to get the same datasets, though, because we generated the benchmark datasets very early on, and GutenTAG's reproducibility features (TS-name-based RNG seeding and writing out the seed and GutenTAG version) were introduced later on.
We have some students working with GutenTAG that need to do something similar. I will contact them and ask how they do it.
from gutentag.
Our students do the following to encode the anomaly type into the "is_anomaly" column:
diff --git a/gutenTAG/anomalies/__init__.py b/gutenTAG/anomalies/__init__.py
index 7c82b51..7aa6fc3 100644
--- a/gutenTAG/anomalies/__init__.py
+++ b/gutenTAG/anomalies/__init__.py
@@ -58,11 +58,12 @@ class Anomaly:
start, end = self.exact_position, self.exact_position + self.anomaly_length
length = end - start
- label_range = LabelRange(start, length)
+ label_range = LabelRange(start, length, "")
protocol = AnomalyProtocol(start, end, self.channel, ctx, label_range, creep_length=self.creep_length)
for anomaly in self.anomaly_kinds:
protocol = anomaly.generate(protocol)
+ protocol.labels.class_label = type(anomaly).__name__
return protocol
diff --git a/gutenTAG/anomalies/types/__init__.py b/gutenTAG/anomalies/types/__init__.py
index ddc3b85..8236963 100644
--- a/gutenTAG/anomalies/types/__init__.py
+++ b/gutenTAG/anomalies/types/__init__.py
@@ -13,6 +13,7 @@ from ...utils.types import AnomalyGenerationContext
class LabelRange:
start: int
length: int
+ class_label: str
@dataclass
diff --git a/gutenTAG/base_oscillations/utils/consolidator.py b/gutenTAG/base_oscillations/utils/consolidator.py
index 3708632..3287e44 100644
--- a/gutenTAG/base_oscillations/utils/consolidator.py
+++ b/gutenTAG/base_oscillations/utils/consolidator.py
@@ -68,6 +68,28 @@ class Consolidator:
def _add_label_ranges_to_labels(self, label_ranges: List[LabelRange]):
if self.labels is not None:
for label_range in label_ranges:
- self.labels[label_range.start:label_range.start + label_range.length] = 1
+ if label_range.class_label == "AnomalyAmplitude":
+ nr_label_anomaly = 1
+ elif label_range.class_label == "AnomalyExtremum":
+ nr_label_anomaly = 2
+ elif label_range.class_label == "AnomalyFrequency":
+ nr_label_anomaly = 3
+ elif label_range.class_label == "AnomalyMean":
+ nr_label_anomaly = 4
+ elif label_range.class_label == "AnomalyPattern":
+ nr_label_anomaly = 5
+ elif label_range.class_label == "AnomalyPatternShift":
+ nr_label_anomaly = 6
+ elif label_range.class_label == "AnomalyPlatform":
+ nr_label_anomaly = 7
+ elif label_range.class_label == "AnomalyTrend":
+ nr_label_anomaly = 8
+ elif label_range.class_label == "AnomalyVariance":
+ nr_label_anomaly = 9
+ elif label_range.class_label == "AnomalyModeCorrelation":
+ nr_label_anomaly = 10
+ else:
+ nr_label_anomaly = -1
+ self.labels[label_range.start:label_range.start + label_range.length] = nr_label_anomaly
else:
raise AssertionError("You cannot run this method before initializing the `labels` field!")
You can then use the anomaly category number to figure out the used anomaly kind.
Warning
Please keep in mind that this just uses the last used anomaly kind as the final anomaly type. GutenTAG allows users to specify multiple anomaly kinds per anomaly and stacks them. So you have to make sure that your configurations don't use this feature!
from gutentag.
Thank you for the detailed answer. I will probably implement it within the next few days similar to your students. Nevertheless, it would be nice to see it as a feature within the application in the future. Including the labeling of time steps of overlapping and differing anomaly types.
from gutentag.
We don't see this as one of the main features of GutenTAG, but we are open for community contributions. If you are already implementing it for yourself, you could also start working on a PR.
Please discuss architectural changes with us before submitting a PR so that we can agree on it.
from gutentag.
Related Issues (13)
- How to generate multiple ‘extremum’ outliers? HOT 7
- Allow definition of transient base oscillations in formula
- Add post-processing options
- New anomaly: pattern-flip
- Add a smooth transition to the anomaly API
- New anomaly: Normalize
- Rename Creepy Anomaly to Creeping Anomaly HOT 2
- Incompatible types: pattern -> cylinder_bell_funnel HOT 2
- Type Mismatch Error When Using Integer Data with Custom Input HOT 1
- Create new mode - ts_augmentation HOT 11
- Timestamp is missing in time series data generator HOT 1
- Use existing TS file as base oscillation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gutentag.