def sigmoid(x, a, c, fw):
    """Sigmoid function with scale parameter a and horizontal shift c, evaluated
    at point x using the framework fw (numpy or theano.tensor).
    """
    return 1. / (1. + fw.exp(-1. * a * (x - c)))