-
-
Save karlnapf/939e8b1df0046f9fc22c4fc170012f42 to your computer and use it in GitHub Desktop.
This file contains 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
// summary of API ideas | |
//option1:(tags) no explicit instantiation of sub-class, runtime error when labels are used | |
// note the subclasses (CBinaryLabels, ... ) do exist still (implementing e.g. "get_binary_vector", | |
// or "get_confidence_matrix", they are just never instantiated by the user | |
labels = CLabels() | |
labels.set_data(file, vector, or matrix) // tags | |
{ | |
how to do this? | |
} | |
// user calls algorithm | |
machine.set_labels(labels) // tags, no runtime error | |
predicted = machine.apply() | |
{ | |
// algorithm knows which representation it wants, so can now "cast" | |
// preferably, this vector would be template free | |
SGVector label_vector = get("labels").as_binary().get_values() // potential runtime error | |
// how is as_binary implemented? | |
} | |
//user extracts | |
SGVector predicted.as_binary().get_values() // works, returns vector {-1,1} | |
SGVector predicted.as_binary().get_scores() // works, returns real vector | |
SGMatrix predicted.as_multiclass().get_values() // works, vector {0,1} | |
SGMatrix predicted.as_multiclass().get_scores() // works, real matrix (with only two rows) | |
predicted.as_regression().get_values() // runtime error, no point to convert discrete to real |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like we need to define what type
apply()
andas_binary()
should return. If we want bothas_binary().get_values()
andas_binary().get_scores()
, in addition to label values we need to have prediction scores in there too.