mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[Regression] Fixed affine and linear name errors
This commit is contained in:
@@ -11,7 +11,7 @@ BannerView::BannerView(
|
||||
) :
|
||||
Shared::XYBannerView(parentResponder, inputEventHandlerDelegate, textFieldDelegate),
|
||||
m_derivativeView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()),
|
||||
m_tangentEquationView(Font(), I18n::Message::LinearRegressionFormula, 0.0f, 0.5f, TextColor(), BackgroundColor()),
|
||||
m_tangentEquationView(Font(), I18n::Message::AffineRegressionFormula, 0.0f, 0.5f, TextColor(), BackgroundColor()),
|
||||
m_aView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()),
|
||||
m_bView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()),
|
||||
m_numberOfSubviews(Shared::XYBannerView::k_numberOfSubviews)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AffineRegressionFormula = " y=a·x "
|
||||
LinearRegressionFormula = " y=a·x "
|
||||
QuadraticRegressionFormula = " y=a·x^2+b·x+c "
|
||||
CubicRegressionFormula = " y=a·x^3+b·x^2+c·x+d "
|
||||
QuarticRegressionFormula = " y=a·x^4+b·x^3+c·x^2+d·x+e "
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "linear_model.h"
|
||||
#include "affine_model.h"
|
||||
#include "../store.h"
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef REGRESSION_LINEAR_MODEL_H
|
||||
#define REGRESSION_LINEAR_MODEL_H
|
||||
#ifndef REGRESSION_AFFINE_MODEL_H
|
||||
#define REGRESSION_AFFINE_MODEL_H
|
||||
|
||||
#include "model.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "affine_model.h"
|
||||
#include "linear_model.h"
|
||||
#include "../store.h"
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <math.h>
|
||||
@@ -23,16 +23,14 @@ double LinearModel::evaluate(double * modelCoefficients, double x) const {
|
||||
|
||||
double LinearModel::levelSet(double * modelCoefficients, double xMin, double step, double xMax, double y, Poincare::Context * context) {
|
||||
double a = modelCoefficients[0];
|
||||
double b = modelCoefficients[1];
|
||||
if (a == 0) {
|
||||
if (a == 0.0) {
|
||||
return NAN;
|
||||
}
|
||||
return y-b;
|
||||
return y/a;
|
||||
}
|
||||
|
||||
void LinearModel::fit(Store * store, int series, double * modelCoefficients, Poincare::Context * context) {
|
||||
modelCoefficients[0] = store->slope(series);
|
||||
modelCoefficients[1] = store->yIntercept(series);
|
||||
}
|
||||
|
||||
double LinearModel::partialDerivate(double * modelCoefficients, int derivateCoefficientIndex, double x) const {
|
||||
@@ -40,10 +38,6 @@ double LinearModel::partialDerivate(double * modelCoefficients, int derivateCoef
|
||||
// Derivate: x
|
||||
return x;
|
||||
}
|
||||
if (derivateCoefficientIndex == 1) {
|
||||
// Derivate: 1;
|
||||
return 1;
|
||||
}
|
||||
assert(false);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef REGRESSION_AFFINE_MODEL_H
|
||||
#define REGRESSION_AFFINE_MODEL_H
|
||||
#ifndef REGRESSION_LINEAR_MODEL_H
|
||||
#define REGRESSION_LINEAR_MODEL_H
|
||||
|
||||
#include "model.h"
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ InvSortCommandWithArg = "sort>(L)"
|
||||
K = "k"
|
||||
Lambda = "λ"
|
||||
LcmCommandWithArg = "lcm(p,q)"
|
||||
LinearRegressionFormula = " y=a·x+b "
|
||||
AffineRegressionFormula = " y=a·x+b "
|
||||
LogCommandWithArg = "log(x,a)"
|
||||
MatrixCommand = "[[\x11]]"
|
||||
MatrixCommandWithArg = "[[1,2][3,4]]"
|
||||
|
||||
Reference in New Issue
Block a user