[apps/reg] Display the regression layouts is RegressionController

This commit is contained in:
Léa Saviot
2018-06-06 15:09:36 +02:00
committed by Émilie Feral
parent 6ca4ecb635
commit e4fc5e8a64
21 changed files with 247 additions and 23 deletions

View File

@@ -1,9 +1,36 @@
#include "logistic_model.h"
#include <math.h>
#include <assert.h>
#include "../../poincare/include/poincare_layouts.h"
using namespace Poincare;
namespace Regression {
ExpressionLayout * LogisticModel::Layout() {
static ExpressionLayout * layout = nullptr;
if (layout == nullptr) {
const ExpressionLayout * layoutChildren[] = {
new CharLayout('a', KDText::FontSize::Small),
new CharLayout('+', KDText::FontSize::Small),
new CharLayout('e', KDText::FontSize::Small),
new VerticalOffsetLayout(
new HorizontalLayout(
new CharLayout('-', KDText::FontSize::Small),
new CharLayout('b', KDText::FontSize::Small),
new CharLayout('X', KDText::FontSize::Small),
false),
VerticalOffsetLayout::Type::Superscript,
false)
};
layout = new FractionLayout(
new CharLayout('c', KDText::FontSize::Small),
new HorizontalLayout(layoutChildren, 4, false),
false);
}
return layout;
}
double LogisticModel::evaluate(double * modelCoefficients, double x) const {
double a = modelCoefficients[0];
double b = modelCoefficients[1];