|
| template<typename Distance, typename Point_range, typename PointOutputIterator, typename DistanceOutputIterator = Null_output_iterator> |
| void | Gudhi::subsampling::choose_n_farthest_points (Distance dist, Point_range const &input_pts, std::size_t final_size, std::size_t starting_point, PointOutputIterator output_it, DistanceOutputIterator dist_it={}) |
| | Subsample by an iterative, greedy strategy.
|
| template<typename Distance, typename Point_range, typename PointOutputIterator, typename DistanceOutputIterator = Null_output_iterator> |
| void | Gudhi::subsampling::choose_n_farthest_points_metric (Distance dist_, Point_range const &input_pts, std::size_t final_size, std::size_t starting_point, PointOutputIterator output_it, DistanceOutputIterator dist_it={}) |
| | Subsample by an iterative, greedy strategy.
|
| template<typename Point_container, typename OutputIterator> |
| void | Gudhi::subsampling::pick_n_random_points (Point_container const &points, std::size_t final_size, OutputIterator output_it) |
| | Subsample a point set by picking random vertices.
|
| template<typename Kernel, typename Point_range, typename OutputIterator> |
| void | Gudhi::subsampling::sparsify_point_set (const Kernel &k, Point_range const &input_pts, typename Kernel::FT min_squared_dist, OutputIterator output_it) |
| | Outputs a subset of the input points so that the squared distance between any two points is greater than min_squared_dist.
|
- Author
- Clément Jamin, Siargey Kachanovich, Marc Glisse
Introduction
This Gudhi component offers methods to subsample a set of points.
Example: sparsify_point_set
This example outputs a subset of the input points so that the squared distance between any two points is greater than or equal to 0.4.
#include <gudhi/sparsify_point_set.h>
#include <CGAL/Epick_d.h>
#include <CGAL/Random.h>
#include <iostream>
#include <vector>
#include <iterator>
int main(void) {
typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
typedef typename K::Point_d Point_d;
CGAL::Random rd;
std::vector<Point_d> points;
for (int i = 0; i < 500; ++i)
points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
rd.get_double(-1., 1), rd.get_double(-1., 1)));
K k;
std::vector<Point_d> results;
std::clog << "Before sparsification: " << points.size() << " points.\n";
std::clog << "After sparsification: " << results.size() << " points.\n";
return 0;
}
void sparsify_point_set(const Kernel &k, Point_range const &input_pts, typename Kernel::FT min_squared_dist, OutputIterator output_it)
Outputs a subset of the input points so that the squared distance between any two points is greater t...
Definition sparsify_point_set.h:50
Example: choose_n_farthest_points
This example outputs a subset of 100 points obtained by González algorithm, starting with a random point, and greedily adding the point farthest from those already picked.
#include <gudhi/choose_n_farthest_points.h>
#include <CGAL/Epick_d.h>
#include <CGAL/Random.h>
#include <iostream>
#include <vector>
#include <iterator>
int main(void) {
typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
typedef typename K::Point_d Point_d;
CGAL::Random rd;
std::vector<Point_d> points;
for (int i = 0; i < 500; ++i)
points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
rd.get_double(-1., 1), rd.get_double(-1., 1)));
K k;
std::vector<Point_d> results;
std::back_inserter(results));
std::clog << "Before sparsification: " << points.size() << " points.\n";
std::clog << "After sparsification: " << results.size() << " points.\n";
return 0;
}
void choose_n_farthest_points(Distance dist, Point_range const &input_pts, std::size_t final_size, std::size_t starting_point, PointOutputIterator output_it, DistanceOutputIterator dist_it={})
Subsample by an iterative, greedy strategy.
Definition choose_n_farthest_points.h:76
@ random_starting_point
Definition choose_n_farthest_points.h:44
There is an alternative version choose_n_farthest_points_metric() with the same syntax, which can be faster in many cases.
Example: pick_n_random_points
This example outputs a subset of 100 points picked randomly.
#include <gudhi/pick_n_random_points.h>
#include <CGAL/Epick_d.h>
#include <CGAL/Random.h>
#include <iostream>
#include <vector>
#include <iterator>
int main(void) {
typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
typedef typename K::Point_d Point_d;
CGAL::Random rd;
std::vector<Point_d> points;
for (int i = 0; i < 500; ++i)
points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
rd.get_double(-1., 1), rd.get_double(-1., 1)));
K k;
std::vector<Point_d> results;
std::clog << "Before sparsification: " << points.size() << " points.\n";
std::clog << "After sparsification: " << results.size() << " points.\n";
return 0;
}
void pick_n_random_points(Point_container const &points, std::size_t final_size, OutputIterator output_it)
Subsample a point set by picking random vertices.
Definition pick_n_random_points.h:38