linear_regression
Computes the slope and intercept of a linear regression line from a set of (x, y) points.
Instructions
Performs linear regression on a set of points and returns the slope and intercept.
Args: data: A list of tuples, where each tuple contains (x, y) coordinates.
Returns: On success: {"slope": , "intercept": } On error: {"error": }
Examples: >>> linear_regression([(1, 2), (2, 3), (3, 5)]) {'slope': 1.5, 'intercept': 0.3333333333333335}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes |