
Today I was able to compile my code for a multiple linear regression (MLR) sucessfully for the first time. See jklingel/Multiple-Linear-Regression: Creating a multiple linear regression with two input variables in C
The code is written in POWER C and produces the same result as my x86 version written for GCC (after two hours of troubleshooting).
In this demo, I am using the house size and the house age as independent input variables to estimate the house price (output), based on a given house size and age. y is the result („price“), x1 is the house size „square“, and x2 is the age of the house „age“.
The machine learning algorithm gets trained with 10 variable sets {x10, x20, y0} to {x19, x29, y9}. 10 data sets are definitely not enough for real artificial intelligence 🙂
The equations I am using are
y = b0 + b1x1 + b2x2 + ... + bn*xn
b1 = [ (Σx2²)(Σx1y) - (Σx1x2)(Σx2y) ] / [ (Σx1²)(Σx2²) - (Σx1x2)²
b2 = [ (Σx1²)(Σx2y) - (Σx1x2)(Σx1y) ] / [ (Σx1²)(Σx2²) - (Σx1x2)²
b0 = ybar - b1x1bar - b2x2bar
During code development I stumbled over a strange behavior of POWER C, which I never had before: Sometimes the compiler ended with no error message but did not create an object file. Restarting everything helped. The only idea I have for this behavior is that maybe my source code file gets too big for POWER C. It takes up 4,352 bytes on the floppy. Or maybe because I am using a bunch of floating-point variables? The grafpak1.c file in the GRAFPAK distribution for POWER C is much larger.
My favorit error message by far is „*** illegal float quantity“. You coded everything, the checker verified your code, the compiler ran, the linker ran, after minutes of waiting you finally run your program just to find out that the last operation is overflowing an integer.