-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector valued y #171
Comments
Do you just want to flatten the vector before the norm-call , or? |
I do not follow your suggestion to be honest. |
I'm just not sure I understand your problem here. |
Basically I would like to know whether there is a more elegant way to use the curve_fit for vector functions, as the readme sounds like this could work native. Thank you for trying to help! |
Is this the same as here ? #156 |
It is probably related, but I think it would go a bit further because as a simple check I also tried to fit the fector function but overloaded Base.isinf(x::Array{Array{Float64,1},1}) = any(isinf.(x))
Base.isinf(x::Array{Float64,1}) = any(isinf.(x))
Base.isnan(x::Array{Array{Float64,1},1}) = any(isnan.(x))
Base.isnan(x::Array{Float64,1}) = any(isnan.(x)) But it still does not work. Could it be that the cost function |
I think we need to go back to basics here. What do you mean R to R^2? That's not a nonlinear least squares problem. How do you want to weigh together the two elements of the output? This sounds like either something like a multivalued nonlinear least squares or a system of equations of sorts? Can you describe the problem you're trying to solve, not the problems you're encountering in terms of Julia errors. |
Ah OK, I guess I was confused because the Jacobian section of the documentation is kept general for a function f that can go from R^m to R^n (see https://julianlsolvers.github.io/LsqFit.jl/latest/getting_started/) so I just assumed the curve_fit function would be able to handle function of this form. If I know understand you correctly it does only support R^m to R and in this case the issue is non existent and can be closed. The manual wrapper function is then still a working solution. |
I just need to understand what your mathematical problem is, I mean what is the technical or scientific problem you're trying to solve. Without that I feel like we cannot understand each other :) That jacobian is of the vector of model function evaluations, not the objective function itself. The objective function is the least squares function of the residuals (model minus data). |
Ah ok, basically I have several energy levels as a funtion of one control parameter and I am trying to fit the eigenvalues of a model Hamiltonian as a function of the same control parameter and several system properties ( Now to link to the initial post I was not able to figure out how to fit this directly but I knew how to fit a function x->f(x) where f(x) in R therefore I simply created my own cost function |
I'm not really sure I understand, I'm quite sorry. Maybe bring this up in #math-optimization on the julia slack or on the Julia discourse. You can tag me there, and I'll try to follow the discussion :) |
What is the best way to fit a function$f: \mathbb{R} \to \mathbb{R}^n$ .
Right now I use something in the line of (best expained by a random example with a function that should be hard to fit)
which kinda works, but also seems wrong and not like the intended way.
(Everything that looks better like trying to fit the function directly where every y is a vector fails, either due to isnan or dimension mismath or cannot convert vector to float).
The text was updated successfully, but these errors were encountered: