stepwiselm gives different results before and after compilation
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a algorithm / function that i compile into DLL and this DLL is being used by a .Net application as part of a larger project. In this function i call stepwiselm but i am noticing that stepwiselm gives different results when used in matlab vs when compiled as DLL. Moreover this issue does not occur all the time there are some unique sets of input values for which the stepwiselm behaves differently in matlab vs when compiled into DLL. Furthermore this issue occurrs because in the Stepwiselm function i am changing the criteria to 'rquared',
function [RegCoeff] = DevelopIndividualModel(Input,Output)
Mdl = stepwiselm(Input,Output,'purequadratic','Lower','linear','Criterion','rsquared','PEnter',0.075,'NSteps',100);
RegCoeff = Mdl.Coefficients.Estimate;
end
Try the following values for Input and Output and you will get the same different results between the Matlab function vs Compiled DLL
Input =
[ 0 250 350 45 50 375 ;
75 250 35 45 50 0 ;
0 25 35 45 350 0 ;
0 25 35 250 50 375 ;
0 250 192 250 200 0 ;
150 25 192 45 200 375 ;
75 25 350 250 350 375 ;
150 250 35 250 350 375 ;
150 250 350 45 350 0 ;
150 175 300 200 50 300 ;
125 45 55 75 50 0 ;
150 25 350 250 50 0 ]
Output =
[ 7
6
6
6
6
6
6
6
9
7
7
7 ]
Output from Matlab is
RegCoeff = [4.00154247482028, -0.0260252941267720, -0.00474767764661860, 0.00600331079598716, 0.0722078331936164, -0.00201852184261087, -0.0481874258942977, 8.86991940184067e-05, 0.000111244518017688, -0.000251859069586818, 0.000125452183337175, 0]
Output from DLL is
RegCoeff = [-10.769528534936198,-0.016155202821869604,-0.0084656084656085009,-0.26735445700959604,0.31703485946921428,0.32610476359569857,-0.0011428571428571382,0.00013827160493827187,0.00071347085357696628,-0.0010817811925549459,-0.00082379365502099238,0.0,0.0,0.0]
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre C Shared Library Integration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!