如何提取学习的ML模型以实现独特的实现?

我是一名电子爱好者,他试图使用ML来模拟传感器中的错误,我已经在我的PC中使用SVM在
python中使用scMit-learn训练模型传感器数据.

但过滤数据的使用情况非常即时,即传感器数据用于维持四轴飞行器的飞行,原始传感器数据应至少以200 Hz的速率通过学习模型进行过滤,确保我的电脑可以做到它,但我不能将我的电脑放在四轴飞行器上,因此我需要在微型CPU /微控制器上运行该模型,但是,我选择的合适的微控制器不支持python.

那么如何获取/提取学习模型的数学本质,换句话说,我如何获得通过训练近似的函数,以便我可以在我选择的任何微控制器中实现它.

只是一个初学者试图学习,任何帮助将不胜感激.

最佳答案 由于计算能力有限,也许一个很好的选择是使用Logistic回归,它很简单,计算成本低且易于重现,它是一个简单的函数,如y = w0 w1.x1 w2.x2 … wn.xn .

要提取函数,您可以使用scikit-learn LogisticRegresion模型(http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html)中的以下属性:

Attributes: coef_ : array, shape (1, n_features) or (n_classes,
n_features)

Coefficient of the features in the decision function.

coef_ is of shape (1, n_features) when the given problem is binary.

intercept_ : array, shape (1,) or (n_classes,)

Intercept (a.k.a. bias) added to the decision function.

If fit_intercept is set to False, the intercept is set to zero.
intercept_ is of shape(1,) when the problem is binary.

如果您仍想使用SVM,我认为这个类似的问题可能对您有用:How to extract info from scikits.learn classifier to then use in C code

点赞