yat  0.21pre
QuantileNormalizer2.h
1 #ifndef _theplu_yat_normalizer_quantile_normalizer2_
2 #define _theplu_yat_normalizer_quantile_normalizer2_
3 
4 // $Id: QuantileNormalizer2.h 4191 2022-07-18 10:14:18Z peter $
5 
6 /*
7  Copyright (C) 2022 Peter Johansson
8 
9  This file is part of the yat library, https://dev.thep.lu.se/yat
10 
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15 
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <https://www.gnu.org/licenses/>.
23 */
24 
25 #include "yat/regression/LinearInterpolation.h"
26 #include "yat/utility/Vector.h"
27 
28 namespace theplu {
29 namespace yat {
30  namespace utility {
31  class MatrixBase;
32  class MatrixMutable;
33  }
34 namespace normalizer {
35 
51  {
52  public:
56  QuantileNormalizer2(void);
57 
62 
67 
72 
77 
86  void train(const utility::MatrixBase& data);
87 
104  void operator()(const utility::MatrixBase& input,
105  utility::MatrixMutable& result);
106 
122  void normalize(const utility::MatrixBase& input,
123  utility::MatrixMutable& result) const;
124 
149  void normalize(const utility::VectorBase& input,
150  utility::VectorMutable& result) const;
151 
152  private:
153  friend void swap(QuantileNormalizer2& lhs, QuantileNormalizer2& rhs);
154  utility::Vector distribution_;
155  mutable std::unique_ptr<regression::LinearInterpolation> interpolator_;
156 
157  void create_index(const utility::MatrixBase& X,
158  std::vector<std::vector<size_t>>& index) const;
159 
160  regression::LinearInterpolation& interpolator(void) const;
161 
162  void normalize(utility::VectorMutable& result,
163  const std::vector<size_t>& index) const;
164  void normalize(utility::VectorMutable& result,
165  const std::vector<size_t>& index,
166  regression::LinearInterpolation& interpolator) const;
167 
168  void normalize(utility::MatrixMutable& result,
169  const std::vector<std::vector<size_t>>& index) const;
170  void normalize(utility::MatrixMutable& result,
171  const std::vector<std::vector<size_t>>& index,
172  regression::LinearInterpolation& interpolator) const;
173 
174  void train(const utility::MatrixBase& X,
175  const std::vector<std::vector<size_t>>& index);
176  };
177 
183  void swap(QuantileNormalizer2& lhs, QuantileNormalizer2& rhs);
184 
185 }}} // end of namespace normalizer, yat and thep
186 #endif
Perform quantile normalization.
Definition: QuantileNormalizer2.h:50
Definition: MatrixBase.h:54
The Department of Theoretical Physics namespace as we define it.
void operator()(const utility::MatrixBase &input, utility::MatrixMutable &result)
perform the quantile normalization.
QuantileNormalizer2 & operator=(const QuantileNormalizer2 &rhs)
This is the yat interface to GSL vector.
Definition: Vector.h:59
This is the yat interface to GSL vector.
Definition: VectorBase.h:55
This is the mutable interface to GSL vector.
Definition: VectorMutable.h:56
void normalize(const utility::MatrixBase &input, utility::MatrixMutable &result) const
Linear interpolation.
Definition: LinearInterpolation.h:42
Definition: MatrixMutable.h:58
void train(const utility::MatrixBase &data)

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14