Cost function

class mlbase.cost.CostFunc[source]

General cost function base class.

Y: result from forward network. tY: the given true result.

class mlbase.cost.TwoStageCost[source]

Cost function that needs two stage computation.

Step 1: obtain data statistics. Step 2: obtain label for each sample.

class mlbase.cost.IndependentCost[source]

Cost function for each sample cost known and final cost is a statistics for all sample cost.

mlbase.cost.aggregate(loss, weights=None, mode='mean')[source]

This code is from lasagne/objectives.py

class mlbase.cost.CrossEntropy[source]

Wrap of categorical_crossentropy from theano

class mlbase.cost.ImageDiff[source]

This is the base class for cost function for images. The input format is like:

tensor4, (patch, channel, column, row)

The channel should be 1 or 3.

class mlbase.cost.ImageSSE[source]

The sum of square error. Use aggregate() to get mean square error.

class mlbase.cost.ImageDice[source]

Dice coefficient. Y is the set of salient pixel in one binary image tY is another set of salient pixel in the other binary image. The Dice coefficient is: 2 * |Y ^ tY| / (|Y| + |tY|)