简体   繁体   English

自定义MLModel文件

[英]Custom MLModel File

I am new with machine learning and want to do following implementation 我是机器学习的新手,想做下面的实现

  • Want to create a custom .mlmodel with input of "xls or csv or nsdata of this files" and output should be double or array. 想要使用输入“此文件的xls或csv或nsdata”创建自定义.mlmodel,输出应为double或array。
  • Pythone file should be able to read input data because i am going to use train_data from this input. Pythone文件应该能够读取输入数据,因为我将从此输入中使用train_data。
  • Pythone will do some calculation on this input data and provide prediction on this (i will do this calculation using sklearn,LinearRegression) Pythone将对此输入数据进行一些计算并对此进行预测(我将使用sklearn,LinearRegression进行此计算)

Can any one please help me how i can do this ? 有人可以帮我怎么做吗?

You can use python to train your model with SKLearn as you suggested. 您可以按照建议使用python使用SKLearn训练模型。 This is a good post on getting started with that (make sure you use Sklearn and not Statsmodels). 这是一篇很好的入门文章(请确保您使用的是Sklearn而不是Statsmodels)。

https://towardsdatascience.com/simple-and-multiple-linear-regression-in-python-c928425168f9 https://towardsdatascience.com/simple-and-multiple-linear-regression-in-python-c928425168f9

When you have trained your model, you can convert it using Apple's coremltools: 训练模型后,可以使用Apple的coremltools对其进行转换:

https://github.com/apple/coremltools https://github.com/apple/coremltools

When you've converted it you can add your .mlmodel file to your xcode project. 转换后,可以将.mlmodel文件添加到xcode项目中。 You'll then need to write some code to get all of the your model inputs collected from your app and pass them as inputs to the model. 然后,您需要编写一些代码来获取从应用程序收集的所有模型输入,并将它们作为输入传递给模型。

Good luck! 祝好运!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM