Enable in-memory feature caching for properties#472
Enable in-memory feature caching for properties#472bhargav wants to merge 2 commits intoCogComp:masterfrom
Conversation
|
One big concern I have is the confusion that it might create a little confusion with |
| val a = new BooleanProperty[T](name, cachedF) with NodeProperty[T] { override def node: Node[T] = papply.node } | ||
| val a = new BooleanProperty[T](name, cachedF) with NodeProperty[T] { | ||
| override def node: Node[T] = papply.node | ||
| override val isCachingEnabled: Boolean = isStatic |
There was a problem hiding this comment.
Maybe change isCachingEnabled to sth closed to static? isStatic (or isStaticEnabled) itself sounds more clear
|
On the implementation, I'd suggestion different approach: we can reuse the existing caching. The only thing we have to do is to make sure we don't clean in between each training iterations. That is handled here by this function.. So the only change needed is, not calling the |
c17096e to
699f238
Compare
ce9450a to
08dec8b
Compare
|
This is ready to be reviewed. |
kordjamshidi
left a comment
There was a problem hiding this comment.
Just one renaming suggestions, otherwise this is good to me to merge.
| If you want to cache the value of a feature during a single iteration, use the `cache` parameter. | ||
|
|
||
| The `cache` parameter allows the value to be cached within a training/testing iteration. This is useful if you one of your features depends on evaluation of a Classifier on other instances as well. This recursive evaluation of the Classifier might be expensive and caching would speed-up performance. Look at a sample usage of this parameter in the [POSTagging Example](../../saul-examples/src/main/scala/edu/illinois/cs/cogcomp/saulexamples/nlp/POSTagger/POSDataModel.scala#L66). | ||
|
|
There was a problem hiding this comment.
if you one of your => if one of your
| val posWindow = property(token, cache = true) { | ||
| (t: ConllRawToken) => t.getNeighbors.map(n => posWindow(n)) | ||
| } | ||
| ``` |
There was a problem hiding this comment.
maybe iterationCache or perIterationCache? (instead of cache)
Work Items
Verify/Reason if we need a function to explicitly clear the cache?Idea: Cache static features that do not change across learning iterations. Improves training speed at the cost of using more memory for caching the features. Tested this on the Chunker app and there is a significant improvements to training time.