Loss vs iteration function for sklearns LogisticRegression() function

Hello all -
In course 1 week 3, Lab 7 “Logistic regression using Scikit-Learn”, the sklearn logistic regression function is used.

I looked online and tried to find a way to get the cost for each iteration from that function in order plot a cost versus iteration plot (or versus epoch plot). Unfortunately I couldn’t seem to find a solution in the documentation (some method or attribute didn’t seem to exist). I did find this possible solution, but it wasn’t very promising. I know there is a way (maybe from class 2 in this series) that allows for making this plot when using neural networks, something like this:

# model = your neural network here
fitted = model.fit(X_train_n,y_train)
cost_vs_epoch_data = fitted.history['loss']

And I know we can make them (like we did in this class) on our own when creating the logistic regression functionality “by-hand” (without the use of the sklearn function), but I was hoping there is just something I’m missing about getting it out of the LogisticRegression() function.

Any thoughts? Thanks!

by using cost function formula of logistic regression .

Hello @naveadjensen, some time no see, how are you?

Regarding your question, my research doesn’t give me more than what you have said. Frankly I have not even tried the approach in that stackoverflow post. When is it not promising?

Cheers,
Raymond

@rmwkwok - no problem. In this case I will just not plot out a cost vs iteration curve.