Change to time-based estimator functions with exponential parameter smoothing.
This commit is contained in:
+5
-7
@@ -216,7 +216,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
var weights, reps []float64
|
||||
var date []time.Time
|
||||
var dates []time.Time
|
||||
isbw := review.IsBodyweight(ps[0].Exercise, ps[0].Type)
|
||||
|
||||
for _, p := range (ps) {
|
||||
@@ -227,16 +227,14 @@ func main() {
|
||||
if p.RIR[i] == 0 {
|
||||
weights = append(weights, w)
|
||||
reps = append(reps, float64(p.Reps[i]))
|
||||
date = append(date, p.Times[i].UTC())
|
||||
dates = append(dates, p.Times[i].UTC())
|
||||
fmt.Printf("Set: weight %0.0f, reps %0.0f\n", w, float64(p.Reps[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
//a, b := review.FitPowerLaw(weights, reps, date, 14.0)
|
||||
est, err := review.Fit(weights, reps, date,
|
||||
review.WithAllModels(),
|
||||
review.WithHalfLife(14.0),
|
||||
)
|
||||
est := review.NewEstimator(review.WithHalfLife(14.0))
|
||||
err = est.Fit(weights, reps, dates)
|
||||
if err != nil {
|
||||
fmt.Printf("Error estimating performance: %v\n", err)
|
||||
os.Exit(1)
|
||||
@@ -246,7 +244,7 @@ func main() {
|
||||
if isbw {
|
||||
adj = ps[len(ps)-1].Bodyweight
|
||||
}
|
||||
fmt.Printf("%d: %0.0f\n", i, est.EstimateMaxWeight(float64(i)) - adj)
|
||||
fmt.Printf("%d: %0.0f\n", i, est.EstimateMaxWeight(time.Now(), float64(i)) - adj)
|
||||
}
|
||||
case "predict":
|
||||
if flag.NArg() != 3 {
|
||||
|
||||
Reference in New Issue
Block a user