- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi All
I have been using MKL for a bit now, and I would like to improve the speed for a weighted linear fit. The fitting function is a simple
y = a * x + b
The input is a vector e, which contains the values of equally spaced samples of the function. The values start at 0, and have a distance of 1, i.e. x = {0,1,2,3,...,N-1}. This can be changed if it suits the algorithm better. There is another input w, which is the weighting of each sample point.
The calculation I would like to do is the minimization of the following:
minimize WSS = w_i * ( y_i - ( a * x_i + b ))2
One way of doing it would be to create the full vandermonde matrix, and then solve the system using the inverse etc, but is there a better way of doing it?
Also, I am solving it a number of times, where the length of the fit is changing based on the data, so I need to create a new matrix each time.
There are a few threads discussing linear regression, but I can't figure them out exactly.
All help is appreciated.
Best regards
Henrik Andresen
I have been using MKL for a bit now, and I would like to improve the speed for a weighted linear fit. The fitting function is a simple
y = a * x + b
The input is a vector e, which contains the values of equally spaced samples of the function. The values start at 0, and have a distance of 1, i.e. x = {0,1,2,3,...,N-1}. This can be changed if it suits the algorithm better. There is another input w, which is the weighting of each sample point.
The calculation I would like to do is the minimization of the following:
minimize WSS = w_i * ( y_i - ( a * x_i + b ))2
One way of doing it would be to create the full vandermonde matrix, and then solve the system using the inverse etc, but is there a better way of doing it?
Also, I am solving it a number of times, where the length of the fit is changing based on the data, so I need to create a new matrix each time.
There are a few threads discussing linear regression, but I can't figure them out exactly.
All help is appreciated.
Best regards
Henrik Andresen
コピーされたリンク
3 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
The transformation z_i := y_i \sqrt w_i will enable you to use the uniform weight QR based least-squares solver in the MKL to be used.
If you want to avoid the square roots, you can modify an existing source code for uniform weight QR.
If you want to avoid the square roots, you can modify an existing source code for uniform weight QR.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi
Thank you for your answer.
In case I have weight values close to zero, won't this transformation make my fit unstable?
Best regards
Thank you for your answer.
In case I have weight values close to zero, won't this transformation make my fit unstable?
Best regards
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
The stability question is addressed in this paper.
If you attach a weight close to zero to a data pair, it is as if that data pair were not included in the fit, and it would be reasonable if the fitted value did not agree with an observation in which one has little faith.