Univariate Linear Regression

0

0 votes
Linear Regression, linear regression, univariate, Very-Easy, Machine learning
Problem

A cosmetic company wants to know its customer base. They have a intuition that the money spent by a person on cosmetics yearly is related to his/her annual income. Given N data entries collected from a survey.

Help the cosmetic company build a linear regression model over the parameters. Report α & β values for it.

Input constraints

N2 xi0, yi0

Input format

First line: N

Next N lines have x,y values (x: annual income, y: money spent in cosmetics (in dollars))

x1 y1

x2 y2

....

xN yN

Output format

α β

Sample Input
3
1 2
2 3
3 4
Sample Output
1.000000 1.000000
Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

Solution is supposed to take in N data points and calculate the regression line for it. Output must be intercept followed by space and then slope of the line.

Editor Image

?