public void run()
    {
	// If there are some user inputs
	if(input != null)
	{
	    // If those parameters are valid
	    if(this.validateParameters())
	    {
		// We Now know the parameters are valid, so we can proceed
		// to automatically train the network.

		// Get Training & Validation Data
		I_DataSet t_data = new PatternFileProcessor().process(this.input.getPathToTrainingFile());
		I_DataSet v_data = new PatternFileProcessor().process(this.input.getPathToValidationFile());


		System.out.println("Training Data Rows:"+t_data.getRows());
		System.out.println("Training Data Cols:"+t_data.getColumns());

		System.out.println("Validation Data Rows:"+v_data.getRows());
		System.out.println("Validation Data Cols:"+v_data.getColumns());

		// Major error if we return at this stage. This
		// means that the training or validation data
		// can't be read, or is just plain invalid.
		if(t_data == null | v_data == null)
		    return;

		// Ok, so to begin with, we havn't achieved
		// the desired accuracy.
		boolean accuracyAttained = false;

		// A variable to count the number of attempts
		// made to automatically generate the neural
		// network. As we don't want to loop forever,
		// set an upper limit of 100.
		int count = 0;
		
		// While we haven't attained the desired accuracy...
		while(!accuracyAttained && count < 100)
		{
		    // Build Map
		    SelfOrganizingMap map = new SelfOrganizingMap(t_data.getDataAsArrayList());
		    
		    // How many attributes does the data have?
		    // Find out and pass this value to the map, so that
		    // the map can accommodate them.
		    map.setAttributes(t_data.getColumns());
		    
		    // What map width to use? First check if the user
		    // has specified a map width, else default to 10.
		    if(this.input.getMapSize() > 1 && this.input.getMapSize() < 25)
			map.setMapWidth(this.input.getMapSize());
		    else
			map.setMapWidth(10); // Default

		    // Normalise Inputs
		    map.NormalisePatterns();

		    // Build map
		    map.Build();

		    // Train map
		    map.Train(map.maximumErrorRate);

		    // Find Clusters of positive pulsar instances in the map
		    SOMClassifier classifier = new SOMClassifier(map);

		    // If no clusters are found, then something has gone wrong.
		    // Perhaps the training data has no positive instance?
		    if(!classifier.locateClusters(t_data))
		    {
			System.out.println("No clusters found");
			break; // Just break and exit.
		    }

		    // Get the type of classifier the user would like to use.
		    // 0: Naive KNN, K = 0.
		    // 1: KNN K = 3 (can be varied)
		    int classifierChoice = input.getClassifier();
		    System.out.println("Using classifier: "+classifierChoice);
		    
		    // Validate against validation data set
		    if(classifierChoice < 0)
			classifier.validate(v_data, 0);
		    else
			classifier.validate(v_data, classifierChoice);

		    // Get Statistics
		    I_ClassifierStatistics stats = classifier.getStatistics();

		    // Now check accuracy of the map based on training
		    // and validation data. If accuracy sufficient, save map.		    
		    int accuracy = (int)Math.round( stats.getAccuracy() * 100 );
		    int desiredAccuracy = (int)input.getDesiredNetworkAccuracy();
		    int precision = (int)Math.round( stats.getPrecision() * 100 );
		    
		    // We want an acuracy equal to or better than the desired accuracy,
		    // and a precision over 50 percent.
		    if(accuracy >= desiredAccuracy && precision > 50)
		    {
			accuracyAttained = true;
			System.out.println("Accuracy attained: "+accuracy);
			System.out.println("Rounded accuracy: " + desiredAccuracy);
			
			// Save 
			Common.fileDelete(input.getNetworkSavePath());
			
			if(SOMClassifier.write(classifier,input.getNetworkSavePath()))
			    System.out.println("Self Organizing Map state persisted.");
			else
			    System.out.println("Self Organizing Map state could not be persisted!");
		    }
		    else { System.out.println("Current Accuracy: "+accuracy); }
		    
		    // Update the count of attempts to build classifier.
		    count++;
		}

	    }
	}
	else
	    System.out.println("Error: Command Line input parameters are null");

    }