返回
ML.NET报错“RegressionCatalog.RegressionTrainers未包含“FastTree”的定义
2023-03-21 3001 0
使用回归与ML.NET配合做一些机器学习预测时碰到了一个问题,根据官网的教程编写代码时遇到了报错:
错误 CS1061 “RegressionCatalog.RegressionTrainers”未包含“FastTree”的定义,并且找不到可接受第一个“RegressionCatalog.RegressionTrainers”类型参数的可访问扩展方法“FastTree”(是否缺少 using 指令或程序集引用?)

查看了微软GitHub上的示例代码也是这样的:
var pipeline = mlContext.Transforms.CopyColumns(outputColumnName: "Label", inputColumnName: "FareAmount")
.Append(mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "VendorIdEncoded", inputColumnName: "VendorId"))
.Append(mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "RateCodeEncoded", inputColumnName: "RateCode"))
.Append(mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "PaymentTypeEncoded", inputColumnName: "PaymentType"))
.Append(mlContext.Transforms.Concatenate("Features", "VendorIdEncoded", "RateCodeEncoded", "PassengerCount", "TripDistance", "PaymentTypeEncoded"))
.Append(mlContext.Regression.Trainers.FastTree());
这个报错的解决办法是通过Nuget安装Microsoft.ML.FastTree包,安装后就正常了。FastTree方法的作用是创建 FastTreeRegressionTrainer,它使用决策树回归模型预测目标。
网友点评
提交
相关阅读
.NET Core 使用ML.NET 机器学习分析预测股票走势
C#使用ML.NET进行两张图片相似度的分析示例
GitHub爆款开源 AI 股票量化交易工具推荐
.NET C#中的 async/await 原理
WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake
如何防止朱雀大模型检测出文章由AI生成?
程序员的编程等宽字体Maple Mono下载地址
ASP.NET Core使用EF Core连接MySQL数据库完整指南(2026最新版)