How to extract the studied ML model for a separate implementation?

I am an electronics hobbyist who is trying to use ML to simulate errors in sensors, I trained the sensor data model on my PC using SVM in scikit-learn in python.

But the precedent for the filtered data is very instantaneous, i.e. the sensor data is used to maintain the flight of the ATV, and the raw sensor data should be filtered through the studied model, at least at a speed of 200 Hz, I’m sure that my PC can do this, but I can’t put my computer on the quadcopter, so I need this a model running on a tiny processor / microcontroller, but not one suitable microcontroller of my choice supports python.

So, how can I get / extract the mathematical essence of the studied model, in other words, how can I get this function that has been approximated by training so that I can implement it in any microcontroller of my choice.

Just a beginner trying to learn, any help would be appreciated.

+4
source share
1 answer

Due to limited processing power, it might be a good option to use logistic regression, it’s simple, with low computational cost and easy to reproduce, it’s a simple function like y = w0 + w1.x1 + w2.x2 + ... + wn.xn.

, scikit-learn LogisticRegresion model (http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html):

: coef _: , (1, n_features) (n_classes, n_features)

.

coef_ (1, n_features), .

_: , (1,) (n_classes,)

( a.k.a.) .

fit_intercept False, . intercept_ (1,), .

SVM, , : scikits.learn classifier, C-

+1

Source: https://habr.com/ru/post/1693939/


All Articles