internal HardThresholdCondition(double?lowerBound, double?upperBound, AnomalyDetectorDirection anomalyDetectorDirection, SuppressCondition suppressCondition)
 {
     LowerBound = lowerBound;
     UpperBound = upperBound;
     AnomalyDetectorDirection = anomalyDetectorDirection;
     SuppressCondition        = suppressCondition;
 }
예제 #2
0
        internal static SmartDetectionCondition DeserializeSmartDetectionCondition(JsonElement element)
        {
            double sensitivity = default;
            AnomalyDetectorDirection anomalyDetectorDirection = default;
            SuppressCondition        suppressCondition        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sensitivity"))
                {
                    sensitivity = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("anomalyDetectorDirection"))
                {
                    anomalyDetectorDirection = new AnomalyDetectorDirection(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("suppressCondition"))
                {
                    suppressCondition = Models.SuppressCondition.DeserializeSuppressCondition(property.Value);
                    continue;
                }
            }
            return(new SmartDetectionCondition(sensitivity, anomalyDetectorDirection, suppressCondition));
        }
 internal HardThresholdConditionPatch GetPatchModel() => new HardThresholdConditionPatch()
 {
     AnomalyDetectorDirection = AnomalyDetectorDirection,
     SuppressCondition        = SuppressCondition?.GetPatchModel(),
     LowerBound = LowerBound,
     UpperBound = UpperBound
 };
