Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalizeRootCause does not return any root causes when RootCauseLocalizationInput includes dimensions with values of type long #5352

Closed
nnoradie opened this issue Aug 19, 2020 · 0 comments · Fixed by #5354
Labels
anomaly Bugs related Anomaly Detection

Comments

@nnoradie
Copy link

System information

  • OS version/distro: .Net 4.8
  • .NET Version (eg., dotnet --info): ML.Net 1.5.1

Issue

  • What did you do?
    I called LocalizeRootCause with a RootCauseLocalizationInput that included an aggregation symbol and dimension values of type long.

  • What happened?
    I got no root cause results. I get results when the dimension values are strings.

  • What did you expect?
    I expected to get some results based on earlier prototypes using this dataset.

Source code / logs

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

Repro: RCARepro.zip

Below I have two different RootCauseLocalizationInputs as json strings

Returned no results

private static string jsonT =
@"{
	""AnomalyTimestamp"": ""1998-02-02T00:00:00"",
	""AnomalyDimension"": {
		""[__Sandbox.Customers.ContactTitle__]"": -1
	},
	""Slices"": [
		{
			""TimeStamp"": ""1998-02-02T00:00:00"",
			""Points"": [
				{
					""Value"": 16387.5,
					""ExpectedValue"": 2187.2416694295504,
					""IsAnomaly"": true,
					""Dimension"": {
						""[__Sandbox.Customers.ContactTitle__]"": 54
					},
					""Delta"": 14200.25833057045
				},
				{
					""Value"": 723.15,
					""ExpectedValue"": 800.1415610472596,
					""IsAnomaly"": false,
					""Dimension"": {
						""[__Sandbox.Customers.ContactTitle__]"": 34
					},
					""Delta"": -76.99156104725967
				},
				{
					""Value"": 17110.65,
					""ExpectedValue"": 2193.535,
					""IsAnomaly"": true,
					""Dimension"": {
						""[__Sandbox.Customers.ContactTitle__]"":-1
					},
					""Delta"": 14917.115000000002
				}
			]
		}
	],
	""AggregateType"": 0,
	""AggregateSymbol"": -1
}";

Returned results

private static string jsonString =

@"{
	""AnomalyTimestamp"": ""1998-02-02T00:00:00"",
	""AnomalyDimension"": {
		""[__Sandbox.Customers.ContactTitle__]"": ""-1""
	},
	""Slices"": [
		{
			""TimeStamp"": ""1998-02-02T00:00:00"",
			""Points"": [
				{
					""Value"": 16387.5,
					""ExpectedValue"": 2187.2416694295504,
					""IsAnomaly"": true,
					""Dimension"": {
						""[__Sandbox.Customers.ContactTitle__]"": ""54""
					},
					""Delta"": 14200.25833057045
				},
				{
					""Value"": 723.15,
					""ExpectedValue"": 800.1415610472596,
					""IsAnomaly"": false,
					""Dimension"": {
						""[__Sandbox.Customers.ContactTitle__]"": ""34""
					},
					""Delta"": -76.99156104725967
				},
				{
					""Value"": 17110.65,
					""ExpectedValue"": 2193.535,
					""IsAnomaly"": true,
					""Dimension"": {
						""[__Sandbox.Customers.ContactTitle__]"":""-1""
					},
					""Delta"": 14917.115000000002
				}
			]
		}
	],
	""AggregateType"": 0,
	""AggregateSymbol"": ""-1""
}";

        static void Main(string[] args)
        {
            var mlContext = new MLContext(0);

            var rcaInputString = JsonConvert.DeserializeObject<RootCauseLocalizationInput>(jsonString);
            var rcaInputLong = JsonConvert.DeserializeObject<RootCauseLocalizationInput>(jsonLong);

            // one root cause item returned
            var rcaString = mlContext.AnomalyDetection.LocalizeRootCause(rcaInputString).Items.OrderByDescending(e => e.Score).ToList();

            // no root cause items returned
            var rcaLong = mlContext.AnomalyDetection.LocalizeRootCause(rcaInputLong).Items.OrderByDescending(e => e.Score).ToList();
        }
@frank-dong-ms-zz frank-dong-ms-zz added the anomaly Bugs related Anomaly Detection label Aug 19, 2020
harishsk pushed a commit that referenced this issue Aug 25, 2020
… cause localization (#5354)

* fixed issues caused by equality

* revert coding style change

* add test cases for int, null dim value, add test case for different dim value type

* update coding style
@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
anomaly Bugs related Anomaly Detection
Projects
None yet
2 participants