[英]ML.NET using MySQL as Data source
I tried using MySQL for ML.NET.我尝试将 MySQL 用于 ML.NET。 I installed MySQL driver for VisualStudio, and it gets displayed in the normal server explorer data sources but not in the ML.NET Setup?
我为 VisualStudio 安装了 MySQL 驱动程序,它显示在正常的服务器资源管理器数据源中,但没有显示在 ML.NET 设置中?
Is there any way to use MySQL with ML.NET?有没有办法将 MySQL 与 ML.NET 一起使用?
There is no built-in way to use MySQL with ML.NET.没有将 MySQL 与 ML.NET 一起使用的内置方法。 From the ML.NET Model Builder documentation<\/a> :
从
ML.NET 模型生成器文档<\/a>:
<\/blockquote>
Thus, you However, the
DatabaseSource<\/code> class<\/a> appears to be fairly generic, and it should work if you write some custom code:
因此,您 但是,
DatabaseSource<\/code>类<\/a>似乎相当通用,如果您编写一些自定义代码,它应该可以工作:
First, install
MySqlConnector<\/a> with
dotnet add package MySqlConnector<\/code> .
首先,使用
dotnet add package MySqlConnector<\/code>
。<\/a>
Then try the following code:然后尝试以下代码:
var source = new DatabaseSource(MySqlConnectorFactory.Instance, "server=myserver;user=myuser;password=pass", "select `Text`, Label from table"); var ctx = new MLContext(); var loader = ctx.Data.CreateDatabaseLoader( new("Text", DbType.String, 0), new("Label", DbType.Boolean, 1)); var view = loader.Load(source);<\/code><\/pre>"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.