1package anomalydetector
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"github.com/Azure/go-autorest/autorest"
22	"github.com/Azure/go-autorest/autorest/date"
23)
24
25// The package's fully qualified name.
26const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v1.0/anomalydetector"
27
28// Granularity enumerates the values for granularity.
29type Granularity string
30
31const (
32	// Daily ...
33	Daily Granularity = "daily"
34	// Hourly ...
35	Hourly Granularity = "hourly"
36	// Minutely ...
37	Minutely Granularity = "minutely"
38	// Monthly ...
39	Monthly Granularity = "monthly"
40	// Secondly ...
41	Secondly Granularity = "secondly"
42	// Weekly ...
43	Weekly Granularity = "weekly"
44	// Yearly ...
45	Yearly Granularity = "yearly"
46)
47
48// PossibleGranularityValues returns an array of possible values for the Granularity const type.
49func PossibleGranularityValues() []Granularity {
50	return []Granularity{Daily, Hourly, Minutely, Monthly, Secondly, Weekly, Yearly}
51}
52
53// APIError error information returned by the API.
54type APIError struct {
55	// Code - The error code.
56	Code interface{} `json:"code,omitempty"`
57	// Message - A message explaining the error reported by the service.
58	Message *string `json:"message,omitempty"`
59}
60
61// ChangePointDetectRequest ...
62type ChangePointDetectRequest struct {
63	// Series - Time series data points. Points should be sorted by timestamp in ascending order to match the change point detection result.
64	Series *[]Point `json:"series,omitempty"`
65	// Granularity - Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is used for verify whether input series is valid. Possible values include: 'Yearly', 'Monthly', 'Weekly', 'Daily', 'Hourly', 'Minutely', 'Secondly'
66	Granularity Granularity `json:"granularity,omitempty"`
67	// CustomInterval - Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {"granularity":"minutely", "customInterval":5}.
68	CustomInterval *int32 `json:"customInterval,omitempty"`
69	// Period - Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically.
70	Period *int32 `json:"period,omitempty"`
71	// StableTrendWindow - Optional argument, advanced model parameter, a default stableTrendWindow will be used in detection.
72	StableTrendWindow *int32 `json:"stableTrendWindow,omitempty"`
73	// Threshold - Optional argument, advanced model parameter, between 0.0-1.0, the lower the value is, the larger the trend error will be which means less change point will be accepted.
74	Threshold *float64 `json:"threshold,omitempty"`
75}
76
77// ChangePointDetectResponse ...
78type ChangePointDetectResponse struct {
79	autorest.Response `json:"-"`
80	// Period - Frequency extracted from the series, zero means no recurrent pattern has been found.
81	Period *int32 `json:"period,omitempty"`
82	// IsChangePoint - isChangePoint contains change point properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series.
83	IsChangePoint *[]bool `json:"isChangePoint,omitempty"`
84	// ConfidenceScores - the change point confidence of each point
85	ConfidenceScores *[]float64 `json:"confidenceScores,omitempty"`
86}
87
88// EntireDetectResponse ...
89type EntireDetectResponse struct {
90	autorest.Response `json:"-"`
91	// Period - Frequency extracted from the series, zero means no recurrent pattern has been found.
92	Period *int32 `json:"period,omitempty"`
93	// ExpectedValues - ExpectedValues contain expected value for each input point. The index of the array is consistent with the input series.
94	ExpectedValues *[]float64 `json:"expectedValues,omitempty"`
95	// UpperMargins - UpperMargins contain upper margin of each input point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting marginScale value, less significant anomalies can be filtered in client side. The index of the array is consistent with the input series.
96	UpperMargins *[]float64 `json:"upperMargins,omitempty"`
97	// LowerMargins - LowerMargins contain lower margin of each input point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. Points between the boundary can be marked as normal ones in client side. The index of the array is consistent with the input series.
98	LowerMargins *[]float64 `json:"lowerMargins,omitempty"`
99	// IsAnomaly - IsAnomaly contains anomaly properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series.
100	IsAnomaly *[]bool `json:"isAnomaly,omitempty"`
101	// IsNegativeAnomaly - IsNegativeAnomaly contains anomaly status in negative direction for each input point. True means a negative anomaly has been detected. A negative anomaly means the point is detected as an anomaly and its real value is smaller than the expected one. The index of the array is consistent with the input series.
102	IsNegativeAnomaly *[]bool `json:"isNegativeAnomaly,omitempty"`
103	// IsPositiveAnomaly - IsPositiveAnomaly contain anomaly status in positive direction for each input point. True means a positive anomaly has been detected. A positive anomaly means the point is detected as an anomaly and its real value is larger than the expected one. The index of the array is consistent with the input series.
104	IsPositiveAnomaly *[]bool `json:"isPositiveAnomaly,omitempty"`
105}
106
107// LastDetectResponse ...
108type LastDetectResponse struct {
109	autorest.Response `json:"-"`
110	// Period - Frequency extracted from the series, zero means no recurrent pattern has been found.
111	Period *int32 `json:"period,omitempty"`
112	// SuggestedWindow - Suggested input series points needed for detecting the latest point.
113	SuggestedWindow *int32 `json:"suggestedWindow,omitempty"`
114	// ExpectedValue - Expected value of the latest point.
115	ExpectedValue *float64 `json:"expectedValue,omitempty"`
116	// UpperMargin - Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting marginScale value, anomaly status of latest point can be changed.
117	UpperMargin *float64 `json:"upperMargin,omitempty"`
118	// LowerMargin - Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin.
119	LowerMargin *float64 `json:"lowerMargin,omitempty"`
120	// IsAnomaly - Anomaly status of the latest point, true means the latest point is an anomaly either in negative direction or positive direction.
121	IsAnomaly *bool `json:"isAnomaly,omitempty"`
122	// IsNegativeAnomaly - Anomaly status in negative direction of the latest point. True means the latest point is an anomaly and its real value is smaller than the expected one.
123	IsNegativeAnomaly *bool `json:"isNegativeAnomaly,omitempty"`
124	// IsPositiveAnomaly - Anomaly status in positive direction of the latest point. True means the latest point is an anomaly and its real value is larger than the expected one.
125	IsPositiveAnomaly *bool `json:"isPositiveAnomaly,omitempty"`
126}
127
128// Point ...
129type Point struct {
130	// Timestamp - Timestamp of a data point (ISO8601 format).
131	Timestamp *date.Time `json:"timestamp,omitempty"`
132	// Value - The measurement of that point, should be float.
133	Value *float64 `json:"value,omitempty"`
134}
135
136// Request ...
137type Request struct {
138	// Series - Time series data points. Points should be sorted by timestamp in ascending order to match the anomaly detection result. If the data is not sorted correctly or there is duplicated timestamp, the API will not work. In such case, an error message will be returned.
139	Series *[]Point `json:"series,omitempty"`
140	// Granularity - Possible values include: 'Yearly', 'Monthly', 'Weekly', 'Daily', 'Hourly', 'Minutely', 'Secondly'
141	Granularity Granularity `json:"granularity,omitempty"`
142	// CustomInterval - Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {"granularity":"minutely", "customInterval":5}.
143	CustomInterval *int32 `json:"customInterval,omitempty"`
144	// Period - Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically.
145	Period *int32 `json:"period,omitempty"`
146	// MaxAnomalyRatio - Optional argument, advanced model parameter, max anomaly ratio in a time series.
147	MaxAnomalyRatio *float64 `json:"maxAnomalyRatio,omitempty"`
148	// Sensitivity - Optional argument, advanced model parameter, between 0-99, the lower the value is, the larger the margin value will be which means less anomalies will be accepted.
149	Sensitivity *int32 `json:"sensitivity,omitempty"`
150}
151