In [1]:
import numpy as np
import scipy.sparse as sp
In [2]:
import scipy.sparse.linalg as splin
In [3]:
from least_squares import ridge
In [4]:
# try the code used in the scikit-learn example.
test_X = sp.csc_matrix([[0, 1], [1, 2], [2, 3]])
test_Y = sp.csc_matrix([[2, 5, 8]]).T
In [5]:
tests_true_ans =sp.csc_matrix([ [1, 2]]).T
test_X.dot(tests_true_ans).toarray()
Out[5]:
In [14]:
sol = ridge(X = test_X, y = test_Y, lam = 0.001)
print(sol)
In [ ]: