## 3 Purposed Approaches
### Artificial Immune System  
The affinity in the immune network theory was combined with the concepts of the expansion diagram for use in the clustering algorithm. The flowchart for the AIS algorithm in clustering is shown in Figure 2.  
In the expansion diagram, the members of the data pool to be clustered are plotted and the distance between them is measured by the inverse of their affinity. Higher affinity between two members implies that they will be located closer together. In this research, every single datum is treated as an antigen or antibody. The expansion diagram used in AIS clustering is depicted in Figure 3.  
The procedures of AIS clustering are explained in the following:  
Step 1. Plot the data pool for training: These untrained data are used for both antibodies and antigens.  
Step 2. Select any untrained datum randomly as an antibody generator to start creating a new antibody network.  
Step 3. Identify antigens: Every datum is used as an antigen, even those who are members of another antibody network.  
Step 4. Calculate affinity: When the antibodies are trying to identify the antigens, the binding between the antibody and antigen has to be determined; the stronger the binding, the closer the antigen is to the antibody.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Grade Matrix** & **EL102** & **PO210** & **PO311** & **AC205** & **OM291** \\ \hline
9510036 & 4 & & 3 & 3 \\
9510037 & 3 & & 4 & \\
9530001 & & 2 & 3 & 2 \\
9530010 & 2 & & 1 & \\ \hline \hline \end{tabular}
\end{table}
Table 4: Student course matrix denoting grade.  
Step 5. Identify Cluster: The antigens that are closer to the antibody generator than a pre-specified threshold are identified. If the antigen is a member of another antibody network it identifies with the one whose antibody generator is closer.  
Step 6. Generate new antibodies: The antigens that have bonded with the antibody generator now form an antibody network.  
Step 7. Check termination conditions: If all of the data have been trained, go to Step 8. Otherwise, go back to Step 2.  
Step 8. Terminate!  
In this research, every single datum is treated as an antigen or antibody. The affinity between the data is calculated for clustering. The Pseudo-Code for AIS clustering is illustrated in Pseudo-Code 1:  
Figure 3: The expansion diagram used in AIS clustering.  
Figure 2: Flowchart for Artificial Immune System (AIS) clustering.  
```
Pseudo-Code 1 AIS Clustering in Training Data
```
1:Ab_data = student course data with courses taken from years 1 and 2 #training data
2:Ag_data = Ab_data #every training data used as both antibody and antigen
3:INITIALIZE: Max_Threshold = zeros(size(Ag_data)) #stores best affinity value
4:INITIALIZE: cluster_number = zeros(size(Ag_data)) #stores antibody network No
5:INITIALIZE: cluster = 1;
6:FOR \(i=1\):size(Ab_data) #loop for all Ab
7:IF MaxThreshold(\(I\)) < Threshold #identify untrained data as antibody
8:cluster = cluster + 1; #find antibody network number
9:FOR \(j=1\):size (Ag_data) #run loop for all Ag
10:Affinity = Affinity_function(Ab(\(i\)),Ag(\(j\)));
11:IF Affinity > Threshold & Affinity > Threshold_Max(\(i\)) #check for strongest bond
12:Max Threshold(\(j\)) = Affinity; #Store best bonding value
13:cluster_number(\(j\)) = cluster; #Store Antibody Network No
14:END IF
15:END FOR
16:END IF
17:END FOR ```
Those antibodies with the same cluster number create the antibody networks in the above pseudo-code. These antibody networks will be used in the collaborative filtering to match antigens (testing data) with similar user groups.