Comments (10)
Today I have tested the new version of the master-repository and compared the fit result with the one optimized with the Gamry SW:
The script can be found on my fork of this project:
https://github.com/StefanPofahl/EquivalentCircuits.jl/blob/0f77c59ab71c04d2600db160766fbd4cbe237e2e/examples/comparison_EC_Gamry_Fit_against_GenricAlgorithm_Fit.jl
from equivalentcircuits.jl.
I have written a script that evaluates a number of optimisation methods for this specific complex equivalent circuit setting.
The script can be found at:
https://github.com/MaximeVH/EquivalentCircuits.jl/blob/master/examples/EC_optimisation_experiment.jl
from equivalentcircuits.jl.
from equivalentcircuits.jl.
Hi Maxime! - Thanks for your nice script!
To enable functionality in my Julia-environment I have reworked your example, see here:
EC_optimisation_experiment_Maxime.jl
I have added two optional parameters to the function trace_quality()
to enable a weighting of the impedance points.
Do you think, that this makes sense? Is it possible to pass a weighing vector also to the optimization function: optimize()
?
And I have added the feature to select only a part of the measured impedance points for optimization.
Another more general question:
Is there also an optimization solver available that uses genetic or evolutionary algorithms for a local stochastic optimization strategy?
from equivalentcircuits.jl.
Hi Stefan,
I think weighing the impedance points makes sense in cases where some areas within the impedance spectrum's frequency range are of greater importance than others. If the low frequencies are less important for the circuit you are fitting, it makes sense to allocate a lower weight to them in the fitting quality evaluation and during the optimization of the parameters.
If you want to add weights at certain frequencies during optimisation as well, you can do this by adjusting the objective function in the ObjectiveFunction.jl source file.
The current objective function is implemented as
function objectivefunction(circuitfunc,measurements,frequencies)
function objective(x)
model_output = [circuitfunc(x,fr) for fr in frequencies]
return mean((abs.(measurements - model_output).^2)./(abs.(measurements).^2 .+ abs.(model_output).^2))
end
return objective
end
Weights can be included in this function as follows:
function objectivefunction_weighted(circuitfunc,measurements,frequencies,weights)
function objective(x)
model_output = [circuitfunc(x,fr) for fr in frequencies]
return mean(weights .* (abs.(measurements - model_output).^2)./(abs.(measurements).^2 .+ abs.(model_output).^2))
end
return objective
end
Here the weights
input is a vector of the same dimension as the frequencies
input,
where each value is a measure of how much importance is attached to the impedance point at the corresponding frequency. Note that you will also have to adjust the parameter optimisation function such that the modified objective function is used and the weights are included as input.
As for your last question, I have not used such modules before, maybe the Evolutionary.jl package will have what you're looking for.
Regards,
Maxime
from equivalentcircuits.jl.
Maxime, thanks for the quick replay! I would not change the name of the function, but would specify the weighing factor as optional, what do you think?
from equivalentcircuits.jl.
That's fine by me, I can include the relevant optional arguments to the objectivefunction
and parameteroptimisation
functions, along with the other updates.
from equivalentcircuits.jl.
That sounds promising :-)
P.S.:
I definitely will have a look on the Evolutionary.jl
-package!
from equivalentcircuits.jl.
The weighting works perfect, please have a look:
https://github.com/StefanPofahl/EquivalentCircuits.jl/blob/9091feb7aa118289137bcaaa88fdf40a59716607/examples/EC_optimisation_experiment_Maxime.jl
from equivalentcircuits.jl.
Info:
- The BlackBox Optimization does not work for me on Julia v1.8.3
- EvolutionStrategy might be a bad option (what I have seen so far)
- I have not yet tested GeneticAlgorithms
from equivalentcircuits.jl.
Related Issues (20)
- Algorithm fails to find optimal parameters for a given equivalent circuit model HOT 4
- Use Optimization.OptimizationProblem() to find optimal fit of parameters HOT 2
- Compiled App including EquivalentCircuits craches on other computers HOT 4
- Add support for Warburg element in circuit_evolution() HOT 4
- Proposal: Optional input parameter Low-Frequency resistance HOT 3
- Just a question ... HOT 1
- The output parameters are too small and add user customized threshold? HOT 3
- Example circuit is not visible when using dark mode HOT 1
- Non-deterministic behavior HOT 1
- Bug in Circuit Library Generation HOT 8
- Use logging instead of `println` HOT 3
- Hardcoded literal "3" in `circuit_evolution`'s `removeredundancy` HOT 2
- Add `maxiter` to avoid infinite jobs when `convergence_threshold` can't be met
- Paper citation HOT 1
- How do I add a custom circuit with a CPE element to circuit_evolution() method? HOT 2
- Inconsistent boundary setting within the evolution process and out of the evolution process HOT 1
- Extract the estimated circuit parameters directly from the evolution elite HOT 2
- Implement O(Z)-independent `convergence_threshold` HOT 1
- Add `verbose` argument to show progress during circuit evolution HOT 1
- Profile for memory allocation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from equivalentcircuits.jl.