How to import a pre trained linear regression model from python to matlab?

조회 수: 51 (최근 30일)
If I trained a model using python. Is there any way to import or use that model in matlab? Finally I want to genarate a c code after adding something to that in matlab.
  댓글 수: 3
chaitanya kalipatnapu
chaitanya kalipatnapu 2020년 5월 5일
First of all Thank you so much for quick responce.
I have a model in ".SAV" formate right now. I want to import that into matlab and genarate C code for that.
Please let me know if there is any way to do that.
Could you please tell me do you mean MATLAB Coder Toolbox?
If you have any referance links or documents regarding this process please suggest me. Those will help me a lot.
could you please let me know what are all formates of ML models that are developed and trained using python,
Can be accepted by matlab to import ?
chaitanya kalipatnapu
chaitanya kalipatnapu 2020년 5월 5일
I have a doubt here.
if we are converting matlab code from .m to .c, If we have any function which is calling a python method from a .py file then, Is our tool box going to convert the packages that are being called by the python function in .py file?
please let me know if the question is not clear.
I will try to reconstruct or try to send a picture on my question.

댓글을 달려면 로그인하십시오.

답변 (1개)

David Fink
David Fink 2020년 5월 5일
To import from Python to MATLAB, save the model in a format MATLAB can import:
or a simpler format, like text or csv.
To generate C code from the imported model, use MATLAB Coder or GPU Coder:
  댓글 수: 5
David Willingham
David Willingham 2021년 5월 5일
Hi Shayne,
Here is an example that shows how to call GoogLeNet into Simulink using the MATLAB function block:
Also, there are the following blocks that support calling popular model types directly:
shayne sudhakar
shayne sudhakar 2021년 5월 14일
편집: shayne sudhakar 2021년 5월 14일
Hi David,
Thanks for your advise.
I tried this, but I was able to directly get a .h5 file of model weights from keras.
So importkeraslayers(model file) worked well.
But unfortunately the gensim(net) function does not operate on the 'net' file generated from the importkeraslayers function. It shows an error of incorrect argument datatype or missing argument in call to function 'gensim'
Can you provide me with some insight on this. Thanks a ton.
Shayne

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by