我正在运行一个程序,使用 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/