Skip to content

Regression

Supervised learning > regression

  • mapping of continuous inputs to discrete or continuous outputs
  • concept from statistics: observe data to construct an equation, to be able to make predictions for missing or future data
  • regression can fit different orders of polynomial (constant, line, parabola, etc.) or, for vector inputs multiple dimensions (hyperplanes)
  • input representation must be numeric and continuous => discrete inputs must be enumerated and ordered

Linear Regression

  • linear regression is an attempt to model relationships between a dependent variable y and independent variables (x1,x2,...,xn) => want to find equation of type y=θ0+θ1x1+θ2x2+...+θnxn

    • y is the output variable
    • x1,x2,...,xn are the input variables
    • θ1,θ2,...,θn are parameters or weights of the model
    • the weights which tell how important each corresponding x is to predicting the outcome
  • sample data may not perfectly fit a linear model causing error in the model

    • many ways to calculate error e.g. sum of absolute errors, sum of squared errors
    • let y^ be the predicted output, then:

      sum of absolute errors sum of squared errors
      i=1m|y^iyi| 12i=1m(y^iyi)2
    • use gradient decent algorithm to find the weighs that minimize the error:

      12i=1m(j=0nθjxjiyi)2=0

    • for a constant function the best error is the mean of data points

Polynomial regression

In more general case, for some dataset mapping values xiyi, want to find weight coefficients ci:

c0+c1x1+c2x22+c3x33+...+cnxnny
[1x1x12x131x2x22x231x3x23x331xnxn2xn3]×[c0c1c2cn][y0y1y2yn]

where c=(XTX)1XTY