gcalderone / GModelFit.jl

A data-driven model fitting framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GModelFit.jl

License DocumentationStatus

GModelFit is a general purpose, data-driven model fitting framework for Julia.

Installation

Install with:

]add GModelFit

Example

using GModelFit

# Prepare vectors with domain points, empirical measures and uncertainties
x    = [0.1, 1.1, 2.1, 3.1, 4.1]
meas = [6.29, 7.27, 10.41, 18.67, 25.3]
unc  = [1.1, 1.1, 1.1, 1.2, 1.2]
dom  = Domain(x)
data = Measures(dom, meas, unc)

# Create a model using an explicit mathematical expression, and provide the
# initial guess values:
model = Model(dom,  (x, a2=1, a1=1, a0=5) -> (a2 .* x.^2  .+  a1 .* x  .+  a0))

# Fit model to the data
best, res = fit(model, data)

The output is as follows:

(Components:
╭───────────┬────────────┬─────────────┬───────────┬───────────┬───────────┬─────────╮
│ Component │ Type       │ Eval. count │ Min       │ Max       │ Mean      │ NaN/Inf │
├───────────┼────────────┼─────────────┼───────────┼───────────┼───────────┼─────────┤
│ main      │ GModelFit.FComp │ 766.08825.8413.560       │
╰───────────┴────────────┴─────────────┴───────────┴───────────┴───────────┴─────────╯

Parameters:
╭───────────┬────────┬───────┬───────────┬───────────┬────────┬───────╮
│ Component │ Param. │ Range │ Value     │ Uncert.   │ Actual │ Patch │
├───────────┼────────┼───────┼───────────┼───────────┼────────┼───────┤
│ main      │ a2     │       │     1.2010.3051 │        │       │
│           │ a1     │       │    -0.1061.317 │        │       │
│           │ a0     │       │     6.0871.142 │        │       │
╰───────────┴────────┴───────┴───────────┴───────────┴────────┴───────╯
, Fit results:
    #Data :        5         Red. fit stat.:     1.0129  (DOF: 2)
    #Free :        3         Elapsed time  :      0.004
    Status:       OK

About

A data-driven model fitting framework

License:Other


Languages

Language:Julia 100.0%