eis/eqpalg/feature_extraction/LSM.h
Huamonarch 224c2c45c4 Remove irrelevant comments from eqpalg source files
Cleaned 66 files across all eqpalg subdirectories:
- Removed commented-out dead code
- Removed redundant Chinese inline comments that restate variable/function names
- Removed trailing ///< annotations on self-explanatory fields
- Removed namespace closing comments
- Preserved all file headers, Doxygen documentation, and logic explanations
- No code changes — only comment removal
2026-05-09 13:30:09 +08:00

67 lines
1.1 KiB
C++

#pragma once
/**
* @file LSM.h
* @brief 相关性/拟合数据处理
* @author your name (you@domain.com)
* @version 0.1
* @date 2024-02-26
*
* Copyright: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#include <array>
#include <vector>
#include "STA.h"
#include "mlpack_header.h"
namespace DAA {
using std::array;
using std::vector;
using namespace mlpack;
using namespace arma;
const size_t max_orders = 5;
using DAA::limit_precision;
/**
* @brief 相关性/拟合 类
*/
class LSM {
public:
LSM(const vector<double>& X, const vector<double>& Y);
~LSM();
bool is_legal();
void reset(const vector<double>& X, const vector<double>& Y);
private:
void polyfit_init();
public:
vector<double> polyfit(int orders);
vector<vector<double>> polyfit();
vector<double> polyval(int orders);
double polyval(double x, int orders);
vector<double> get_r2a();
int get_order_best();
public:
double cor();
private:
bool is_init = false;
arma::vec vX;
arma::vec vY;
arma::vec pn;
arma::vec fY;
int order_now = 0;
double cor_coef = 2;
array<arma::vec, 5> pnn;
array<double, 5> r2a;
int order_best = 1;
};
};