Home>
code
When I ran the code below, I got the following error: I would like to know the solution.
What I tried
I ran it with google colab and anaconda prompt and both got the same error. (Os is windows.)
Code
from sklearn.model_selection import cross_val_score
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
iris = load_iris()
logreg = LogisticRegression()
scores = cross_val_score(logreg, iris.data, iris.target)
print("Cross-validation scores: {}".format(scores)) input
Error
Cross-validation scores: [0.96666667 1. 0.93333333 0.96666667 1.]
/usr/local/lib/python3.6/dist-packages/sklearn/linear_model/_logistic.py:940: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG)
-
Answer # 1
Related articles
- python max () arg is an empty sequence and an error occurs and it cannot be processed well
- python - i want to solve the problem that i get the error typeerror: xxxxxxxx takes no arguments
- python - how to solve errors when learning with svm
- [python] i don't know how to solve the error
- i don't know how to solve python's formation error
- i want to solve the error "runtime error: event loop is closed" that occurred when i made a bot in python
- python - in raspberry pi, the error occurs only in the case of the automatic start program using systemd
- python - an error occurs when django's summer note is reflected in admin
- python: an error occurs that the type is different in the output using dict key values
- python - an error occurs in the if statement program that compares the size of numbers
- python 3x - an error occurs after registering a dictionary with a read-aloud bot on discordpy
- python - attributeerror:'series' object has no attribute'flags' error
- readcsv error in python
- python - i want to display an image with pysimplegui, but an error occurs
- python - error when scraping with selenium and firefox
- [python] graphviz output format error
- python - web scraping what to do when a webdriverexception occurs on starbucks hp
- python - i get an error when connecting to a voice channel with discordpy
- python 3x - best estimator: i get an error with no syntax, so please tell me what to do
- an error occurs during python scraping (retrieving property information from suumo)
Related questions
- python - "alphazore: introduction to artificial intelligence programming practice" that learns only 96 training data o
- python - runtime warning appears while running pca
- python - about the size of training data of keras-yolo3
- python - cannot read csv file with google colaboratory
- i want to use neologd dictionary in python
- python - i want to arrange the characters so that they are not covered (like a permutation) how can i do this?
- python - i should have a file, but i get a filenotfounderror
- logistic regression analysis in python
- python machine learning
- python - how to solve errors when learning with svm
I had a similar question. Error occurred in machine learning in python
max_iter
Try specifying a value for.