Skip to content

Commit fcda8f0

Browse files
committed
multivariate pipeline
1 parent dc20aee commit fcda8f0

File tree

4 files changed

+1792
-1
lines changed

4 files changed

+1792
-1
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"primitives": [
3+
"mlstars.custom.timeseries_preprocessing.time_segments_aggregate",
4+
"sklearn.impute.SimpleImputer",
5+
"sigllm.primitives.transformation.Float2Scalar",
6+
"sigllm.primitives.prompting.timeseries_preprocessing.rolling_window_sequences",
7+
"sigllm.primitives.transformation.format_as_string",
8+
"sigllm.primitives.prompting.huggingface.HF",
9+
"sigllm.primitives.prompting.anomalies.parse_anomaly_response",
10+
"sigllm.primitives.prompting.anomalies.find_anomalies_in_windows",
11+
"sigllm.primitives.prompting.anomalies.merge_anomalous_sequences",
12+
"sigllm.primitives.prompting.anomalies.format_anomalies"
13+
],
14+
"init_params": {
15+
"mlstars.custom.timeseries_preprocessing.time_segments_aggregate#1": {
16+
"time_column": "timestamp",
17+
"interval": 21600,
18+
"method": "mean"
19+
},
20+
"sigllm.primitives.transformation.Float2Scalar#1": {
21+
"decimal": 2,
22+
"rescale": true
23+
},
24+
"sigllm.primitives.prompting.timeseries_preprocessing.rolling_window_sequences#1": {
25+
"window_size": 100,
26+
"step_size": 40
27+
},
28+
"sigllm.primitives.transformation.format_as_string#1": {
29+
"space": false
30+
},
31+
"sigllm.primitives.prompting.huggingface.HF#1": {
32+
"name": "mistralai/Mistral-7B-Instruct-v0.2",
33+
"samples": 1,
34+
"temp": 0.01
35+
},
36+
"sigllm.primitives.prompting.anomalies.parse_anomaly_response#1": {
37+
"interval": true
38+
},
39+
"sigllm.primitives.prompting.anomalies.find_anomalies_in_windows#1": {
40+
"alpha": 0.4
41+
},
42+
"sigllm.primitives.prompting.anomalies.merge_anomalous_sequences#1": {
43+
"beta": 0.5
44+
}
45+
},
46+
"input_names": {
47+
"sigllm.primitives.prompting.huggingface.HF#1": {
48+
"X": "X_str"
49+
},
50+
"sigllm.primitives.prompting.anomalies.parse_anomaly_response#1": {
51+
"X": "y_hat"
52+
}
53+
},
54+
"output_names": {
55+
"mlstars.custom.timeseries_preprocessing.time_segments_aggregate#1": {
56+
"index": "timestamp"
57+
},
58+
"sigllm.primitives.transformation.format_as_string#1": {
59+
"X": "X_str"
60+
},
61+
"sigllm.primitives.prompting.huggingface.HF#1": {
62+
"y": "y_hat"
63+
},
64+
"sigllm.primitives.prompting.anomalies.parse_anomaly_response#1": {
65+
"X": "y"
66+
}
67+
}
68+
}

sigllm/primitives/prompting/anomalies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def format_anomalies(y, timestamp, padding_size=50):
206206
if len(y) == 0:
207207
return []
208208

209+
print(y)
209210
y = y[y < len(timestamp)].astype(int)
210211
y = timestamp[y] # Convert list of indices into list of timestamps
211212
start, end = timestamp[0], timestamp[-1]

sigllm/primitives/prompting/huggingface_messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"system_message": "You are an expert in time series analysis. Your task is to detect anomalies in time series data.",
33
"user_message": "Below is a [SEQUENCE], please return the anomalies in that sequence in [RESPONSE]. Only return the numbers. [SEQUENCE]",
44
"user_message_unrestricted": "Below is a [SEQUENCE], analyze the following time series and identify any anomalies. If you find anomalies, provide their values in the format [first_anomaly, ..., last_anomaly]. If no anomalies are found, respond with 'no anomalies'. Be concise, do not write code, do not perform any calculations, just give your answers as told.: [SEQUENCE]",
5-
"user_message_multivariate": "Below is a multivariate time series of {} dimensions with the following format \"{}\".\nYour job is to detect ranges of anomalies in this time series, in terms of the x-axis coordinates. List one by one in a list.\nFor example, if ranges (incluing two endpoints) [5, 12], [71, 74], and [105, 131], are anomalies, then output \"[[5,12], [71, 74], [105, 131]]\".\nIf no anomalies are found, respond with 'no anomalies'. Be concise, do not write code, do not perform any calculations, just give your answers as told.\n[SEQUENCE]\n",
5+
"user_message_multivariate": "Below is a multivariate time series of {} dimensions with the following format \"{}\".\nYour job is to detect ranges of anomalies in this time series, in terms of the x-axis coordinates. List one by one in a list.\nFor example, if ranges (including two endpoints) [5, 12], [71, 74], and [105, 131], are anomalies, then output \"[[5,12], [71, 74], [105, 131]]\".\nIf no anomalies are found, respond with 'no anomalies'. Be concise, do not write code, do not perform any calculations, just give your answers as told.\n[SEQUENCE]\n",
66
"one_shot_prefix": "Here is a normal reference of the time series: [NORMAL]"
77
}

tutorials/pipelines/multivariate-mistral-prompter-pipeline.ipynb

Lines changed: 1722 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)