-
Notifications
You must be signed in to change notification settings - Fork 138
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
integrate tribuo anomaly detection based on libSVM #96
Conversation
c102aa4
to
064e441
Compare
477bc0e
to
69594a7
Compare
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.
approved with 2 comments.
} | ||
|
||
@Override | ||
public int getVersion() { |
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.
Just curious: this version is always 1?
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.
We set version as 1 for first release. May change to higher version in future
KernelType kernelType = parseKernelType(); | ||
SVMParameters params = new SVMParameters<>(new SVMAnomalyType(SVMAnomalyType.SVMMode.ONE_CLASS), kernelType); | ||
Double gamma = Optional.ofNullable(parameters.getGamma()).orElse(DEFAULT_GAMMA); | ||
Double nu = Optional.ofNullable(parameters.getNu()).orElse(DEFAULT_NU); | ||
params.setGamma(gamma); | ||
params.setNu(nu); | ||
if (parameters.getCost() != null) { | ||
params.setCost(parameters.getCost()); | ||
} | ||
if (parameters.getCoeff() != null) { | ||
params.setCoeff(parameters.getCoeff()); | ||
} | ||
if (parameters.getEpsilon() != null) { | ||
params.setEpsilon(parameters.getEpsilon()); | ||
} | ||
if (parameters.getDegree() != null) { | ||
params.setDegree(parameters.getDegree()); | ||
} | ||
MutableDataset<Event> data = TribuoUtil.generateDataset(dataFrame, new AnomalyFactory(), | ||
"Anomaly detection LibSVM training data from OpenSearch", TribuoOutputType.ANOMALY_DETECTION_LIBSVM); | ||
|
||
LibSVMAnomalyTrainer trainer = new LibSVMAnomalyTrainer(params); |
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.
nitpick: why not use a function to instantiate the params and LibSVMAnomalyTrainer to make the train() body smaller?
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.
Will tune this part in next PR.
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Yaliang Wu ylwu@amazon.com
Description
Integrate tribuo anomaly detection algorithm which based on libSVM. Check this doc https://tribuo.org/learn/4.1/docs/features.html#anomaly-detection
Issues Resolved
#98
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.