Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Request: Simple polynomial fitting and get the coefficients #639

Closed
hoangdungt2 opened this issue Sep 5, 2019 · 5 comments
Closed

Comments

@hoangdungt2
Copy link

hi, I'm looking for a simple example to polynomial fit data (uni-variate or multi-variate) and I want to print out the parameters to implement the prediction in embedded system. Thanks.

@CESARDELATORRE
Copy link
Contributor

Do you mean an example of a Polynomial regression?

Also, what kind of embedded system are you targeting?
Note that ML.NET doesn't support ARM-based devices.

This is ML.NET support on processors and Operating Systems and .NET frameworks:
https://github.com/dotnet/machinelearning#operating-systems-and-processor-architectures-supported-by-mlnet

Can you elaborate a bit further on your specific scenario/problem for a polynomial regression?

@hoangdungt2
Copy link
Author

hoangdungt2 commented Sep 11, 2019

hi CESARDELATORRE,
Thanks for your reply. For my problem, I want to fit z from x and y such that

z = a1 * x^2 + a2 * x * y + a3 * y^2 + a4 * x + a5 * y + a6

I have collected bunch of data of z, x, y. I want to use ML.NET to figure the a1,a2,a3,a4,a5,a6 parameters.
From these parameters, in my embedded system when receiving x,y I can do prediction of z using C (programming language) and the above equation.
Thanks

@CESARDELATORRE
Copy link
Contributor

Hi @hoangdungt2 - Afaik, we currently don't have a direct algorithm/transform for this.

We have a RFF transform, which makes projections into a potentially useful space, but won't match theses features. If you are interested on 'Random Fourier Features Transform​ (command-line xf=RFF)' I can provide further info. But I think it is a different space.

However, you could probably create the feature interactions (x, x^2, x*y, y^2, y) in a custom ML.NET transform that you can create. Then you can fit a linear model to those features.

Here's info on how to create a custom transform in ML.NET:

Sample code:
https://github.com/endintiers/Unearth.Demo.MLCustomTransform

Video:
https://www.youtube.com/watch?v=TEnQp5qtopo

Btw, if you create such a custom transform it'd be great to have it as a sample for the community so we could point to it from the community samples page here:
https://github.com/dotnet/machinelearning-samples/blob/master/docs/COMMUNITY-SAMPLES.md

Hope it helps,

@hoangdungt2
Copy link
Author

Thanks Cesar,
I have created a function for getting polynomial features (link). I think I'll learn more about ML.Net custom transform, thanks for the info. Currently watching your talk at the dotNet Conf.
Thanks

@CESARDELATORRE
Copy link
Contributor

Nice! - Btw, as mentioned, if you create a custom Transform Estimator and publish it as a sample in your GitHub repo, ping me so I point to it from our community samples, ok? - I'd be a great example! 👍

https://github.com/dotnet/machinelearning-samples/blob/master/docs/COMMUNITY-SAMPLES.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants