# Neural network

After research, neural networks do not give the patient the answer he wants. Its output is ownly 0 or 1 or a decree believe in that (range from 0 to 1). Neural networks are nice to identify patrons, but not for this problem.

## What is the problem?

After fussy search did his rounds. It has a collections of entries from the past. Each entry has the answer on the question: "How much insuline has to be used?" The problem is wich answer is the best answer.

## Instance based learning

Some quotes:

"Learning in these algorithms consists of simply storing the presented training data. When a new query instance is encountered, a set of similar related instances is retrieved from memory and used to classify the new query instance."

This is exectly what is descriped on the previous page. Training instances (the log entrees the user insert into the database) are memoriezed. A question to the system like": "How much insuline has to be used?" is the new query instance. The right answer is the classification.

There are a few algoritms that can be used:

- k-nearest Neighbor algorithm (lazy learning, local)
- Locally weigthed regression (lazy learning, global)
- Radial basis funcions (eager learning, local)

## k-nearest Neighbor algorithm

After fusy-search finished its search rounds. The algoritm will measure the distance between each founded entry and the k nearest entries will be added to the advise and presented to the user. Giel has to determine what the value of k much be. He know the preferences of the users better. how many entry are usefull for users and how many entries can they compriand.

For using k-nearest neighbor algorithm (k-NNA) you need a n-dimensional space. The space is build up from the instances used as trainingsdata. N is the number of attributes were the instances are composed of. When a new instance x (test-data) with attributes <math>(a_1 (x),a_2(x) \ldots a_n(x))</math> is put into the system, the system form a query that looks for the near instances in the n-dimensional space. For each instance the distance <math> d(x_i,x_j) </math>is measured by:

<math>d(x_i,x_j) \equiv \sqrt{\sum_{r=1}^n (a_r(x_i)-a_r(x_j))^2}</math>

This is the Euclidean distance. This will be done for <math> x_1 \mathrm{ till }x_k </math>. The k-nearest instances are then add up and divided by k to calculate the mean.

<math>\hat{f}(x_q) \leftarrow \frac{\sum _{i=1}^k f(x_i)}{k}</math>

Er is een formule die berekent hoe groot k mag zijn in verband met de grootte van de buurt waarin men zoekt, maar die heb ik nu niet bij me. Die volgt later.