用法:
class cuml.dask.manifold.UMAP(*, model, client=None, **kwargs)
均匀流形逼近和投影
找到近似底层流形的数据的低维嵌入。
改编自 https://github.com/lmcinnes/umap/blob/master/umap/ umap .py
注意:
这个模块很大程度上基于 Leland McInnes 的参考 UMAP 包[1]。
但是,
cuml.umap
中还有许多差异和函数尚未实现:- 使用非欧几里得距离度量(计划在即将发布的版本中支持一组固定的非欧几里得度量)。
- 使用预先计算的成对距离矩阵(未来版本正在考虑)
- 初始嵌入位置的手动初始化
除了这些缺失的函数之外,您还应该看到
cuml.umap
和参考 UMAP 之间的最终嵌入不同。特别是,参考 UMAP 对大数据量使用近似 kNN 算法,而 cuml.umap 始终使用精确 kNN。已知问题:如果 UMAP 模型尚未拟合,则无法 pickle
参考:
例子:
from dask_cuda import LocalCUDACluster from dask.distributed import Client from cuml.dask.datasets import make_blobs from cuml.manifold import UMAP from cuml.dask.manifold import UMAP as MNMG_UMAP import numpy as np cluster = LocalCUDACluster(threads_per_worker=1) client = Client(cluster) X, y = make_blobs(1000, 10, centers=42, cluster_std=0.1, dtype=np.float32, n_parts=2, output='array') local_model = UMAP() selection = np.random.choice(1000, 100) X_train = X[selection].compute() y_train = y[selection].compute() local_model.fit(X_train, y=y_train) distributed_model = MNMG_UMAP(local_model) embedding = distributed_model.transform(X)
注意
每次运行此代码时,输出都会有所不同,因为 “make_blobs” 函数会生成随机矩阵。
相关用法
- Python cuml.dask.feature_extraction.text.TfidfTransformer用法及代码示例
- Python cuml.dask.datasets.classification.make_classification用法及代码示例
- Python cuml.dask.decomposition.PCA用法及代码示例
- Python cuml.dask.naive_bayes.MultinomialNB用法及代码示例
- Python cuml.dask.decomposition.TruncatedSVD用法及代码示例
- Python cuml.dask.preprocessing.LabelBinarizer用法及代码示例
- Python cuml.datasets.make_blobs用法及代码示例
- Python cuml.datasets.make_classification用法及代码示例
- Python cuml.datasets.make_arima用法及代码示例
- Python cuml.datasets.make_regression用法及代码示例
- Python cuml.metrics.pairwise_distances.pairwise_distances用法及代码示例
- Python cuml.neighbors.KNeighborsClassifier用法及代码示例
- Python cuml.ensemble.RandomForestRegressor用法及代码示例
- Python cuml.svm.SVC用法及代码示例
- Python cuml.svm.SVR用法及代码示例
- Python cuml.Lasso用法及代码示例
- Python cuml.tsa.ARIMA.predict用法及代码示例
- Python cuml.multiclass.OneVsRestClassifier用法及代码示例
- Python cuml.preprocessing.LabelBinarizer用法及代码示例
- Python cuml.random_projection.GaussianRandomProjection用法及代码示例
注:本文由纯净天空筛选整理自rapids.ai大神的英文原创作品 cuml.dask.manifold.UMAP。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。