feat: regression
This commit is contained in:
@ -36,3 +36,33 @@ type StepTrainRecord struct {
|
||||
HeartRates []StepHeartRate `gorm:"foreignKey:TrainId;references:TrainId" json:"heartRates"`
|
||||
StrideFreqs []StepStrideFreq `gorm:"foreignKey:TrainId;references:TrainId" json:"strideFreqs"`
|
||||
}
|
||||
|
||||
type RegressionType int
|
||||
|
||||
const (
|
||||
LinearRegression RegressionType = iota + 1
|
||||
LogarithmicRegression
|
||||
QuadraticRegression
|
||||
)
|
||||
|
||||
type RegressionResult struct {
|
||||
gorm.Model
|
||||
RegressionType RegressionType `gorm:"column:regression_type;index" json:"regressionType"` // 训练记录ID
|
||||
TrainId uint `gorm:"column:train_id;index" json:"trainId"` // 训练记录ID
|
||||
Equation string `gorm:"type:text" json:"equation"` // 回归方程
|
||||
|
||||
// 线性回归系数
|
||||
Slope *float64 `gorm:"column:slope" json:"slope"`
|
||||
Intercept *float64 `gorm:"column:intercept" json:"intercept"`
|
||||
|
||||
// 对数回归系数
|
||||
LogA *float64 `gorm:"column:log_a" json:"logA"`
|
||||
LogB *float64 `gorm:"column:log_b" json:"logB"`
|
||||
|
||||
// 二次回归系数
|
||||
QuadraticA *float64 `gorm:"column:quadratic_a" json:"quadraticA"`
|
||||
QuadraticB *float64 `gorm:"column:quadratic_b" json:"quadraticB"`
|
||||
QuadraticC *float64 `gorm:"column:quadratic_c" json:"quadraticC"`
|
||||
|
||||
RSquared *float64 `gorm:"column:r_squared" json:"rSquared"` // R平方值
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user