Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public static int classifyInput(double[] perceptronInput, double[][] weights){ /

ID: 3646851 • Letter: P

Question

public static int classifyInput(double[] perceptronInput, double[][] weights){

//Create a new 1D array for output. There is one output for each output node,
//and the number of output nodes equals the number of rows in the weights array.


//Assign each element of output the result of doing a weighted sum
//of the corresponding row of the weights array and the perceptronInput.


//Replace the line below to return the index of the maximum value in output.
return 0;
}

Please help me write script in between. THank you

Explanation / Answer

import java.io.*; import java.util.*; public class Dataset { //The values of these variables may be changed. DatasetN is the index of the name of the dataset to be used //from the datasets string array that can be seen below. private static int datasetN = 0; public static double kernelProportion = .1; public static double varianceMaxDistanceProportion = 1; public static double learningRate = .1; public static int nIterations = 1; private static String[] datasets = {"segment", "diabetes", "waveform-5000", "letter", "vehicle", "balance-scale"}; private static int[] nsClassifications = {7, 2, 3, 26, 4, 3}; public static double[][] trainingSet = twoDArray("datasets/" + datasets[datasetN] + "Train.txt"); public static double[][] testSet = twoDArray("datasets/" + datasets[datasetN] + "Test.txt"); public static int nClassifications = nsClassifications[datasetN]; public static int seed = 0; public static double[][] twoDArray(String pathname){ try{ Scanner scanner = new Scanner(new File(pathname)); ArrayList lines = new ArrayList (); while(scanner.hasNextLine()){ String[] stringValues = scanner.nextLine().split(","); double[] values = new double[stringValues.length]; for(int i = 0; i