python - 我们可以将 tdqm 进度条与 t-sne 功能一起使用吗?

标签 python tqdm

我正在运行一个程序,使用 t-sne 将 MNIST 数据的维度从 784 维减少到 2 维。

该程序需要很长时间才能完成,我想使用 tqdm 进度条来跟踪进度。

我想知道如何使用 t-sne 功能添加 tqdm 进度条。 tqdm 在循环方面运行良好。

我不知道如何使用它来实现功能。

# TSNE
from sklearn.manifold import TSNE

# Picking the top 1000 points as TSNE takes a lot of time for 15K points
data_1000 = standardized_data[0:30000,:]
labels_1000 = labels[0:30000]

# configuring the parameteres
# the number of components = 2
# default perplexity = 30
# default learning rate = 200
# default Maximum number of iterations for the optimization = 1000
model = TSNE(n_components=2, random_state=0, perplexity=200,n_iter=5000)

# I want to keep track of progress for function 
tsne_data = model.fit_transform(data_1000)

最佳答案

您必须将进度通知tqdm。在您的情况下,TSNE 是一个外部函数,所有迭代都在 TSNE 中完成。除非您去更改 TSNE 代码来通知 tqdm,否则无法在该过程中使用 tqdm

关于python - 我们可以将 tdqm 进度条与 t-sne 功能一起使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55611248/

相关文章:

python - 当电子邮件或密码字段未填写时,不会显示消息 "Login is incorrect"

python - 在运行时更改 python mro

python-3.x - tqdm 以人类可读的单位显示下载

python - Jupyter笔记本不显示进度栏

python - 在不将用户名/密码存储为明文的情况下进行 AD/LDAP 查询

python - 创建包含积极元素的新列表

python - 如何在多处理中结合 TimeoutError 和 tq​​dm 进度条?

pytorch - 如何在 Pytorch Lightning 中禁用进度条

python - SQLite3 - Executemany 未完成 Python3 中大型列表的更新

python - 将 tqdm 与并发.futures 一起使用吗?