Isystems.pngAlgorithms inspired by biological immune systems also find their application in Finance. Although not as popular as the Neural Net or GA and their derivatives, recent research has shown that these algorithms can provide optimisation and classification capabilities comparable to conventional methods [Gonzalez, Dasgupta]. The aim in designing artificial immune systems (AIS) is not to produce exact models of the natural immune system, but rather extract ideas and metaphors that can help solve real-world problems. There are two main categories of the Artificial Immune system namely Negative Selection and Clonal Selection which lend their inspiration to Classification and Optimisation respectively.

immuApplic.png

Background

The natural immune system is comprised of a network of specialised cells and chemical molecules which work together to defend the host organism from foreign objects (Pathogens) such as bacteria, fungi, chemical compound etc. The three main capabilities of the Natural Immune system are:

  1. Recognise a foreign body (pathogens) such as bacteria, fungi, chemical compound etc.
  2. Destroy the pathogen.
  3. Remember an almost unlimited number of pathogens.

ImmuneImage.jpg

There are two types of cells comprising the immune system: phagocytes and lymphocytes. The first group belongs to the innate immune system while the latter group mediates adaptive immunity. A major component of the population of lymphocytes is made up of B and T cells, whereas that of phagocytes comprises of B cells only. These cells are capable of recognising and responding to certain antigen (foreign body) patterns present on the surface of pathogens. The picture above tries to illustrate this.

Although the real workings of the immune system is complicated, the immunity process can be summarised as follows:

  1. Antigen-secreting pathogen enters the body
  2. B cells are activated by the foreign antigen
  3. With the help of T cells, B cells undergo cloning and mutation
  4. Plasma B cells secrete immunoglobulins which attach to the antigen
  5. Marked antigens are attacked by the immune system
  6. Memory of the antigen is maintained by B memory cells

The key point is that immune systems demonstrate self-organisation and adaptive behavior. From a modelling perspective, it can be considered as a sophisticated information processing system which possesses powerful pattern recognition and classification abilities. It also has the capability to adapt to new circumstances (problems), and can remember solutions to problems it has previously encountered. In designing artificial immune algorithms we wish to draw metamorphical inspiration from the workings of the natural immune system to design algorithms to solve computational problems. The negative selection algorithm and clonal expansion and selection algorithm are examples of applications of such metaphors.

Negative Selection Algorithm

The basis of the negative selection algorithm is the ability of the immune system to distinguish between two system states i.e. normal and abnormal. [Forrest] developed the negative selection algorithm and has been modified since by a number of researchers. The negative selection algorithm can be summarised as:

  1. Detector set D is empty
  2. Repeat
  3. Create a random vector x drawn from the valid range
  4. For every self element s in the self vector
  5. Calculate the euclidean distance between s and x
  6. If distance < threshold go to step 2
  7. Else add x (a valid non-self detector) to set D.
  8. Until set D contains the required number of detectors (assume N)

The flowchart below shows the above steps

detCreaTrain.PNG

To understand this let us assume we would like to classify corporate bonds so as to differentiate investment grade from junk grade. Assume that the diagnosis will be made on the basis of ratio information drawn from the financial statements of the companies and that we also have a data-set containing example ratios for financially healthy companies and also for companies which later defaulted on their bonds.

Self is defined as financially healthy companies. Next a set of detectors (of size D) is randomly created. Each of these detectors consists of a vector of real numbers, corresponding to financial data obtained from the financial statements (such as accounting ratios). The negative selection process is then applied, whereby a series of vectors of ratios corresponding to healthy companies is presented to the detectors. Any detector which is identical or similar (the degree of similarity could be measured using the euclidean distance) to a data vector corresponding to a healthy company is discarded. As detectors are discarded, new detectors are created to to build up the size of the population D, which are subject to the same negative selection process. If a detector is created which fails to match any vector in the training set of healthy companies, it is a potentially useful detector of an unhealthy company. This process is repeated until all the detectors in the out-of-sample set is exhausted.

NIBRcomp2.png

The main challenges in applying this algorithm are:

  • It ignores the fact that examples of past failing corporate bonds exist
  • The task of generating a population of valid detectors will grow rapidly as the size of self increases.

These issues depend on on whether a good seed is used in generating the random number which depend on historical values of the accounting ratios. A good seed inevitably leads to early convergence which improves classification at steady state.

Clonal Expansion and Selection Algorithm

Unlike the negative selection algorithm, the clonal selection algorithm aims to mimic the creation of a large number of antibodies which will bind strongly to a specific antigen. This metaphor is adopted to design an optimisation algorithm in which the antibody can be considered as a potential solution, where the degree of the binding or fit between the antibody and the antigen represents the quality of the solution. The objective, therefore, is to start from an initial population of solutions, rest them against the antigens, using the algorithm iteratively. The steps in the clonal expansion and selection algorithm can be summarised as:

  1. Create an initial random population P of solution vectors (antibodies)
  2. Select a subset F of the solutions from P, biasing the selection process towards better solutions
  3. For each member of F (parents), create a set of clones, with better members of F producing more clones
  4. Mutate each of these clones, in inverse proportion to the parent’s fitness. Better solutions are mutated less (hypermutation)
  5. Select a subset of newly generated solutions S
  6. Create a number of newly created random solutions R
  7. Replace poorer members of P with better solutions from S and R
  8. Repeat steps 2 - 7 until termination condition is reached

The key difference between the clonal selection algorithm and other evolutionary algorithms is that this method in which variety of candidate solutions is generated when seeking to iteratively improve solutions.

Analogy.png

As an example I apply the clonal selection algorithm to finding the maximum value of a two dimensional multi-modal function. The multi-modal function could for instance describe the fitness of an asset allocation problem. I set my parameters as follows:

  • Number of iterations: 25
  • Number of antibodies: 100
  • Number of clones per antibody: 10
  • Clone Mutation rate: 0.010

Our initial population of 2-dimensional solution antibodies occupies different locations of the function:

initiPopuCS.png

After 25 iterations we see the clonal algorithm has managed to converge to the maximum points on the function

finalPopuCS.png

We have shown that the clonal expansion and selection can be used to optimise a 2-dimensional multi-modal function. This example can be extended to problems of n-dimension such as optimising trading rules or tactically allocating a portfolio of stocks to meet certain risk /return requirements. We will hopefully discuss such problems in due course. I hope this post gives the reader a rough idea of how Artificial Immune Systems can be applied to finance. Off-course complete understanding of these algorithms comes from the workings of the actual biological process from which the metaphors are drawn, which the reader may be keen to explore further before attempting to apply these algorithms.