using HDF5
h5file = h5open("hw_data.h5", "r")
train_x = permutedims(read(h5file["train_x"]), [2, 1])
train_y = read(h5file["train_y"])
test_x = permutedims(read(h5file["test_x"]), [2, 1])
close(h5file)
println(size(train_x))
println(size(train_y))
println(size(test_x))
using LinearAlgebra
# train ridge regression
l = 2.0
covMat = transpose(train_x) * train_x
w = inv(covMat + l * I) * transpose(train_x) * train_y
# get predictions
test_y = test_x * w
test_y_round = map(x->UInt8(round(x)), test_y)
test_y_output = String(test_y_round)