eis/eqpalg/algs/exp_sample2D.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

120 lines
2.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
/**
* @file exp_sample2D.h
* @brief 二维样本拟合/线性相关性
* 覆盖算法号12 13
* exp_type_
* 表达式类型: 12-多项式拟合;13-皮尔逊相关系数监控
* task进程 选时间段 获取样本 生成拟合系数/相关性系数
* mon进程 执行监控
* @author your name (you@domain.com)
* @version 0.1
* @date 2023-12-13
*
* Copyright: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#include <eqpalg/algs/exp_base.h>
class ExpSample2D : public ExpBase {
public:
ExpSample2D(const string& name, const mix_cc::json& rule_json,
const string& ruleId, size_t exp_type);
~ExpSample2D() override;
virtual int init() override;
/**
* @brief 最小的执行单元
* @return AlarmInfo
*/
virtual AlarmInfo mon_proc() override;
/**
* @brief 单次执行
* @param time_range My Param doc
* @return std::vector<AlarmInfo>
*/
std::vector<AlarmInfo> exec_task(mix_cc::time_range_t time_range) override;
protected:
/**
* @brief 载入样本X Y表达式
* @return int
*/
int reload_samples();
/**
* @brief 检测拟合是否报警
* @return true 报警
* @return false 不报警
*/
bool check_polyFit();
/**
* @brief 检测相关性系数是否报警
* @return true 报警
* @return false 不报警
*/
bool check_pear();
/**
* @brief 拟合 计算值
* @param x My Param doc
* @param fit_coefs My Param doc
* @param orders My Param doc
* @return double
*/
double PolyFitValue(double x, std::vector<double>& fit_coefs, size_t orders);
/**
* @brief 相关性系数 计算值
* @param X My Param doc
* @param Y My Param doc
* @return double
*/
double PearValue(std::vector<double>& X, std::vector<double>& Y);
/**
* @brief 从数据库载入拟合/相关性系数
* @return int
*/
int reload_param();
/**
* @brief 插入样本信息 表T_SAMPLE_MAG
* @param sample_id My Param doc
* @return int
*/
int insert_mag(std::string sample_id);
/**
* @brief 插入样本数据 表T_SAMPLE_FIT
* @param sample_id My Param doc
* @param X My Param doc
* @param Y My Param doc
* @return int
*/
int insert_fit(std::string sample_id, double X, double Y, int seq);
private:
int orders_;
std::vector<double> fit_coefs_;
double pear_coefs_;
double scale_;
mix_cc::json sample_param_;
const string SampleType_ = "T_SAMPLE_FIT";
int data_len_ = 0;
int min_len_ = 1000;
std::vector<double> SampleX_;
std::vector<double> SampleY_;
std::unique_ptr<DAA::LSM> lsm_ptr_;
private:
/**
* @brief 重置样本
*/
void reset_SampleXY();
protected:
/**
* @brief task执行函数
*/
void task_mon_pro();
};