95 lines
2.3 KiB
C
95 lines
2.3 KiB
C
|
|
/**
|
|||
|
|
* @file eqpalg/distribution/frame.h
|
|||
|
|
* @brief 分布类型的数据处理框架
|
|||
|
|
* @author Cat (null.null.null@qq.com)
|
|||
|
|
* @version 0.1
|
|||
|
|
* @date 2021-08-21
|
|||
|
|
*
|
|||
|
|
* Copyright: Baosight Co. Ltd.
|
|||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|||
|
|
*
|
|||
|
|
*/
|
|||
|
|
#pragma once
|
|||
|
|
|
|||
|
|
#include "mix_cc/algorithm/is_in_range.h"
|
|||
|
|
#include "mix_cc/algorithm/split.h"
|
|||
|
|
#include "mix_cc/exception.h"
|
|||
|
|
#include <dlib/statistics.h>
|
|||
|
|
#include <eqpalg/define/dlib.h>
|
|||
|
|
#include <eqpalg/distribution/data_mapping.h>
|
|||
|
|
#include <eqpalg/distribution/dist.h>
|
|||
|
|
#include <log4cplus/LOG.h>
|
|||
|
|
#include <algorithm>
|
|||
|
|
#include <tuple>
|
|||
|
|
#include <vector>
|
|||
|
|
|
|||
|
|
namespace distribution {
|
|||
|
|
|
|||
|
|
class Frame {
|
|||
|
|
public:
|
|||
|
|
static constexpr double legal_diff = 0.3; ///< 默认的合法差值,30%
|
|||
|
|
static constexpr double normal_skewness =
|
|||
|
|
0; ///< 近似正态分布容许的偏度偏离范围
|
|||
|
|
static constexpr double normal_ex_k = 0; ///< 近似正态分布的超值峰度偏离范文
|
|||
|
|
|
|||
|
|
protected:
|
|||
|
|
const std::unique_ptr<LOG> logger_;
|
|||
|
|
const std::string rule_id_;
|
|||
|
|
const size_t dims_;
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
/**
|
|||
|
|
* @brief Construct a new Frame object
|
|||
|
|
* @param ruleId My Param doc
|
|||
|
|
*/
|
|||
|
|
Frame(const std::string& ruleId, size_t dims);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 初始化接受阈
|
|||
|
|
* @param prob My Param doc
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int init_prob(double prob);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 自动探测数据分布类型
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int auto_detect_distribution(Rs rs, const SampleWindow& tmp_data);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 得到合理分布区间
|
|||
|
|
* @return mix_cc::float_range_t
|
|||
|
|
*/
|
|||
|
|
small_vector<mix_cc::float_range_t, 3> get_range();
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 是否是指定类型的分布
|
|||
|
|
* @return true
|
|||
|
|
* @return false
|
|||
|
|
*/
|
|||
|
|
bool is_distribution_valid();
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 是否数据经过变换/映射
|
|||
|
|
* @return true
|
|||
|
|
* @return false
|
|||
|
|
*/
|
|||
|
|
bool is_transformed();
|
|||
|
|
|
|||
|
|
protected:
|
|||
|
|
small_vector<Dist, 3> dist_; ///< 分布情况和合理上下限
|
|||
|
|
|
|||
|
|
protected:
|
|||
|
|
double prob_; ///< 接受区间(0~1)
|
|||
|
|
small_vector<mix_cc::float_range_t, 3> legal_range_; ///< 合法数值的上下限
|
|||
|
|
|
|||
|
|
bool valid = true; ///< 是否有效
|
|||
|
|
|
|||
|
|
protected:
|
|||
|
|
bool
|
|||
|
|
is_transformed_; ///< 数据是否因不满足正态分布而被映射作用区间,暂时不适用
|
|||
|
|
DataMapping data_mapping_; ///< 用于数据映射的类,暂时不使用
|
|||
|
|
};
|
|||
|
|
} // namespace distribution
|