예제 #4
0
        internal static HardThresholdCondition DeserializeHardThresholdCondition(JsonElement element)
        {
            Optional <double>        lowerBound = default;
            Optional <double>        upperBound = default;
            AnomalyDetectorDirection anomalyDetectorDirection = default;
            SuppressCondition        suppressCondition        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("lowerBound"))
                {
                    lowerBound = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("upperBound"))
                {
                    upperBound = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("anomalyDetectorDirection"))
                {
                    anomalyDetectorDirection = new AnomalyDetectorDirection(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("suppressCondition"))
                {
                    suppressCondition = Models.SuppressCondition.DeserializeSuppressCondition(property.Value);
                    continue;
                }
            }
            return(new HardThresholdCondition(Optional.ToNullable(lowerBound), Optional.ToNullable(upperBound), anomalyDetectorDirection, suppressCondition));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HardThresholdCondition"/> class.
        /// </summary>
        /// <param name="anomalyDetectorDirection">
        /// Sets the boundaries that delimit the expected value range. Data points out of this range are considered anomalous.
        /// If <see cref="AnomalyDetectorDirection.Down"/> or <see cref="AnomalyDetectorDirection.Both"/>, <see cref="LowerBound"/>
        /// is required. If <see cref="AnomalyDetectorDirection.Up"/> or <see cref="AnomalyDetectorDirection.Both"/>,
        /// <see cref="UpperBound"/> is required.
        /// </param>
        /// <param name="suppressCondition">The <see cref="Models.SuppressCondition"/> to be applied to every anomalous data point.</param>
        /// <exception cref="ArgumentNullException"><paramref name="suppressCondition"/> is null.</exception>
        public HardThresholdCondition(AnomalyDetectorDirection anomalyDetectorDirection, SuppressCondition suppressCondition)
        {
            Argument.AssertNotNull(suppressCondition, nameof(suppressCondition));

            AnomalyDetectorDirection = anomalyDetectorDirection;
            SuppressCondition        = suppressCondition;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HardThresholdCondition"/> class.
        /// </summary>
        /// <param name="sensitivity">
        /// A numerical value to adjust the tolerance of the anomaly detection with a range of (0, 100].
        /// Visually, the higher the value, the narrower the upper and lower boundaries around the time series.
        /// </param>
        /// <param name="anomalyDetectorDirection"> detection direction. </param>
        /// <param name="suppressCondition">The <see cref="Models.SuppressCondition"/> to be applied to every unexpected data point.</param>
        /// <exception cref="ArgumentNullException"><paramref name="suppressCondition"/> is null.</exception>
        public SmartDetectionCondition(double sensitivity, AnomalyDetectorDirection anomalyDetectorDirection, SuppressCondition suppressCondition)
        {
            Argument.AssertNotNull(suppressCondition, nameof(suppressCondition));

            Sensitivity = sensitivity;
            AnomalyDetectorDirection = anomalyDetectorDirection;
            SuppressCondition        = suppressCondition;
        }
        public HardThresholdCondition(AnomalyDetectorDirection anomalyDetectorDirection, SuppressCondition suppressCondition)
        {
            if (suppressCondition == null)
            {
                throw new ArgumentNullException(nameof(suppressCondition));
            }

            AnomalyDetectorDirection = anomalyDetectorDirection;
            SuppressCondition        = suppressCondition;
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChangeThresholdCondition"/> class.
        /// </summary>
        /// <param name="changePercentage">Compared to the previous point, the current point is an anomaly if the percentage of change is more than this value. </param>
        /// <param name="shiftPoint">When set to N, sets as reference the data point that's N positions before the current point. Value must be at least 1.</param>
        /// <param name="isWithinRange">Sets whether to detect data within the range or outside the range.</param>
        /// <param name="anomalyDetectorDirection">A point is considered an anomaly only when the deviation occurs in the specified direction.</param>
        /// <param name="suppressCondition">The <see cref="Models.SuppressCondition"/> to be applied to every unexpected data point.</param>
        /// <exception cref="ArgumentNullException"><paramref name="suppressCondition"/> is null.</exception>
        public ChangeThresholdCondition(double changePercentage, int shiftPoint, bool isWithinRange, AnomalyDetectorDirection anomalyDetectorDirection, SuppressCondition suppressCondition)
        {
            Argument.AssertNotNull(suppressCondition, nameof(suppressCondition));

            ChangePercentage         = changePercentage;
            ShiftPoint               = shiftPoint;
            IsWithinRange            = isWithinRange;
            AnomalyDetectorDirection = anomalyDetectorDirection;
            SuppressCondition        = suppressCondition;
        }
        public SmartDetectionCondition(double sensitivity, AnomalyDetectorDirection anomalyDetectorDirection, SuppressCondition suppressCondition)
        {
            if (suppressCondition == null)
            {
                throw new ArgumentNullException(nameof(suppressCondition));
            }

            Sensitivity = sensitivity;
            AnomalyDetectorDirection = anomalyDetectorDirection;
            SuppressCondition        = suppressCondition;
        }
예제 #10
0
        public ChangeThresholdCondition(double changePercentage, int shiftPoint, bool isWithinRange, AnomalyDetectorDirection anomalyDetectorDirection, SuppressCondition suppressCondition)
        {
            if (suppressCondition == null)
            {
                throw new ArgumentNullException(nameof(suppressCondition));
            }

            ChangePercentage         = changePercentage;
            ShiftPoint               = shiftPoint;
            IsWithinRange            = isWithinRange;
            AnomalyDetectorDirection = anomalyDetectorDirection;
            SuppressCondition        = suppressCondition;
        }
예제 #11
0
        internal static ChangeThresholdCondition DeserializeChangeThresholdCondition(JsonElement element)
        {
            double changePercentage = default;
            int    shiftPoint       = default;
            bool   withinRange      = default;
            AnomalyDetectorDirection anomalyDetectorDirection = default;
            SuppressCondition        suppressCondition        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("changePercentage"))
                {
                    changePercentage = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("shiftPoint"))
                {
                    shiftPoint = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("withinRange"))
                {
                    withinRange = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("anomalyDetectorDirection"))
                {
                    anomalyDetectorDirection = new AnomalyDetectorDirection(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("suppressCondition"))
                {
                    suppressCondition = Models.SuppressCondition.DeserializeSuppressCondition(property.Value);
                    continue;
                }
            }
            return(new ChangeThresholdCondition(changePercentage, shiftPoint, withinRange, anomalyDetectorDirection, suppressCondition));
        }