Multiple regression: Difference between revisions
Content deleted Content added
imported>Stevegt boldface the part about two-dimensional matrix input (most examples do not comply), add example use case and references |
imported>Stevegt flag C, Go, and Python as incorrect -- most others are also wrong and apparently cargo-culted from each other, but we have to start somewhere |
||
Line 621: | Line 621: | ||
=={{header|C}}== |
=={{header|C}}== |
||
{{incorrect|C|X input must be a two-dimensional array. Most examples on this page are wrong -- see task description and Talk.}} |
|||
Using GNU gsl and c99, with the WP data<syntaxhighlight lang="c">#include <stdio.h> |
Using GNU gsl and c99, with the WP data<syntaxhighlight lang="c">#include <stdio.h> |
||
#include <gsl/gsl_matrix.h> |
#include <gsl/gsl_matrix.h> |
||
Line 1,492: | Line 1,495: | ||
=={{header|Go}}== |
=={{header|Go}}== |
||
{{incorrect|Go|X input must be a two-dimensional array. Most examples on this page are wrong -- see task description and Talk.}} |
|||
The [http://en.wikipedia.org/wiki/Ordinary_least_squares#Example_with_real_data example] on WP happens to be a polynomial regression example, and so code from the [[Polynomial regression]] task can be reused here. The only difference here is that givens x and y are computed in a separate function as a task prerequisite. |
The [http://en.wikipedia.org/wiki/Ordinary_least_squares#Example_with_real_data example] on WP happens to be a polynomial regression example, and so code from the [[Polynomial regression]] task can be reused here. The only difference here is that givens x and y are computed in a separate function as a task prerequisite. |
||
===Library gonum/matrix=== |
===Library gonum/matrix=== |
||
Line 2,418: | Line 2,424: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
{{libheader|NumPy}} |
{{libheader|NumPy}} |
||
{{incorrect|Python|X input must be a two-dimensional array. Most examples on this page are wrong -- see task description and Talk.}} |
|||
'''Method with matrix operations''' |
'''Method with matrix operations''' |
||
<syntaxhighlight lang="python">import numpy as np |
<syntaxhighlight lang="python">import numpy as np |