def linear_regression(x, y):
    """
    Calculates a linear regression model for the set of data points.

    Args:
        x: a 1-d numpy array of length N, representing the x-coordinates of
            the N sample points
        y: a 1-d numpy array of length N, representing the y-coordinates of
            the N sample points

    Returns:
        (m, b): A tuple containing the slope and y-intercept of the regression line,
                both of which are floats.
    """
    
    m = (((x-x.mean())*(y-y.mean())).sum())/((x - x.mean())**2).sum()
    b = y.mean() - m*x.mean()
    return (m,b)