def predict(self, xs): if self.bias: xs = add_feature_bias(xs) return np.rint(self.hfunc(xs, self.ws))
def train(self, xs, ys): if self.bias: xs = add_feature_bias(xs) g = GradientDescentOptimizer(self.hfunc, self.costfunc, convergence=1e-6, \ learning_rate=0.001, regularization=self.l, max_iters=1e4) self.ws = g.optimize(xs, ys)