# Homework Assignment #2:   Bayesian Curve Fitting

This assignment is individual. In the Bishop textbook, on page 31 (Section 1.2.6), using your favorite programming language (not Matlab!), implement the formula (1.69) for Bayesian curve fitting.   [ For this you will also need to implement the formulas (1.70) - (1.72). ]   As suggested in Bishop, page 31 (1st paragraph), assume that the parameters alpha and beta are fixed and known in advance. Also assume some reasonable values for the parameters that need to be specified, e.g., the number of input values N.
Download here an excerpt from Bishop, pages 24-31   [PDF file, 1.05 MBytes]

The project involves some matrix operations (e.g., matrix inversion), and you may wish to look for existing libraries for numerical computation in the language that you're using.
For example, for Java you can find a great deal of information here: Java Numerics: information on numerical computing in Java.
There are many libraries listed there, and it appears that Jspline+JAMA,  Jampack, and many others provide all that you need for this project.

You may also consider calling Matlab from your program to perform numerical computations. Check below for more information.

Once you program the formula for curve fitting, test it using your own data set. Ideally, you could use a sequence of actual stock prices that your data collection module is already collecting (Group Assignment #1). Given a sequence of length N, run your program and compare the predicted price (at time N+1) with the actual price retrieved from the stock market. Repeat this 10 times for different input datasets. For performance evaluation, calculate both the absolute mean error and average relative error as shown in the lecture notes on page 52.

Submit the following:

1. Source code of the program
2. Short instructions on how to compile and run your program, including the allowed range of input parameters (the so called `README.txt` document)
3. An example set of test data to test your program—preferably a comma separated values (CSV) file
4. Brief summary (PDF document) of the performance evaluation (prediction errors)
Submission deadline: Email your assignment as a ZIP file by the due date, no later than 3:00 PM.
See the note about submission formats here.

## Connecting Matlab and Programming Languages

You may wish to call Matlab from your program to perform numerical computations. To do it from Java, consider MATLAB Builder Java language, which lets you integrate MATLAB applications into your organizations's Java programs by creating MATLAB based Java classes ...
Check also Calling Matlab from Java   or   Connecting Java and Matlab.

To call Matlab from C, check Calling MATLAB Software from C and Fortran Programs