Linear Regression

    0

    0

    Mansimar Anand

    Linear Regression code in Python

    import numpy as np
    from sklearn.linear_model import LinearRegression
    
    x = np.array([]).reshape((-1, 1))
    y = np.array([])
    model = LinearRegression().fit(x, y)
    r_sq = model.score(x, y)
    print('coefficient of determination:', r_sq)
    print('intercept:', model.intercept_)
    print('slope:', model.coef_)
    y_pred = model.predict(x)
    print('predicted response:', y_pred, sep='\n')
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.