Sigmoid cost and cost_matrix mismatch

Fixes gh-744

Made cost, cost_matrix and cost_from_cost_matrix coherent for class Sigmoid and added a test to verify it. This is just a patch and I think we should eventually consider a design change because the current need for a layer to specify both cost, cost_matrix and cost_from_cost_matrix (which have a lot of redundancy) makes it very easy to forget one of them and get a mismatch between these ways to compute cost.