python - 从 Dask DataFrame (tensorflow_decision_forests) 创建 Keras 数据集
问题描述
我正在使用 Dask 加载一个非常大的数据集(比我拥有的可用 RAM 大得多),存储在 SQLite 数据库中,如下所示:
df = dd.read_sql_table("22", "sqlite:///db.sqlite", index_col="id")
然后,我想用tensorflow_decision_forests
一些模型来尝试拟合数据。根据 的文档tensorflow_decision_forests
,以下内容适用于 Pandas DataFrames:
import tensorflow_decision_forests as tfdf
train_ds = tfdf.keras.pd_dataframe_to_tf_dataset(df, label="species")
model = tfdf.keras.RandomForestModel()
model.fit(train_ds)
但是,当我tfdf.keras.pd_dataframe_to_tf_dataset
在 Dask DataFrame 中使用时,很长一段时间都没有发生任何事情,然后 python 突然被一个SIGTERM
信号终止了。我猜这不是将 Dask DataFrame 转换为 Keras 数据集的正确方法,尽管没有引发错误/异常。使用 Keras 存储在 Dask DataFrames 中的数据的正确方法是什么?具体来说,将 Dask DataFrame 转换为 Keras 数据集的正确方法是什么?
解决方案
推荐阅读
- mysql - 数据库设计:X:X to 1:many vs X:X to 0:many
- javascript - 不带符号的 yup 字符串验证
- python - 如何在 export_graphviz 中调整图形大小?
- react-native - 在 React Native 中使用 FusionAuth
- json - jq - 如何格式化键和值对,然后在 json 中迭代键
- perl - Perl越狱
- excel - 如何在表格上搜索已编辑的行以比较值并相应地更改不同列上的时间戳?
- python-3.x - 如何模拟返回对象的函数?
- typescript - TypeOrm、Postgres 和 NestJS:过滤 ManyToMany 列
- terminal - 使用 GREP 在文件服务器中搜索具有电子邮件地址的所有文件