Creating a sklearn.linear_model.LogisticRegression instance from existing coefficients
Can one create such an instance based on existing coefficients which were calculated say in a different implementation (e.g. Java)? I tried creating an instance then setting coef_ and intercept_ directly and it seems to work but I'm not sure if there's a down side here or if I might be breaking something. Yes, it works okay: import numpy as np from scipy.stats import norm from sklearn.linear_model import LogisticRegression import json x = np.arange(10)[:, np.newaxis] y = np.array([0,0,0,1,0,0,1,1,1,1]) # training one logistic regression model1 = LogisticRegression(C=10, penalty='l1').fit(x, y)