-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
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 f727a79
add test cases
suxi-ms 92de1dc
revert sln changes
suxi-ms 798289c
add evaluation
suxi-ms f2e128d
temp save for internal review
suxi-ms 51569e3
rename function
suxi-ms 59c6e89
temp save bottom up points for switch desktop
suxi-ms 29216e0
update from laptop
suxi-ms 69da330
save for add test
suxi-ms e1c5432
add root cause localization algorithm
suxi-ms 3a1d1c5
add root cause localization algorithm
suxi-ms 8f97602
print score, path and directions in sample
suxi-ms 48123f4
merge with master
suxi-ms c47302f
extract root cause analyzer
suxi-ms b07ad28
refine code
suxi-ms c729877
merge with master
suxi-ms ebbdb0d
update for algorithm
suxi-ms 0d43b0d
add evaluatin
suxi-ms 5778eed
some refine for code
suxi-ms c9ed044
fix some typo
suxi-ms e440f25
remove unused code
suxi-ms feba6f4
reformat code
suxi-ms 686831c
updates
suxi-ms ddc8a36
update from review
suxi-ms 475ee8a
read double for beta
suxi-ms 8d874ca
remove SignatureDataTransform constructor
suxi-ms 0674ab3
update
suxi-ms 4c5b8fb
update
suxi-ms 08d607c
remove white space
suxi-ms c688233
refine internal logic
suxi-ms 98637db
update
suxi-ms 4ff2ed1
update
suxi-ms c22ad50
updated test
suxi-ms ea7ddbe
update score
suxi-ms 547aef2
update variable name
suxi-ms 8d17c3c
add some comments
suxi-ms 66b614a
refine internal function
suxi-ms 12e7e18
handle for infinity and nan
suxi-ms e213615
rename the algorithm by removing DT
suxi-ms 30915cd
Update src/Microsoft.ML.TimeSeries/RootCauseAnalyzer.cs
suxi-ms fda4ec7
fix type
suxi-ms 620ef58
add an else branch when delta is negative
suxi-ms ae5722f
Merge branch 'master' of https://github.com/suxi-ms/machinelearning
suxi-ms 7f89fea
update model signature
suxi-ms 42dcbc2
update rca interface by removing transformer
suxi-ms 9893fad
add more documents
suxi-ms c831e43
update
suxi-ms 16f5b33
update
suxi-ms 9cd8739
update the constructor
suxi-ms f80c200
update comments
suxi-ms 7c1c348
fix typo
suxi-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/LocalizeRootCauseByDT.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
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; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: localizing #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated #Resolved