geo-ant / blog

My public notepad in blog form
https://geo-ant.github.io/blog
MIT License
1 stars 0 forks source link

Comments: Global Fitting with Variable Projection #59

Open geo-ant opened 10 months ago

geo-ant commented 10 months ago

Comments for this article go here.

ChristianHeller63 commented 8 months ago

Great crate, thank you! Can one add another observable input? I tried using .invariant_function(), but I think I cannot pass it this additional array, correct?

geo-ant commented 8 months ago

Great crate, thank you! Can one add another observable input? I tried using .invariant_function(), but I think I cannot pass it this additional array, correct?

@ChristianHeller63 Hi and thanks :) since your question is for the Rust implementation, would you mind filing the issue here: https://github.com/geo-ant/varpro ? If you do, could you elaborate on what you mean by "observable input"? Do you mean another data vector to fit or do you mean add another base function? If you want to fit multiple data vectors y1,y2,... with the same model on the same x coordinate, you can just pass a matrix as the observations, where the columns are the vectors y1, y2,...

ChristianHeller63 commented 8 months ago

I figured out how to add my 2nd observable, see below. // .invariant_function(|x| DVector::from_element(x.len(), 1.)) .invariant_function(move |_x| DVector::from_vec(y2.clone()))

geo-ant commented 8 months ago

@ChristianHeller63 hey again. I'm glad to hear you figured your problem but I'm not sure that code does what you think it does. I don't understand what you mean by "second observable". Also please consider posting this question as an issue on the GitHub repo I linked above 🙂

Please check out this function here for fitting multiple data vectors (multiple right hand sides).

ChristianHeller63 commented 7 months ago

Thank you for your quick response! I'm quite out of my depth... My independent variable x is time, so let's call it t. I'm trying to fit a y(t) that depends on another input u(t). Similar to the example on https://docs.rs/varpro/latest/varpro/index.html, I'm using two exponential basis functions. [image: image.png] But in addition to these exponential ('relaxation') terms, I also need a linear ('ohmic') term c3 * u(t), where u(t) follows an out-of-my-control user input. (It gets even more complicated, but this is a good start and a good example to get more comfortable with rust.) Am I making sense?

On Tue, 2 Apr 2024 at 00:10, Geo @.***> wrote:

@ChristianHeller63 https://github.com/ChristianHeller63 hey again. I'm glad to hear you figured your problem but I'm not sure that code does what you think it does. I don't understand what you mean by "second observable". Also please consider posting this question as an issue on the GitHub repo I linked above 🙂

— Reply to this email directly, view it on GitHub https://github.com/geo-ant/blog/issues/59#issuecomment-2031036471, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3KXVNIZ62HFK2XG3Q2Z2TY3IVS5AVCNFSM6AAAAABBSPP5A2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZRGAZTMNBXGE . You are receiving this because you were mentioned.Message ID: @.***>

geo-ant commented 7 months ago

@ChristianHeller63 I'm definitely happy to help you, but I want to stop this discussion here. This is meant as a comment section for my article on global fitting with variable projection. This is independent from my particular implementation in Rust. Please do me a favor: file an issue in my varpro repository. Please give the issue a descriptive title and pose your question there. I'll try to help you. To create an issue: --> Click here <--. We will restart/continue the discussion there.

geo-ant commented 7 months ago

Hey @ChristianHeller63 you haven't yet opened an issue. Do you need help with that?

ChristianHeller63 commented 7 months ago

Thanks for checking. I have to finish some other things first and am less optimistic that my initial plan will work. Many thanks for now...

On Mon, Apr 8, 2024, 1:25 AM Geo @.***> wrote:

Hey @ChristianHeller63 https://github.com/ChristianHeller63 you haven't yet opened an issue. Do you need help with that?

— Reply to this email directly, view it on GitHub https://github.com/geo-ant/blog/issues/59#issuecomment-2041889085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3KXVO2ZB5HXJDF2UVZ6U3Y4IS3HAVCNFSM6AAAAABBSPP5A2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRHA4DSMBYGU . You are receiving this because you were mentioned.Message ID: @.***>

geo-ant commented 7 months ago

Hey @ChristianHeller63, no worries. I don't know the problem you are trying to solve but at leat the simplified approach you described should be absolutely doable with VarPro. If you ever get back to the problem just file an issue and I'll try and assist you.