How to use pyprind correction with scikit-learn?

I am currently using pyprind , a library that implements a progress bar:

#Compute training time elapsed
pbar = pyprind.ProgBar(45, width=120, bar_char='█')
for _ in range(45):
    #Fiting
    clf = SVC().fit(X_train, y_train)
    pbar.update()
#End of bar

However, I do not know if it is right to use it pbar, as I assume that I install 45 times clf. So, how to use it correctly pbar?

+4
source share
2 answers

I did not use pyprind, but used progressbar. Just install it with -

pip install progressbar

And then -

from progressbar import ProgressBar
pbar = ProgressBar()
for x in pbar(range(45)):
    clf = SVC().fit(X_train, y_train)

and you are good to go.

+2
source

, , vebose:

X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
y = np.array([1, 1, 2, 2])
clf = SVC(verbose =True)
clf.fit(X, y)

:

optimization finished, #iter = 12
obj = -1.253423, rho = 0.000003
nSV = 4, nBSV = 0
Total nSV = 4
+1

Source: https://habr.com/ru/post/1648458/


All Articles