Logistic regression using SciPy

前端 未结 3 1511
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 12:54

I am trying to code up logistic regression in Python using the SciPy fmin_bfgs function, but am running into some issues. I wrote functions for the logistic (si

3条回答
  •  渐次进展
    2021-01-02 13:16

    I was facing the same issues. When I experimented with different algorithms implementation in scipy.optimize.minimize , I found that for finding optimal logistic regression parameters for my data set , Newton Conjugate Gradient proved helpful. Call can be made to it like:

    Result = scipy.optimize.minimize(fun = logLikelihoodLogit, 
                                     x0 = np.array([-.1, -.03, -.01, .44, .92, .53,1.8, .71]), 
                                     args = (mX, vY),
                                     method = 'TNC',
                                     jac = likelihoodScore);
    optimLogit = Result.x;
    

提交回复
热议问题