-
Notifications
You must be signed in to change notification settings - Fork 67
Minor changes in the wrapper #7
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
base: master
Are you sure you want to change the base?
Conversation
2) added pairwise potential callbacks to the C++ wrapper, so that arbitrary pairwise potential suitable for expansion/swap can be specified
|
Hi Roman. |
|
Hi Andy, I’ve committed few follow-up edits. They concern double energies for varying edge potentials. The condition Roman |
|
Andy, 2 more follow-up edits.
Cheers, |
|
Thanks a lot. I'll try to get it merged on the weekend. I am not using submodular energies for learning any more, now... |
|
I tested it with your implementations of structured SVM — both cutting-plane and subgradient (thanks, BTW!). I switched from Joachims' SVM^struct code, because it was messy, used the QP solver that behaved weirdly, and was unlikely to be substantially faster, since the bottleneck was in CRF inference anyway. The standard way for learning submodular/associative function is to use non-negative pairwise features and non-negative pairwise weights (assuming you maximize the scoring function). As I tested only on the toy example, the weights were non-negative all the time during learning. In practice they eventually are negative, in this case you can take a projection. In the subgradient method this is fine, but for cutting-plane it is just an heuristic. In the latter case you’d better add the non-negativity constraints to the QP. If there are not many pairwise weights, it works well. |
|
Cool, I didn't know you were using my code. There is actually an option in the n-slack version of my code to add the non-negativity constraint to the QP (there is an example in one of the tests, I was just wondering if you managed it to get the constraint into SVM^struct, which I didn't get to work :-/ |
|
Btw, I recently made some changes in the subgradient and n-slack solvers to use mini-batches. In case of the subgradient method the minibatches are of size |
Well, lately I used Yu’s latent SVM^struct code, which implements a proximate variant of the cutting-plane method. Besides, it allows using the MOSEK solver for QP, which seems more stable. When there are order of 10 non-negative weights, it works well.
This is definitely worth trying, thanks! |
Hi Andreas,
I needed a more general wrapper for the GCO library, so I made several changes:
GCO allows to redefine the energy type used, and the floating-point energy is often useful. In theory, it may work much slower (since augmenting-path max-flow algorithms are inherently designed for integer capacities), but is often OK in practice. Now, changing one compile-time definition in gco_python.pyx sets the type.
I’ve added pairwise potential callbacks to the C++ wrapper, so that
arbitrary pairwise potential suitable for expansion/swap can be specified. I thought that this was the only way to implement the generalized Potts potentials (i.e. that vary across edges), but later I noticed that for general graphs I can specify the edge weights.
However, this feature is still can be useful for anyone who needs more general pairwise potentials (e.g. associative potentials that are learned separately for different labels).
I don’t know if your consider those changes useful. Please look at the diffs. Also, I am new to Cython, so some code may be not idiomatic or look stupid.
Regards,
Roman