CogComp / saul

Saul : Declarative Learning-Based Programming
Other
64 stars 18 forks source link

Make `using` accept classifiers: easy to use for pipeline models #448

Open danyaljj opened 8 years ago

danyaljj commented 8 years ago

Currently this is how we do pipeline:

object ClassifierLayer1 extends Learnable (node) {
   def label = labelProperty1
   def feature = using(property2, property3,...) 
 }

object ClassifierLayer2 extends Learnable (node) {
   def label = labelProperty2
   def feature = using(classifier1Labels, ,...) // using the prediction of the classifier in the previous layer 
 }

// defined in data-model 
val classifier1Labels = new Property(node){  x: Type => ClassifierLayer1(x)  }

But we should be able to skip the definition of the extra property classifier1Labels and just do:

object ClassifierLayer1 extends Learnable (node) {
   def label = labelProperty1
   def feature = using(property2, property3,...) 
 }

object ClassifierLayer2 extends Learnable (node) {
   def label = labelProperty2
   def feature = using(ClassifierLayer1, ,...) 
}

This is slightly trickier when the type of the node parameters for the two classifiers are not the same.