def predict(self,x): ''' Predict p(y|x) = f(x;w) ------------------------ NOTE: this 'activation' is simply the dot product for OLS, however, for more advanced, e.g., two-layered networks, it's not so straightforward; we need to be careful with internal memory variables like z. ''' return self.f(activation(self.w,x)) #return self.f(dot(self.w,x))
def F_sigmoid(w,x): ''' should return M * L matrix given by the linearization of f(w'x) ''' df = dsigmoid(activation(w,x)) * x # where activation = (dot(self.w,x)) return df #* (w - w_0)