【问题标题】:Can scikit learn be used from IronPython? [duplicate]可以从 IronPython 使用 scikit learn 吗? [复制]
【发布时间】:2015-08-20 22:15:38
【问题描述】:

我有一个用 python 构建的模型。我有一个 C# Web 应用程序,我想在其中按需对记录进行评分。我正在研究可用的选项。 我有哪些选择可以在 .Net 中集成 python 评分代码(我真的不想托管单独的 Web 服务)

PS:我知道重复。 DUPLICATE 问题是2岁。我尝试联系回答问题的人,但我的 cmets 没有得到回复。

【问题讨论】:

    标签: c# python scikit-learn ironpython python.net


    【解决方案1】:

    许多编程语言都允许调用该过程。因此,这可能是您的选择之一。阅读this question 并提供出色的答案(我采用了其代码)以了解更多详细信息:

    private void run_cmd(string cmd, string args)
    {
         ProcessStartInfo start = new ProcessStartInfo();
         start.FileName = "my/full/path/to/python.exe";
         start.Arguments = string.Format("{0} {1}", cmd, args);
         start.UseShellExecute = false;
         start.RedirectStandardOutput = true;
         using(Process process = Process.Start(start))
         {
             using(StreamReader reader = process.StandardOutput)
             {
                 string result = reader.ReadToEnd();
                 Console.Write(result);
             }
         }
    }
    

    【讨论】:

    • 我不会说“我可以在 Y 中使用 X”的正确答案是“是的,当然你可以在 c# 中使用 python 库 X,只需使用子进程!”
    • 感谢您的回复。在应用程序中使用 python 引擎是一种解决方案。但是,我正在寻找更便宜的方法,例如 Ironpython 等。我不确定是否支持 scikit。
    猜你喜欢
    • 2013-04-16
    • 2013-05-19
    • 2013-04-12
    • 2017-05-24
    • 2019-02-26
    • 2020-02-10
    • 2020-07-28
    • 2019-09-12
    • 2014-03-14
    相关资源
    最近更新 更多