c# - 系统无效操作异常: The asynchronous operation has not completed

标签 c# machine-learning .net-core ml.net

安装管道导致 Ml.net 出现异常。 Fit 不是可等待的,我很困惑为什么会发生这种情况。任何帮助都是值得赞赏的

var model = pipeline.Fit(dataView);

堆栈跟踪

at System.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, Int32 weightSetCount) at Microsoft.ML.Trainers.StochasticTrainerBase2.TrainModelCore(TrainContext context) at Microsoft.ML.Trainers.TrainerEstimatorBase2.TrainTransformer(IDataView trainSet, IDataView validationSet, IPredictor initPredictor) at Microsoft.ML.Trainers.TrainerEstimatorBase2.Fit(IDataView input) at Microsoft.ML.Data.EstimatorChain1.Fit(IDataView input) at ML.DetectFakeJobPosts.Analyzer.Train() in D:\Sources\code-everything\CodeItHere\ML.DetectFakeJobPosts\Program.cs:line 75 at ML.DetectFakeJobPosts.Program.Main(String[] args) in D:\Sources\code-everything\CodeItHere\ML.DetectFakeJobPosts\Program.cs:line 13

管道

    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"))

        //drop unnecessary columns from view
        .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"))

        //concate features
        .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"))
        //set label/prediction column
        .Append(_context.Transforms.Conversion.ConvertType("Label", "fraudulent", DataKind.Boolean))
        //select a trainer
        .Append(_context.BinaryClassification.Trainers.SdcaLogisticRegression());

click here for dataset

版本

Ml.net : 1.5.1

Core : 3.1

最佳答案

此问题来自 PR I made更新部分代码以使用 Channels 。事实证明,在我们检查导致错误的结果之前,并不总是保证完成异步调用。

目前 daily NuGet feed 中已对此进行了修复。获取最新的每日构建,直到 1.5.2 版本正式发布。

关于c# - 系统无效操作异常: The asynchronous operation has not completed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62976568/

相关文章:

.net-core - 使用 ClickOnce : how do I make it useable as a command-line app? 部署的 .net 核心控制台应用程序

c# - 在没有 UAC/管理员权限的情况下托管 WCF 应用程序

用于在 Clearcase Vob 中搜索文件的 C# 脚本

python - 一一训练scikit svm(在线或随机训练)

machine-learning - 为什么应用数据增强时验证准确率高于训练准确率?

azure - 将 Azure 函数部署到 Azure 时,它​​如何知道应该从应用程序设置而不是 local.setting.json 读取 AzureFunctionSettings

.net - 使用 Entity Framework Core 的分片策略

c# - 如何使用 AspNetCore.Diagnostics.HealthChecks 库提供的 AWS S3 健康检查方法

c# - 把上午改成下午?

python - TensorFlow 占位符错误