(self)
| 98 | ) |
| 99 | |
| 100 | def test_linear_combination(self): |
| 101 | |
| 102 | def dummy_function(X_in): |
| 103 | return np.ones(shape=(len(X_in), 1)) |
| 104 | |
| 105 | for n_samples in range(2, 10): |
| 106 | for n_features in range(1, 10): |
| 107 | for n_functions in range(2, 10): |
| 108 | functions = [dummy_function for _ in range(n_functions)] |
| 109 | linear_combination = modAL.utils.combination.make_linear_combination( |
| 110 | *functions) |
| 111 | |
| 112 | X_in = np.random.rand(n_samples, n_features) |
| 113 | if n_samples == 1: |
| 114 | true_result = float(n_functions) |
| 115 | else: |
| 116 | true_result = n_functions*np.ones(shape=(n_samples, 1)) |
| 117 | |
| 118 | try: |
| 119 | np.testing.assert_almost_equal( |
| 120 | linear_combination(X_in), true_result) |
| 121 | except: |
| 122 | linear_combination(X_in) |
| 123 | |
| 124 | def test_product(self): |
| 125 | for n_dim in range(1, 5): |
nothing calls this directly
no test coverage detected