-
Notifications
You must be signed in to change notification settings - Fork 392
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
Model combiner #385
Model combiner #385
Changes from 1 commit
046dbef
ba8e587
315744e
6df8478
2dfec2f
82f130f
d3832ed
7690826
b39da7c
4f28cca
63bf74b
5bf6299
e57fe22
4e36467
96367d5
712e84e
6139bd0
7d27995
41c6654
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ trait SelectedCombinerParams extends Params { | |
isValid = (in: String) => CombinationStrategy.values.map(_.entryName).contains(in) | ||
) | ||
def setCombinationStrategy(value: CombinationStrategy): this.type = set(combinationStrategy, value.entryName) | ||
def getCombinationStrategy(): CombinationStrategy = CombinationStrategy.withName($(combinationStrategy)) | ||
def getCombinationStrategy(): CombinationStrategy= CombinationStrategy.withName($(combinationStrategy)) | ||
setDefault(combinationStrategy, CombinationStrategy.Best.entryName) | ||
|
||
} | ||
|
@@ -163,7 +163,8 @@ class SelectedCombiner | |
|
||
val (metricValue1, metricValue2) = (getMet(metricValueOpt1), getMet(metricValueOpt2)) | ||
|
||
val (weight1, weight2) = getCombinationStrategy() match { | ||
val strategy = getCombinationStrategy() | ||
val (weight1, weight2) = strategy match { | ||
case CombinationStrategy.Best => | ||
if (metricValue1 > metricValue2) (1.0, 0.0) else (0.0, 1.0) | ||
case CombinationStrategy.Weighted => | ||
|
@@ -173,7 +174,7 @@ class SelectedCombiner | |
} | ||
|
||
val model: SelectedCombinerModel = new SelectedCombinerModel( | ||
weight1 = weight1, weight2 = weight2, strategy = getCombinationStrategy(), | ||
weight1 = weight1, weight2 = weight2, strategy = strategy, | ||
operationName = operationName, uid = uid | ||
) | ||
.setEvaluators(evaluators) | ||
|
@@ -226,11 +227,11 @@ final class SelectedCombinerModel private[op] | |
} | ||
|
||
|
||
sealed abstract class CombinationStrategy(val name: String) extends EnumEntry with Serializable | ||
sealed abstract class CombinationStrategy extends EnumEntry with Serializable | ||
|
||
object CombinationStrategy extends Enum[CombinationStrategy] { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this enum should be defined in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docs here too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
val values = findValues | ||
case object Weighted extends CombinationStrategy("weighted") | ||
case object Equal extends CombinationStrategy("equal") | ||
case object Best extends CombinationStrategy("best") | ||
case object Weighted extends CombinationStrategy | ||
case object Equal extends CombinationStrategy | ||
case object Best extends CombinationStrategy | ||
} |
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.
this can be a method on
CombinationStrategy
itself. e.g.val (weight1, weight2) = getCombinationStrategy().computeWeights(metricValue1, metricValue2)
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.
it actually cant unless I move the EvalMetric class to the features module