# Assignment 4

<rst> <rst-options: 'toc' = False/>

Please provide **short** answers (no more than 5 pages, including all your plots) to the questions below. Here is some `background reading for this assignment <https://learnche.org/literature/item/124/application-of-feedforward-neural-networks-and-partial-least-squares-regression-to-modelling-kappa-number-in-a-continuous-kamyr-digester>`_.

The aim is to build a soft-sensor model for Kappa number, which is measured at the outlet of the Kamyr digester. Long time delays exist between variables that affect :math:`y` = Kappa number, creating problems with feedback control to keep :math:`y` on target.

Columns for the :math:`X` variables have already been time-shifted to align the data, but you are free to try additional time-shifting of the :math:`X` columns, and lagging the :math:`y`-variable one or more times in the :math:`X` space.

Now your task is to build as good a soft-sensor model as possible using `the extended data set <https://learnche.org/images/0/06/Kamyr-full.csv>`_ from a bleach kraft mill in Alberta. Use observations of the first 2400 hours (40 days of data). Then test your model's prediction ability on data from hours 2400 to 3400, and hours 3400 to 4400.

For each of these prediction periods, show time-series plots of

- SPE,
- :math:`T^2`,
- and plot observed *and* predicted Kappa number on a time-series plot (not the usual scatter plot)
- Also calculate RMSEP for the prediction periods.

- Questions**

- How do you rate the soft-sensor's performance?
- Read the course notes from class 8 on adaptive models to see how you can improve the performance.

</rst>