This repository was archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3fca5d4
Cleanup.
adampauls 350b232
CLeanup.
adampauls 8790455
More cleanup
adampauls 6ecc554
Fix
adampauls eb01b2f
Give decoders the ability to track state across calls.
adampauls bdf0547
Whoops.
adampauls 5a33ccf
PR comments
adampauls 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| package epic.logo | ||
|
|
||
| trait ArgmaxInferencer[T, Y, W] { | ||
|
|
||
| def argmax(weights : Weights[W], instance : T) : (Y, W, Double) | ||
| trait ArgmaxInferencer[T, W, S] extends Inferencer[S] { | ||
| type Y | ||
|
|
||
| def argmax(weights : Weights[W], instance : T) : (Y, W, Double, S) | ||
| def initialState: S | ||
| def reduceStates(s1: S, s2: S): S | ||
| } |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| package epic.logo | ||
|
|
||
| trait Decoder[T, W] { | ||
|
|
||
| def decode(weights : Weights[W], instance : T) : (W, Double) | ||
| trait Decoder[T, W, OracleS, MaxerS] { | ||
|
|
||
| def decode(weights : Weights[W], instance : T) : (W, Double, OracleS, MaxerS) | ||
| def initialState: (OracleS, MaxerS) | ||
| def reduceStates(states1: (OracleS, MaxerS), states2: (OracleS, MaxerS)): (OracleS, MaxerS) | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| package epic.logo | ||
|
|
||
| trait ExpectationInferencer[T, W] { | ||
|
|
||
| def expectations(weights : Weights[W], instance : T) : (W, Double) | ||
| trait ExpectationInferencer[T, W, S] extends Inferencer[S] { | ||
|
|
||
| def expectations(weights: Weights[W], instance: T): (W, Double, S) | ||
| } |
This file contains hidden or 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,7 @@ | ||
| package epic.logo | ||
|
|
||
| trait Inferencer[S] { | ||
| def initialState: S | ||
| def reduceStates(state1: S, state2: S): S | ||
|
|
||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| package epic.logo | ||
|
|
||
| trait IterationCallback[T, W] { | ||
| trait IterationCallback[T, W, OracleS, MaxerS] { | ||
|
|
||
| def startIteration(iter : Int, weights : Weights[W]) : Unit = {} | ||
|
|
||
| def startMinibatch(iter : Int, weights : Weights[W], miniBatch : Array[MinibatchInput[T, W]]) : Unit = {} | ||
| def endMinibatch(iter : Int, weights : Weights[W], miniBatch : Array[MinibatchOutput[T, W]]) : Unit = {} | ||
| def endIteration(iter : Int, weights : Weights[W]) : Unit = {} | ||
| def endMinibatch(iter : Int, weights : Weights[W], miniBatch : Array[MinibatchOutput[T, W, OracleS, MaxerS]]) : Unit = {} | ||
| def endIteration(iter : Int, weights : Weights[W], oracleState: OracleS, maxerState: MaxerS) : Unit = {} | ||
|
|
||
| def objectiveValCheck(primal : Double, dual : Double, iter : Int, weights : Weights[W]) : Unit = {} | ||
|
|
||
| def converged(weights : Weights[W], data : Seq[Instance[T, W]], iter : Int, numNewConstraints : Int) : Boolean = false | ||
|
|
||
| } | ||
|
|
||
| case class NullIterationCallback[T, W]() extends IterationCallback[T, W] | ||
| case class NullIterationCallback[T, W, S1, S2]() extends IterationCallback[T, W, S1, S2] |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| package epic.logo | ||
|
|
||
| trait LossAugmentedArgmaxInferencer[T, Y, W] extends ArgmaxInferencer[T, Y, W] { | ||
| trait LossAugmentedArgmaxInferencer[T, W, S] extends ArgmaxInferencer[T, W, S] { | ||
|
|
||
| def argmax(weights : Weights[W], instance : T) : (Y, W, Double) = lossAugmentedArgmax(weights, instance, 1.0, 0.0) | ||
| def argmax(weights : Weights[W], instance : T) : (Y, W, Double, S) = lossAugmentedArgmax(weights, instance, 1.0, 0.0) | ||
|
|
||
| def lossAugmentedArgmax(weights : Weights[W], instance : T, weightsWeight : Double, lossWeight : Double) : (Y, W, Double) | ||
| def lossAugmentedArgmax(weights : Weights[W], instance : T, weightsWeight : Double, lossWeight : Double) : (Y, W, Double, S) | ||
|
|
||
| } |
6 changes: 3 additions & 3 deletions
6
src/main/scala/epic/logo/LossAugmentedExpectationInferencer.scala
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| package epic.logo | ||
|
|
||
| trait LossAugmentedExpectationInferencer[T, W] extends ExpectationInferencer[T, W] { | ||
| trait LossAugmentedExpectationInferencer[T, W, S] extends ExpectationInferencer[T, W, S] { | ||
|
|
||
| def expectations(weights : Weights[W], instance : T) : (W, Double) = lossAugmentedExpectations(weights, instance, 1.0, 0.0) | ||
| def expectations(weights : Weights[W], instance : T) : (W, Double, S) = lossAugmentedExpectations(weights, instance, 1.0, 0.0) | ||
|
|
||
| def lossAugmentedExpectations(weights : Weights[W], instance : T, weightsWeight : Double, lossWeight : Double) : (W, Double) | ||
| def lossAugmentedExpectations(weights : Weights[W], instance : T, weightsWeight : Double, lossWeight : Double) : (W, Double, S) | ||
|
|
||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| package epic.logo | ||
|
|
||
| case class MinibatchInput[T, W](val instance : Instance[T, W], val instanceNum : Int) | ||
| case class MinibatchInput[T, W](instance : Instance[T, W], instanceNum : Int) | ||
|
|
||
| case class MinibatchOutput[T, W](val instance : Instance[T, W], val instanceNum : Int, val df : W, val loss : Double) | ||
| case class MinibatchOutput[T, W, OracleS, MaxerS]( | ||
| instance: Instance[T, W], instanceNum: Int, df: W, loss: Double, | ||
| oracleState: OracleS, maxerState: MaxerS) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| package epic.logo | ||
|
|
||
| trait OracleInferencer[T, Y, W] { | ||
|
|
||
| def oracle(weights : Weights[W], instance : T) : (Y, W, Double) | ||
| trait OracleInferencer[T, W, S] extends Inferencer[S] { | ||
| type Y | ||
|
|
||
| def oracle(weights : Weights[W], instance : T) : (Y, W, Double, S) | ||
| } |
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.
S is suffstats?
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.
how does it relate to W?
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.
oh state. i don't quite understand its role
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.
Arbitrary state that the implementers of inferencers may want to carry around. The abstraction is like mapreduce: you return some stuff, and also say how to combine that stuff, then you get the combined stuff in various callbacks. Allows inferencers to have internal state without worrying about threadsafety. Sounds like I need some comments.
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.
yes please
On Thu, May 26, 2016 at 8:26 PM, adampauls [email protected] wrote: