简体   繁体   English

使用 TENSORFLOW2 的 Kmeans 聚类

[英]Kmeans clustering using TENSORFLOW2

How could I convert a pandas database that contains 47 columns and 99999 lines into a tensors in Tensorflow 2?如何将包含 47 列和 99999 行的 Pandas 数据库转换为 Tensorflow 2 中的张量? is the Kmeans algorithm already implemented under TF 2? Kmeans 算法是否已经在 TF 2 下实现了? because the command tf.contrib.factorization.KMeans does not work under TF2 since tf.contrib no longer exists on the second API Tensorflow因为命令tf.contrib.factorization.KMeans在 TF2 下不起作用,因为tf.contrib在第二个 API Tensorflow 上不再存在

  1. List item项目清单

I got my TF2 example working with KMeans implementation from here tf.compat.v1.estimator.experimental.KMeans我从这里tf.compat.v1.estimator.experimental.KMeans得到了使用 KMeans 实现的 TF2 示例

Note: As of Nov 7, 2019 the code example has a problem.注意:截至 2019 年 11 月 7 日,代码示例存在问题。 Change tf.estimator.experimental.KMeans to tf.compat.v1.estimator.experimental.KMeans更改tf.estimator.experimental.KMeanstf.compat.v1.estimator.experimental.KMeans


Also for anyone looking for TF 2 contrib, there's a quote on the r1.15 tf.contrib page:对于任何寻找 TF 2 contrib 的人,在 r1.15 tf.contrib页面上有一段引用:

Warning: The tf.contrib module will not be included in TensorFlow 2.0.警告: TensorFlow 2.0 中将不包含 tf.contrib 模块。 Many of its submodules have been integrated into TensorFlow core, or spun-off into other projects like tensorflow_io, or tensorflow_addons.它的许多子模块已集成到 TensorFlow 核心中,或分拆到其他项目中,如 tensorflow_io 或 tensorflow_addons。 For instructions on how to upgrade see the Migration guide.有关如何升级的说明,请参阅迁移指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM