def compute_gradient(y, y_predicted, tx, N=1, regularization=0):
    """Computes gradient of a linear regression model with squared loss function

    Parameters
    ----------
    y : np.ndarray
        Class labels
    y_predicted : np.ndarray
        Labels predicted by model
    tx : np.ndarray
        Data
    N : int
        The size of the dataset
    regularization : int or np.ndarray

    Returns
    -------
    np.ndarray
        Gradient of a mean square loss for linear model
    """
    return -tx.T.dot(y - y_predicted) / N + regularization