简体   繁体   English

System.InvalidOperationException: '由于缺少功能而跳过所有实例。' 错误来自数据集还是代码?

[英]System.InvalidOperationException: 'All instances skipped due to missing features.' Is the error coming from the dataset or the code?

I'm trying to learn ML.Net and C# for a school problem, tried to find similar questions but none of them solved my problem.我正在尝试为学校问题学习 ML.Net 和 C#,试图找到类似的问题,但没有一个解决了我的问题。

How can I fix this problem?我该如何解决这个问题?

Is the error coming from the dataset or the code?错误来自数据集还是代码?

class ML_BankModel
    {
        static readonly string _dataPath = Path.Combine(Environment.CurrentDirectory, "BankDataSet", "Churn_Modelling.csv");
        static readonly string _modelPath = Path.Combine(Environment.CurrentDirectory, "BankDataSet", "Churn_Modelling.csv");
        static void Main(string[] args)
        {
            var mlContext = new MLContext();

            var trainData = mlContext.Data.LoadFromTextFile<AccountBankModel>(path: _dataPath,
                separatorChar: ',',
                hasHeader: true
                );

            var estimator = mlContext.Transforms.Conversion.ConvertType(outputColumnName: "Label", inputColumnName: "Target", DataKind.Boolean)
                .Append(mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "GeographyEncoded", inputColumnName: "Geography"))
                .Append(mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "GenderEncoded", inputColumnName: "Gender"))
                .Append(mlContext.BinaryClassification.Trainers.FastTree())
                .Append(mlContext.Transforms.Conversion.ConvertType(outputColumnName: "PredictedLabel", inputColumnName: "Label", DataKind.Boolean));

            var dataPreview = trainData.Preview();

            var transformationPreview = estimator.Preview(trainData);
        }

class AccountBankModel
    {
        [LoadColumn(2)]
        public int CustomerId { get; set; }

        [LoadColumn(4)]
        public float CreditScore { get; set; }

        [LoadColumn(5)]
        public string Geography { get; set; }
        
        [LoadColumn(6)]
        public string Gender { get; set; }

        [LoadColumn(7, 12), ColumnName("Features")]
        public float FeatureVector { get; set; }

        [LoadColumn(13)]
        public float Target { get; set; }
    }

错误

数据集样本

The problem was the dataset, after making an alteration and saving it everything is running fine.问题是数据集,在进行更改并保存后一切正常。 The alteration was change the 'Exited' to something else and reverting it again to 'Exited'.更改是将“退出”更改为其他内容,然后再次将其恢复为“退出”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Automapper 错误:System.InvalidOperationException:'缺少从 System.String 到 System.Char 的 map - Automapper error: System.InvalidOperationException: 'Missing map from System.String to System.Char System.InvalidOperationException:缺少参数 - System.InvalidOperationException: Missing parameter System.InvalidOperationException:尝试从vbscript使用Web服务时缺少参数错误 - System.InvalidOperationException: Missing parameter error when trying to consume web service from vbscript 代码抛出System.InvalidOperationException - Code throws System.InvalidOperationException DropDownList 错误,System.InvalidOperationException - DropDownList Error, System.InvalidOperationException System.InvalidOperationException 错误原因? - System.InvalidOperationException error reason? 得到了System.InvalidOperationException:方法失败,出现意外错误代码64 - Got System.InvalidOperationException: Method failed with unexpected error code 64 MSAL System.InvalidOperationException:CompactToken 解析失败,错误代码:80049217 - MSAL System.InvalidOperationException: CompactToken parsing failed with error code: 80049217 System.InvalidOperationException:&#39;代码应该无法访问&#39; - System.InvalidOperationException: 'Code supposed to be unreachable' 出现“ WebDriver.dll中发生了&#39;System.InvalidOperationException类型的未处理的异常”错误 - “An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll” error coming up
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM