python - 我们可以使用带有 t-sne 功能的 tdqm 进度条吗?
问题描述
我正在运行一个程序,使用 t-sne 将 MNIST 数据的维度从 784-dim 减少到 2-dim。
该程序需要很长时间才能完成,我想使用 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
代码更改为 notify tqdm
,否则无法使用tqdm
此过程。
推荐阅读
- javascript - 有没有办法在浏览器中使用流媒体来打开/关闭视频流?
- java - OneToMany 的问题包括 spring jpa 中的过滤子句
- azure - 在 Azure 应用配置中设置/添加功能标志
- pointers - 指向数组任意元素的 Fortran 指针
- typo3 - prefill search field of indexed search in TYPO3 v9
- r - 如何保留 R 包的源文件,以便在 vim 中创建标签并跳转到定义
- vb.net - My SQL 使用 VB.net 中的列表条件选择查询
- node.js - 当它们在嵌入中时,如何使这些属性不被未定义
- python - 曲线仅拟合数据/直方图的一部分(python,matplotlib)
- html - bootstrap 4 网格 - 带滑块的行