def maximum_likelyhood(y, X):

    def objective(b):
        b = np.matrix(b).T
return np.transpose(np.array(X.T * (y - X * b)))[0]
x0 = 1, 1
res = root(objective, x0=x0)
ValueError: object too deep for desired array