首页 > 解决方案 > 使用 ML.NET 开始训练后“无法将提供的文件拆分为多个一致的列”

问题描述

我正在使用 ML.NET 进行机器学习。

最初,我使用 CSV 文件并收到此错误。但是,当我连接到使用相同数据设置的数据库表时,我遇到了同样的问题。数据是不同长度和内容的文本,我想基于此生成新文本。

我的文本只有一列,所以我不明白这是在做什么,也不明白为什么它不起作用。任何指针将不胜感激。

Inferring Columns ...
An Error occured during inferring columns
Unable to split the file provided into multiple, consistent columns.
Microsoft.ML.AutoML.InferenceException: Unable to split the file provided into multiple, consistent columns.
   at Microsoft.ML.AutoML.ColumnInferenceApi.InferSplit(MLContext context, TextFileSample sample, Nullable`1 separatorChar, Nullable`1 allowQuotedStrings, Nullable`1 supportSparse)
   at Microsoft.ML.AutoML.ColumnInferenceApi.InferColumns(MLContext context, String path, ColumnInformation columnInfo, Nullable`1 separatorChar, Nullable`1 allowQuotedStrings, Nullable`1 supportSparse, Boolean trimWhitespace, Boolean groupColumns)
   at Microsoft.ML.CLI.CodeGenerator.AutoMLEngine.InferColumns(MLContext context, ColumnInformation columnInformation)
   at Microsoft.ML.CLI.Program.<>c__DisplayClass1_0.<Main>b__0(NewCommandSettings options)
   at Microsoft.ML.CLI.CodeGenerator.CodeGenerationHelper.GenerateCode()
Please see the log file for more info.
Exiting ...

标签: ml.net

解决方案


当这个错误发生在我身上时,我找不到太多关于它的信息。我所做的是将我的 sql 数据库导出到 csv 并查看数据。有一些字符串描述中有换行符和 html。我用一些 c# 清理了字符串,文件加载并运行良好。

如果我是你,我会检查 csv 中的数据并查找格式错误,然后修复这些错误并重试。


推荐阅读