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

add root cause localization transformer #4925

Merged
merged 51 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d5ee205
add root cause localization transformer
suxi-ms Mar 10, 2020
f727a79
add test cases
suxi-ms Mar 16, 2020
92de1dc
revert sln changes
suxi-ms Mar 18, 2020
798289c
add evaluation
suxi-ms Mar 18, 2020
f2e128d
temp save for internal review
suxi-ms Mar 20, 2020
51569e3
rename function
suxi-ms Mar 20, 2020
59c6e89
temp save bottom up points for switch desktop
suxi-ms Mar 22, 2020
29216e0
update from laptop
suxi-ms Mar 22, 2020
69da330
save for add test
suxi-ms Mar 23, 2020
e1c5432
add root cause localization algorithm
suxi-ms Mar 23, 2020
3a1d1c5
add root cause localization algorithm
suxi-ms Mar 23, 2020
8f97602
print score, path and directions in sample
suxi-ms Mar 23, 2020
48123f4
merge with master
suxi-ms Mar 23, 2020
c47302f
extract root cause analyzer
suxi-ms Mar 23, 2020
b07ad28
refine code
suxi-ms Mar 23, 2020
c729877
merge with master
suxi-ms Mar 24, 2020
ebbdb0d
update for algorithm
suxi-ms Mar 26, 2020
0d43b0d
add evaluatin
suxi-ms Mar 26, 2020
5778eed
some refine for code
suxi-ms Mar 26, 2020
c9ed044
fix some typo
suxi-ms Mar 27, 2020
e440f25
remove unused code
suxi-ms Mar 27, 2020
feba6f4
reformat code
suxi-ms Mar 27, 2020
686831c
updates
suxi-ms Mar 27, 2020
ddc8a36
update from review
suxi-ms Mar 29, 2020
475ee8a
read double for beta
suxi-ms Apr 1, 2020
8d874ca
remove SignatureDataTransform constructor
suxi-ms Apr 1, 2020
0674ab3
update
suxi-ms Apr 1, 2020
4c5b8fb
update
suxi-ms Apr 1, 2020
08d607c
remove white space
suxi-ms Apr 2, 2020
c688233
refine internal logic
suxi-ms Apr 7, 2020
98637db
update
suxi-ms Apr 8, 2020
4ff2ed1
update
suxi-ms Apr 8, 2020
c22ad50
updated test
suxi-ms Apr 13, 2020
ea7ddbe
update score
suxi-ms Apr 15, 2020
547aef2
update variable name
suxi-ms Apr 17, 2020
8d17c3c
add some comments
suxi-ms Apr 21, 2020
66b614a
refine internal function
suxi-ms Apr 23, 2020
12e7e18
handle for infinity and nan
suxi-ms Apr 24, 2020
e213615
rename the algorithm by removing DT
suxi-ms Apr 26, 2020
30915cd
Update src/Microsoft.ML.TimeSeries/RootCauseAnalyzer.cs
suxi-ms Apr 27, 2020
fda4ec7
fix type
suxi-ms Apr 27, 2020
620ef58
add an else branch when delta is negative
suxi-ms Apr 27, 2020
ae5722f
Merge branch 'master' of https://github.com/suxi-ms/machinelearning
suxi-ms Apr 27, 2020
7f89fea
update model signature
suxi-ms Apr 28, 2020
42dcbc2
update rca interface by removing transformer
suxi-ms May 7, 2020
9893fad
add more documents
suxi-ms May 7, 2020
c831e43
update
suxi-ms May 8, 2020
16f5b33
update
suxi-ms May 9, 2020
9cd8739
update the constructor
suxi-ms May 9, 2020
f80c200
update comments
suxi-ms May 9, 2020
7c1c348
fix typo
suxi-ms May 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.TimeSeries;

namespace Samples.Dynamic
{
public static class LocalizeRootCause
{
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for
// exception tracking and logging, as well as the source of randomness.
var mlContext = new MLContext();

// Create an empty list as the dataset. The 'NormalizeText' API does not
// require training data as the estimator ('TextNormalizingEstimator')
// created by 'NormalizeText' API is not a trainable estimator. The
// empty list is only needed to pass input schema to the pipeline.
var emptySamples = new List<RootCauseLocalizationData>();

// Convert sample list to an empty IDataView.
var emptyDataView = mlContext.Data.LoadFromEnumerable(emptySamples);

// A pipeline for localizeing root cause.
Copy link
Contributor

@harishsk harishsk Apr 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localizeing [](start = 30, length = 11)

typo: localizing #Resolved

Copy link
Member Author

@suxi-ms suxi-ms Apr 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localizeing [](start = 30, length = 11)

typo: localizing

updated #Resolved

var localizePipeline = mlContext.Transforms.LocalizeRootCauseByDT(nameof(RootCauseLocalizationTransformedData.RootCause), nameof(RootCauseLocalizationData.Input));

// Fit to data.
var localizeTransformer = localizePipeline.Fit(emptyDataView);

// Create the prediction engine to get the root cause result from the
// input data.
var predictionEngine = mlContext.Model.CreatePredictionEngine<RootCauseLocalizationData,
RootCauseLocalizationTransformedData>(localizeTransformer);

// Call the prediction API.
var data = new RootCauseLocalizationData(new DateTime(), new Dictionary<String, String>(), new List<MetricSlice>() { new MetricSlice(new DateTime(), new List<Microsoft.ML.Transforms.TimeSeries.Point>()) }, "SUM", "SUM");

var prediction = predictionEngine.Predict(data);

// Print the localization result.
Console.WriteLine($"Localized result: {prediction.RootCause}");
}


private class RootCauseLocalizationData
{
[RootCauseLocalizationInputType]
public RootCauseLocalizationInput Input { get; set; }

public RootCauseLocalizationData()
{
Input = null;
}

public RootCauseLocalizationData(DateTime anomalyTimestamp, Dictionary<string, string> anomalyDimensions, List<MetricSlice> slices,String aggregateType, string aggregateSymbol)
{
Input = new RootCauseLocalizationInput(anomalyTimestamp, anomalyDimensions, slices, DTRootCauseLocalizationEstimator.AggregateType.Sum, aggregateSymbol);
}
}

private class RootCauseLocalizationTransformedData
{
[RootCauseType()]
public RootCause RootCause { get; set; }

public RootCauseLocalizationTransformedData()
{
RootCause = null;
}
}
}
}
Loading