簡體   English   中英

如何在scikit-learn中使用correclty pyprind?

[英]How to use correclty pyprind with scikit-learn?

目前,我正在使用pyprind ,這是一個實現進度條的庫:

#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

但是,我不知道那是使用pbar的正確方法,因為我猜我適合45倍clf 因此,我應該如何正確使用pbar ?。

我沒有使用pyprind但是我已經使用了progressbar 只需使用-

pip install progressbar

然后 -

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

而且你很好。

請注意,如果您想了解有關學習過程的更多信息,可以使用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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM