[Python] Sklearn LinearRegression() don't require Iterations and Learning rate as parameter

Discussão em 'Python' iniciado por Stack, Fevereiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    As far as I know the cost is minimized using the Gradient Descent algorithm by updating the weights(repeat until convergence), In case of linear regression we have

    m : slope

    c : intercept (constant value)


    import numpy as np
    from sklearn.linear_model import LinearRegression

    x= np.asarray([(i+np.random.randint(1,7)) for i in range(1,31)]).reshape(-1,1)

    y= np.dot([3],x.T) + 5

    reg = LinearRegression()

    reg.fit(x,y)


    I have used the sklearn library but here we're not taking iterations and the learning rate as input at the time of initialization or doing reg.fit().

    Why does not sklearn's linear regression asks for iterations and learning rate? Is it set with some default value or it uses some other method?

    Continue reading...

Compartilhe esta Página