/usr/include/shogun/preprocessor/RescaleFeatures.h is in libshogun-dev 3.2.0-7.3build4.
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 | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 20013 Viktor Gal
* Copyright (C) 2013 Viktor Gal
*/
#ifndef __RESCALEFEATURES_H__
#define __RESCALEFEATURES_H__
#include <shogun/preprocessor/DensePreprocessor.h>
namespace shogun
{
/**@brief Preprocessor RescaleFeautres is rescaling the range of features to
* make the features independent of each other and aims to scale the range
* in [0, 1] or [-1, 1].
*
* The general formula is given as:
* \f[
* x' = \frac{x - min}{max - min}
* \f]
* where \f$x\f$ is an original value, \f$x'\f$ is the normalized value.
*/
class CRescaleFeatures : public CDensePreprocessor<float64_t>
{
public:
/** default ctor */
CRescaleFeatures();
/** dtor */
virtual ~CRescaleFeatures();
/**
* initialize preprocessor from features
*
* @param features the features to derive the min and max values from.
*/
virtual bool init(CFeatures* features);
/**
* Cleanup
*/
virtual void cleanup();
/**
* Apply preproc on a feature matrix
*
* @param features input feature matrix
* @return pointer to feature_matrix, i.e. f->get_feature_matrix();
*/
virtual SGMatrix<float64_t> apply_to_feature_matrix(CFeatures* features);
/**
* Apply preproc on a single feature vector
*/
virtual SGVector<float64_t> apply_to_feature_vector(SGVector<float64_t> vector);
/** @return object name */
virtual const char* get_name() const { return "RescaleFeatures"; }
/** return a type of preprocessor */
virtual EPreprocessorType get_type() const { return P_RESCALEFEATURES; }
private:
void register_parameters();
protected:
/** min */
SGVector<float64_t> m_min;
/** 1.0/(max[i]-min[i]) */
SGVector<float64_t> m_range;
/** true when already initialized */
bool m_initialized;
};
}
#endif /* __RESCALEFEATURES_H__ */
|