Evolving a neural network to fit a function nbsponsider the


This assignment involves exploring the properties and adding some functionality to an evolving Artificial Neural Network (ANN). The supervised learning system evolves the weights for an ANN using a generational evolutionary model. The goal of the evolving ANN is to fit a function of the form f(x).

1. Download from Blackboard (Assignments->Assn3) the assn3.zip file, and extract the files into a folder. 2. Startup Eclipse and import the project named EvolAnn. You will also need to fix the external jar file references – remove the old ones and add the external jar files found under the lib folder (weka.jar,jcommon-1.0.12.jar, jfreechart-1.0.9.jar, junit.jar, servlet.jar).

There are a number of packages with this project: Package ann: This package contains the neural network classes that implement a simple feed-forward neural network with a single hidden layer. The structure of this package follows the neural network structure described at the ai-junkie website. Package evolve: This package contains a definition of an individual and the population structure for the evolving population. You will have to write some additional methods for these classes. Package utilities: This package contains an ObjectCloner class, which does a deep copy of a class structure (very useful if you want to make a copy of an object), and a random number generator (the Mersenne Twister) that is accessed by calling the static declaration of this class (e.g. Util.rnd.nextDouble(), etc.). This approach allows a single random generator to be accessed by many classes.

Package main: This package contains the main window (you start the program by highlighting Mainwin and running as a Java application), and the thread (EvolveThread) used to control and display the evolving population.

1. Highlight Mainwin and run as a Java application. 2. Click on “Load Data”, and select the file data/reg1.arff. 3. Click on “Initialise” – this creates the initial random population and displays the best individual, its prediction, the population current fitness values and the weights of the best individual. 4. Click “Start” – the system begins evolving the population – note that the “Pause” button allows the system to be stopped/started. The model uses a population of individuals, each representing the weights for a neural network (ANN) with architecture (1:N:1), where N = number of hidden nodes. The ANN weights are evolved over time to try and fit the loaded function. You will notice that over time (top right graph) the best fitness gradually decreases (the fitness measure is the RMSE, so zero is a perfect match, and fitness is always ≥ 0). Note also that, although there are settings for crossover probability, THIS IS CURRENTLY NOT IMPLEMENTED. Hence the population is just using mutation to create variation in the population. Try loading in data/reg2.arff – this is a more complex function, however given enough time the system will evolve a near perfect match to this function!

Assignment Exercises

1. Examine the double[] update(double in[]) method in the SNeuralNet class (in the ann package) and answer the following question: Explain why for this problem it is necessary to use a linear function (i.e. just pass the final summed weights through to the output) for the output layer of the ANN, rather then the sigmoid function (that is used for the input and hidden node layers).  

2. The current model uses tournament selection, with tournament size as defined by the field on the Main window (i.e. defaults to 5). Run the model (load in data reg1.arff) with tournament size = 1 and the defaults (i.e. mutation prob=0.1, mutation dev = 0.5, no elitism). Explain the behaviour that you observe. Now set elitism on. Explain the behaviour.

3. Set tournament size to 2, mutation probability to 0.0, no elitism, and run the model. Provide an explanation for the behaviour you observe. Now set tournament size to 1 and explain the behaviour that you now observe, ensuring that you relate this back to the previous behaviour.

4. Examine the class EvolveThread and the method run(). This method repeatedly calls the population to evolve the next generation of individuals. Note that if fps is true (indicating that fitness prop. selection is to occur) the method current_pop = current_pop.evolve_generation(data) is called. Currently this method just makes a copy of the current population. Your task is to implement a fitness proportionate selection model in this method. Note that since lower fitness is better (since it measures the RMSE against the training data) you will need to adjust the fitness so that fitter individuals have larger values, prior to constructing the proportionate fitness values. Include a copy of your code for this method in your write-up and an explanation of your implementation

5. Examine the class Individual (which represents an individual in the population). The method for crossover is defined as: public void crossover(double crossprob, Individual p2) The interpretation for this method is that “this” individual is to be crossed over with Individual p2 with probability crossprob (i.e. crossprob is the probability that the crossover will occur). Use one-point crossover to mix the weights of “this” individual with p2. Note that you also have to choose randomly whether to copy the first section of the weights from p2, or the second, into “this” individual. HINT: Examine the mutation method for clues. Include a copy of your code in your write-up and a brief explanation of your implementation

6. Assume now that you want to create a crossover method using uniform crossover. Give a pseudo-code description (no implementation) for the method: public void crossover(double crossprob, double locusprob, Individual p2) where crossprob is as the previous crossover, and locusprob is the probability that any locus (weight) from p2 is copied to “this” individual.

7. Describe and explain the behaviour of the model when only crossover is used (no mutation) and no elitism. Use the following settings: Population size of 1000, mutation prob = 0.0, tournament size = 2, Crossover Prob = 0.1

8. Crossover as a mixing operation for Artificial Neural Networks (ANNs) Consider the general operation of crossover when making offspring for individuals that represents the weights for an ANN. Make an argument for why crossover may not be an appropriate way to evolve neural networks (or argue why it is a reasonable approach if you prefer). You will need to consider what the weights are representing and the relationship between different individuals in the population.

9. A Co-evolution System Design. Consider the design for a co-evolutionary system to model predator-prey dynamics. Assume that you will use a functional language to describe the behaviour for the predators and preys and that the individuals will live on a 2-dimensional torus. Each individual has a location (x,y) and can sense their food (predator) or enemy (prey), as well as move, turn, etc. Describe a simple language for the predator and prey individuals and how you would measure the fitness. What type of behaviour might you expect to see from your model? What problems would have to be addressed for the model to produce interesting dynamics? Ensure you include all references to work that you have used to support your answer. 

Solution Preview :

Prepared by a verified Expert
Science: Evolving a neural network to fit a function nbsponsider the
Reference No:- TGS01224614

Now Priced at $70 (50% Discount)

Recommended (92%)

Rated (4.4/5)

A

Anonymous user

2/23/2016 6:36:45 AM

You must ensure to read all the guidelines and instructions to perform the assignment and provide the complete solution for ‘A Co-evolution System Design’. Consider the design for the co-evolutionary system to model predator-prey dynamics. Suppose that you will make use of a functional language to illustrate the behavior for the predators and preys and that the individuals will live on the two-dimensional torus. Each and every individual consists of a location (x, y) and can sense their food (that is, predator) or enemy (that is, prey), and also move, turn and so on. Illustrate a simple language for the predator and prey individuals and illustrate how you would measure the fitness. What kind of behavior might you predict to see from your model? Illustrate what problems would have to be addressed for the model to make interesting dynamics? Make sure you comprise all the references to work that you have employed to support your answer.