def test_smooth_spline_scipy_cv(self): """Test the univariate spline using spline (with crossvalidation)""" sm = smoothing.UnivarSplineCV() sm.initialize(self.data1, self.data2) r = sm.predict(self.data1) self.assertEqual(len(r), 8) # This is slightly better than the NoCV variation expected = [ 4.1626385843797094, 7.3804099239612029, 8.9667396489152544, 10.384851777100122, 11.316311505414465, 13.994282700490476, 7.5367306411050095, 5.8580352186337672 ] for a, b in zip(expected, r): self.assertTrue(abs(1.0 - a / b) < 0.1)