Real-World Model Builder

From UBC Wiki

Real-World Model Builder

Authors: Wucheng Zhang, Yanbai Chen, Yunan Xu

What is the problem?

In scientific experiments, we usually need to build or test a model based on the measured data, which includes the independent variable (x), dependent variable (y) and the uncertainty of the dependent variable (u[x]). We want to create a model builder which could fit the (guessed) model parameters based and data, plot the result and evaluate the quality of the fitting. This program seeks to read the experimental outcomes in a CSV file, and evaluate the factor of a combination of numerical models. The output of the program will include factors, chi-square, a fitting graph and a residual graph.

What is the something extra?

We have the following features:

  1. We implemented a interactive system that allows user to create a new model with the combination of 8 basic numerical models. [Model is designed to be a new data type with the function ([Double] -> [Double] -> [Double]) and the function derivative with respect to parameters as its field. And with such a data type design, we could manipulate the complicated functions as a normal variables.
  2. We extended the function of parser functions by creating more complicated output format and adding guards to prevent wrong inputs cases such as insufficient data points and mismatching of the number of x,y,u[y].
  3. We use a Plot package to plot our results: a fitting graph and a residual graph.

What did we learn from doing this?

We learned the power of the Haskell functional programming:

  1. The fact that function programming treat function as variables allows us to manipulate Models to create new Models. This adds the flexibility to our process of finding new models.
  2. The lazy evaluation enhance the efficiency of the fitting process.
  3. The high level of abstraction in functional programming allows us to have simple but powerful code.
  4. The pattern matching makes our parser more flexible and could deal with multiple situations.

Links to code etc

https://github.com/WUCHENG98/RealWorldModel-Builder