def loss_funtion(X, y):
    total_loss = 0
    n_samples = len(X)
    for i in range(n_samples):
        xi = X[i]
        yi = y[i]
        yi_hat = model(xi)
        total_loss += (abs((yi_hat - yi)) ** 2)
    avg_loss = ((1 / n_samples) * total_loss)
    return avg_loss
def loss_funtion(X, y):
    total_loss = 0
    n_samples = len(X)
    for i in range(n_samples):
        xi = X[i]
        yi = y[i]
        yi_hat = model(xi)
        total_loss += (abs((yi_hat - yi)) ** 2)
    avg_loss = ((1 / n_samples) * total_loss)
    return avg_loss