I need som help with my java-code, I dont really know what the problem is, and Im a rookie to java codes.

When i compile the java doc. I get output;

**Perceptron.java:12: learn(Instance[],int,int) in Perceptron cannot be applied to (Instance[],int)**

PerceptronModel model = learn(train_data,5);

^

PerceptronModel model = learn(train_data,5);

^

1 error

And here is the code

import java.io.*; public class Perceptron { public static void main(String[] args) throws IOException { DataReader reader = new DataReader(); reader.init(args); Instance[] train_data = reader.getInstances(args[0]); Instance[] test_data = reader.getInstances(args[1]); PerceptronModel model = learn(train_data,5); System.out.println("\n\nRegular Perceptron======================================================"); System.out.println("Final Training Accuracy: " + model.accuracy(train_data)); System.out.println("Final Testing Accuracy: " + model.accuracy(test_data)); System.out.println("======================================================"); model.setToAvgWeights(); System.out.println("\n\nAveraged Perceptron\n======================================================"); System.out.println("Final Training Accuracy: " + model.accuracy(train_data)); System.out.println("Final Testing Accuracy: " + model.accuracy(test_data)); System.out.println("======================================================"); } public static PerceptronModel learn(Instance[] train_data, int num_iters, int num_labels) { PerceptronModel model = new PerceptronModel(); double[] w = model.weights; int prime; double score; for(int i = 0; i < num_iters; i++){ for(int j = 0; j < train_data.length; j++){ prime = 0; score = 0; for(int k = 0; k < num_labels ; k++){ if(score < train_data[j].getScore(w, k)){ score = train_data[j].getScore(w, k); prime = k; } } if(prime != train_data[j].real_label){ w = updateWeights(w, train_data[j].getFeatures(train_data[j].real_label) , train_data[j].getFeatures(prime)); model.update(w); } } } return model; } private static double[] updateWeights(double[] weights, double[] yOne, double[] yTwo){ for(int i = 0; i < weights.length; i++){ weights[i] += yOne[i] - yTwo[i]; } return weights; } }

This post has been edited by **macosxnerd101**: 17 October 2014 - 08:19 AM

Reason for edit:: Please avoid titles like "Help" and "Error"