System.InvalidOperationException : 异步操作尚未完成

在Ml.net中,构建管道时引发了异常。 Fit 方法不是可等待的,我不明白为什么会发生这种情况。任何帮助都将不胜感激

var model = pipeline.Fit(dataView);

堆栈跟踪

atSystem.Threading.Channels.AsyncOperation.ThrowIncompleteOperationException()at System.Threading.Channels.AsyncOperation1.GetResult(Int16 token) at Microsoft.ML.Transforms.RowShufflingTransformer.Cursor.MoveNextCore() at Microsoft.ML.Data.RootCursorBase.MoveNext() at Microsoft.ML.Trainers.TrainingCursorBase.MoveNext() at Microsoft.ML.Trainers.SdcaTrainerBase3.TrainCore(IChannel ch,RoleMappedData data, LinearModelParameters predictor, Int32weightSetCount) atMicrosoft.ML.Trainers.StochasticTrainerBase2.TrainModelCore(TrainContext context) at Microsoft.ML.Trainers.TrainerEstimatorBase2.TrainTransformer(IDataViewtrainSet, IDataView validationSet, IPredictor initPredictor) atMicrosoft.ML.Trainers.TrainerEstimatorBase2.Fit(IDataView input) at Microsoft.ML.Data.EstimatorChain1.Fit(IDataView input) atML.DetectFakeJobPosts.Analyzer.Train() inD:\Sources\code-everything\CodeItHere\ML.DetectFakeJobPosts\Program.cs:line75 at ML.DetectFakeJobPosts.Program.Main(String[] args) inD:\Sources\code-everything\CodeItHere\ML.DetectFakeJobPosts\Program.cs:line13

管道

    var pipeline = _context.Transforms.Categorical.OneHotEncoding("ec_title", "title")        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_location", "location"))        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_department", "department"))        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_salary_range", "salary_range"))        .Append(_context.Transforms.Text.FeaturizeText("ec_company_profile", "company_profile"))        .Append(_context.Transforms.Text.FeaturizeText("ec_description", "description"))        .Append(_context.Transforms.Text.FeaturizeText("ec_requirements", "requirements"))        .Append(_context.Transforms.Text.FeaturizeText("ec_benefits", "benefits"))        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_employment_type", "employment_type"))        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_required_experience", "required_experience"))        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_required_education", "required_education"))        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_industry", "industry"))        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_function", "function"))        //从视图中删除不必要的列        .Append(_context.Transforms.DropColumns("title", "location", "department", "salary_range", "company_profile", "description", "requirements", "benefits", "employment_type", "required_experience", "required_education", "industry", "function", "telecommuting", "has_company_logo", "has_questions"))        //连接特征        .Append(_context.Transforms.Concatenate("Features", "ec_title", "ec_location", "ec_department", "ec_salary_range", "ec_company_profile", "ec_description", "ec_requirements", "ec_benefits", "ec_employment_type", "ec_required_experience", "ec_required_education", "ec_industry", "ec_function"))        //设置标签/预测列        .Append(_context.Transforms.Conversion.ConvertType("Label", "fraudulent", DataKind.Boolean))        //选择一个训练器        .Append(_context.BinaryClassification.Trainers.SdcaLogisticRegression());

点击此处获取数据集

版本

Ml.net : 1.5.1

Core : 3.1


回答:

这个问题源自我提交的一个PR,用于更新代码的一部分以使用Channels。结果发现,在我们检查其结果之前,异步调用并不总是能保证完成,这导致了错误的发生。

目前在每日NuGet源中有一个修复程序,可以获取最新的每日构建,直到1.5.2版本正式发布。

Related Posts

如何对SVC进行超参数调优?

已关闭。此问题需要更加聚焦。目前不接受回答。 想要改进…

如何在初始训练后向模型添加训练数据?

我想在我的scikit-learn模型已经训练完成后再…

使用Google Cloud Function并行运行带有不同用户参数的相同训练作业

我正在寻找一种方法来并行运行带有不同用户参数的相同训练…

加载Keras模型,TypeError: ‘module’ object is not callable

我已经在StackOverflow上搜索并阅读了文档,…

在计算KNN填补方法中特定列中NaN值的”距离平均值”时

当我从头开始实现KNN填补方法来处理缺失数据时,我遇到…

使用巨大的S3 CSV文件或直接从预处理的关系型或NoSQL数据库获取数据的机器学习训练/测试工作

已关闭。此问题需要更多细节或更清晰的说明。目前不接受回…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注