Open opatiny opened 1 year ago
In the lm_matx
function, the t
argument can be a matrix, but not the y_dat
!! So basically we can have multi-dimensional input, but not output (it is the trilateration example, which works indeed).
https://github.com/mljs/curve-fitting/blob/3e4b93a6af30a00d5d1fe8515cc229f5369dcff4/src/LM.js#L492
https://github.com/mljs/curve-fitting/blob/3e4b93a6af30a00d5d1fe8515cc229f5369dcff4/src/LM.js#L498
The doc of lm-matx
is not coherent with the doc of LM
though -> I don't know if the algo is supposed to work from N dimensions to N dimensions.
I compared with levenberg-marquardt
and there is the same issue there: data and estimated data are subtracted and yield to an error value that can be positive or negative -> how to extend that to many dimensions??
Interesting ressources for error generalization:
The main issue is with the error computation (I think), which has to be generalized to N dimensions. It is this line that makes no sense if the data has N dimensions:
https://github.com/mljs/curve-fitting/blob/3e4b93a6af30a00d5d1fe8515cc229f5369dcff4/src/LM.js#L530
After some thought, I think that the error is generalizable in many dimensions, for each dimension, you'll have a positive or negative error. The problem would therefore be further. I now get an error "Lu matrix is singular" here https://github.com/mljs/curve-fitting/blob/3e4b93a6af30a00d5d1fe8515cc229f5369dcff4/src/LM.js#L201-L205
The main issue is with the error computation (I think), which has to be generalized to N dimensions. It is this line that makes no sense if the data has N dimensions: https://github.com/mljs/curve-fitting/blob/3e4b93a6af30a00d5d1fe8515cc229f5369dcff4/src/LM.js#L530