| 115 | // ---------------------------------------------------------------------------------------- |
| 116 | |
| 117 | int main() |
| 118 | { |
| 119 | std::vector<sample_type> samples; |
| 120 | std::vector<double> labels; |
| 121 | |
| 122 | // Declare an instance of the kernel we will be using. |
| 123 | const kernel_type kern(0.1); |
| 124 | |
| 125 | // create a dataset with two concentric circles. There will be 100 points on each circle. |
| 126 | generate_concentric_circles(samples, labels, 100); |
| 127 | |
| 128 | empirical_kernel_map<kernel_type> ekm; |
| 129 | |
| 130 | |
| 131 | // Here we create an empirical_kernel_map using all of our data samples as basis samples. |
| 132 | cout << "\n\nBuilding an empirical_kernel_map with " << samples.size() << " basis samples." << endl; |
| 133 | ekm.load(kern, samples); |
| 134 | cout << "Test the empirical_kernel_map when loaded with every sample." << endl; |
| 135 | test_empirical_kernel_map(samples, labels, ekm); |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | // create a new dataset with two concentric circles. There will be 1000 points on each circle. |
| 143 | generate_concentric_circles(samples, labels, 1000); |
| 144 | // Rather than use all 2000 samples as basis samples we are going to use the |
| 145 | // linearly_independent_subset_finder to pick out a good basis set. The idea behind this |
| 146 | // object is to try and find the 40 or so samples that best spans the subspace containing all the |
| 147 | // data. |
| 148 | linearly_independent_subset_finder<kernel_type> lisf(kern, 40); |
| 149 | // populate lisf with samples. We have configured it to allow at most 40 samples but this function |
| 150 | // may determine that fewer samples are necessary to form a good basis. In this example program |
| 151 | // it will select only 26. |
| 152 | fill_lisf(lisf, samples); |
| 153 | |
| 154 | // Now reload the empirical_kernel_map but this time using only our small basis |
| 155 | // selected using the linearly_independent_subset_finder. |
| 156 | cout << "\n\nBuilding an empirical_kernel_map with " << lisf.size() << " basis samples." << endl; |
| 157 | ekm.load(lisf); |
| 158 | cout << "Test the empirical_kernel_map when loaded with samples from the lisf object." << endl; |
| 159 | test_empirical_kernel_map(samples, labels, ekm); |
| 160 | |
| 161 | |
| 162 | cout << endl; |
| 163 | } |
| 164 | |
| 165 | // ---------------------------------------------------------------------------------------- |
| 166 |
nothing calls this directly
no test coverage detected