如何在 scikit-learn 中使用正确的 pyprind?

tum*_*eed 5 python python-2.7 python-3.x 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
Run Code Online (Sandbox Code Playgroud)

但是,我不知道这是否是使用 的正确方法pbar,因为我想我拟合了 45 次clf。因此,我应该如何正确使用pbar?。

has*_*e55 3

我没用过pyprind,但我用过progressbar。只需使用 - 安装它

pip install progressbar
Run Code Online (Sandbox Code Playgroud)

进而 -

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

现在就可以走了。