Skip to content
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

New Example: Parameter Identification from Non-Contiguous Measurements #246

Merged
merged 5 commits into from
Sep 20, 2024

Conversation

Peter230655
Copy link
Contributor

I made some changes to parameter identification simulation. I deleted the old PR as it contained unwanted files, which I did not know how to remove.

@Peter230655
Copy link
Contributor Author

removed instance constraints. They were not used, but I forgot to remove the code.

@moorepants moorepants changed the title cosmetic changes New Example: Parameter Identification from Non-Contiguous Measurements Sep 19, 2024
@moorepants
Copy link
Member

I took the liberty to edit the example with the main thing being changing it to have different initial conditions for each measurement. I also removed the bias, as the identification will fail for large bias unless you add such a term in the model.

@moorepants
Copy link
Member

You can see my edits here: 0961906

@moorepants
Copy link
Member

If you are fine with my edits, I will merge it.

@moorepants
Copy link
Member

You can do a "git pull origin parameter_identification" on that branch to bring my changes to your computer and then you can run it to see the result.

@Peter230655
Copy link
Contributor Author

Peter230655 commented Sep 20, 2024

If you are fine with my edits, I will merge it.

It looks MUCH nicer!! Of course I am fine with these changes!
NB:
I REALLY appreciate these changes! Like this I will learn to write better, and better looking code!
So, the more you change my code, the better for me!

For example, tow days ago. you critiziced my convoluted way of reducing frames in an animation.
So I learned a much better way of doing it - and learned how to use slicing, too!
How else, atr my age, would I leanr to write better code?

@Peter230655
Copy link
Contributor Author

Peter230655 commented Sep 20, 2024

I took the liberty to edit the example with the main thing being changing it to have different initial conditions for each measurement. I also removed the bias, as the identification will fail for large bias unless you add such a term in the model.

I wondered, that it worked with the bias. I gues it did because my 'biases' were centered around 0.
Would it be worth to make a model with bias?

the main thing being changing it to have different initial conditions for each measurement.
This is the reason, you integrated the complete system four times?
I am not sure I totally understand: The four differential equations are independent from each other?
When you write x0 = 4 * random(len(states)), are you not giving different initial conditions for each measurement, even if you integrate the system once only?
(of course, the code looks VERY elegant!)

@Peter230655
Copy link
Contributor Author

Peter230655 commented Sep 20, 2024

There is a small typo. which I overlooked 50 times:
image
It should be estimate of the spring constant, the space is missing.

@moorepants
Copy link
Member

Would it be worth to make a model with bias?

You could explore that if it interests you. When I was playing with the example I noticed that the identification would fail often if the bias was large relative to the measurements. There are biases in real experiment data, but I think you would need to identify the bias, i.e. include it as a parameter in the model, for things to work consistently.

@moorepants
Copy link
Member

You simulate the same motion four times and changed the noise applied to the measurements. I'm simulating four times and change both the initial conditions and the noise. It is more typical, in my experience, that real measurements have arbitrary initial states. Only if you have a very controlled experiment is that not the case and I do most experiments with humans who cannot start in the same state.

@moorepants moorepants merged commit 1ce28f3 into csu-hmc:master Sep 20, 2024
17 checks passed
@Peter230655
Copy link
Contributor Author

I will play around with it, I have lots of time!

NB:
I think I told you that I added a force = F1sin(omegat)
and tried to get opty to find this unkown input trajectory.
No matter how many measurements I gave, I gave up to 50 or so, it would always get the trajectory to be 'Bang - Bang'.
(of course it would easily find F1 and omega as parameters)

Do you think, this is impossible in principle?
Or would one 'just' need a huge amount of measurements?

@moorepants
Copy link
Member

Do you think, this is impossible in principle?

I don't know, I'd have to see how you are constructing the problem.

@Peter230655
Copy link
Contributor Author

I will send you the program I wrote.
How would you prefer it:

  • by email?
  • as a PR?
  • another way?

Thanks!

@Peter230655 Peter230655 deleted the parameter_identification branch September 20, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants