High error when evaluate mode with importNetworkFromPyTorch

Hi Matlab community,
I've built a simple regression model with pyTorch, and saved it to 'model.pt'. Then, I import it using importNetworkFromPyTorch and initialize with train data.
inputData = X_train';
dlX = dlarray(inputData, 'CB');
net = initialize(net, dlX);
After having the net file, I added it Predict Block in simulink here: Predict
The result for regression is not good compare to result that I validate with python. I don't know if I did anything wrong here.
What happens when we initialize the network? do we need to use train data to set correct weights? Looking forward to hearing from you

답변 (1개)

Sreeram
Sreeram 2024년 12월 9일

0 개 추천

The “initialize” function automatically sets up the network using only the size and format information of the input data ‘dlX’. It does not consider the actual values of the input data, which means it does not set the learnable parameters based on the training data. This is explained in the “Note” section of the following documentation on "initialize":
To ensure that the network is initialized with weights that reflect the training data, the documentation suggests to manually initialize the learnable parameters. Refer to the following documentation for further details:

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품

릴리스

R2024a

질문:

2024년 12월 3일

답변:

2024년 12월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by