@@ -0,0 +1,811 @@
+import numpy as np%0Aimport numpy.testing as npt%0A%0Afrom unittest import TestCase, mock%0A%0Afrom pyewa.loss_functions import Squared%0A%0A%0Aclass TestSquared(object):%0A    def test_init(self):%0A        squared = Squared(B=1)%0A        assert squared.C == 4%0A        assert squared.max_learning_rate == 1 / 8%0A%0A    def test_loss(self):%0A        squared = Squared(B=1)%0A%0A        # 1d%0A        y1 = 4%0A        Y = np.array(%5B10, 5%5D)%0A        npt.assert_allclose(squared.loss(y1, Y), 37.0)%0A%0A        # 2d%0A        y1 = np.array(%5B10, 3%5D)%0A        Y = np.array(%5B%5B10, 5%5D, %5B2, 1%5D%5D)%0A        npt.assert_allclose(squared.loss(y1, Y), %5B4.0, 68.0%5D)%0A%0A        # 2d%0A        y1 = np.array(%5B15, 2, 4%5D)%0A        Y = np.array(%5B%5B15, 2, 4%5D, %5B15, 2, 4%5D, %5B15, 2, 4%5D%5D)%0A        print(squared.loss(y1, Y))%0A        npt.assert_allclose(squared.loss(y1, Y), %5B0, 0, 0%5D)%0A

Test loss functions