flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thvasilo <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2297] [ml] Add threshold setting for SV...
Date Tue, 30 Jun 2015 13:17:20 GMT
Github user thvasilo commented on a diff in the pull request:

    --- Diff: flink-staging/flink-ml/src/main/scala/org/apache/flink/ml/classification/SVM.scala
    @@ -242,8 +275,21 @@ object SVM{
    -      override def predict(value: T, model: DenseVector): Double = {
    -        value.asBreeze dot model.asBreeze
    +      override def predict(value: T, model: DenseVector, predictParameters: ParameterMap):
    +        Double = {
    +        val thresholdOption = predictParameters.get(Threshold)
    +        val rawValue = value.asBreeze dot model.asBreeze
    +        // If the Threshold option has been reset, we will get back a Some(None) thresholdOption
    +        // causing the exception when we try to get the value. In that case we just return
    +        // raw value
    +        try {
    --- End diff --
    This part is a bit hacky and will have a performance impact. However it allows to do what
we want without needing to change the way ParameterMap works, and with the default behaviour
being that the thresholdOption is set, the exception should be triggered most of the time.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message