/usr/include/mlpack/core/tree/binary_space_tree/mean_split.hpp is in libmlpack-dev 1.0.10-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | /**
* @file mean_split.hpp
* @author Yash Vadalia
* @author Ryan Curtin
*
* Definition of MeanSplit, a class that splits a binary space partitioning tree
* node into two parts using the mean of the values in a certain dimension.
*
* This file is part of MLPACK 1.0.10.
*
* MLPACK is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* MLPACK is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details (LICENSE.txt).
*
* You should have received a copy of the GNU General Public License along with
* MLPACK. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MLPACK_CORE_TREE_BINARY_SPACE_TREE_MEAN_SPLIT_HPP
#define __MLPACK_CORE_TREE_BINARY_SPACE_TREE_MEAN_SPLIT_HPP
#include <mlpack/core.hpp>
namespace mlpack {
namespace tree /** Trees and tree-building procedures. */ {
/**
* A binary space partitioning tree node is split into its left and right child.
* The split is done in the dimension that has the maximum width. The points are
* divided into two parts based on the mean in this dimension.
*/
template<typename BoundType, typename MatType = arma::mat>
class MeanSplit
{
public:
/**
* Split the node according to the mean value in the dimension with maximum
* width.
*
* @param bound The bound used for this node.
* @param data The dataset used by the binary space tree.
* @param begin Index of the starting point in the dataset that belongs to
* this node.
* @param count Number of points in this node.
* @param splitDimension This will be filled with the dimension the node is to
* be split on.
* @param splitCol The index at which the dataset is divided into two parts
* after the rearrangement.
*/
static bool SplitNode(const BoundType& bound,
MatType& data,
const size_t begin,
const size_t count,
size_t& splitDimension,
size_t& splitCol);
/**
* Split the node according to the mean value in the dimension with maximum
* width and return a list of changed indices.
*
* @param bound The bound used for this node.
* @param data The dataset used by the binary space tree.
* @param begin Index of the starting point in the dataset that belongs to
* this node.
* @param count Number of points in this node.
* @param splitDimension This will be filled with the dimension the node is
* to be split on.
* @param splitCol The index at which the dataset is divided into two parts
* after the rearrangement.
* @param oldFromNew Vector which will be filled with the old positions for
* each new point.
*/
static bool SplitNode(const BoundType& bound,
MatType& data,
const size_t begin,
const size_t count,
size_t& splitDimension,
size_t& splitCol,
std::vector<size_t>& oldFromNew);
private:
/**
* Reorder the dataset into two parts such that they lie on either side of
* splitCol.
*
* @param data The dataset used by the binary space tree.
* @param begin Index of the starting point in the dataset that belongs to
* this node.
* @param count Number of points in this node.
* @param splitDimension The dimension to split the node on.
* @param splitVal The split in dimension splitDimension is based on this
* value.
*/
static size_t PerformSplit(MatType& data,
const size_t begin,
const size_t count,
const size_t splitDimension,
const double splitVal);
/**
* Reorder the dataset into two parts such that they lie on either side of
* splitCol. Also returns a list of changed indices.
*
* @param data The dataset used by the binary space tree.
* @param begin Index of the starting point in the dataset that belongs to
* this node.
* @param count Number of points in this node.
* @param splitDimension The dimension to split the node on.
* @param splitVal The split in dimension splitDimension is based on this
* value.
* @param oldFromNew Vector which will be filled with the old positions for
* each new point.
*/
static size_t PerformSplit(MatType& data,
const size_t begin,
const size_t count,
const size_t splitDimension,
const double splitVal,
std::vector<size_t>& oldFromNew);
};
}; // namespace tree
}; // namespace mlpack
// Include implementation.
#include "mean_split_impl.hpp"
#endif
|