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

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

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