def linear_reg(df, Y, binary=False, ridge=False, sigmoid=False):
    means = []
    columns = [col for col in df.columns if (col != "is_spam" and col != "MEDV" and col != "y")]
    if ridge:
        w = mystats.get_linridge_w(df[columns], df[Y], binary)
    else:
        for col in df.columns:
            mean = df[col].mean()
            means.append(mean)
            df[col] -= mean

        w = mystats.get_linreg_w(df[columns], df[Y])

    print ("w:")
    print (w)
    predict = mystats.predict(df[columns], w, binary, means=means)
    error = mystats.get_error(predict, df[Y], binary)
    return error