0

As input I have a hashmap which stores as a key an int array of the form [0,1,0,0,0,1,1,0,0,6,0,1] and as a key a String label, i.e. science. What I want to do is extract the array and deposit it into a 2D array. The I want to compare the label to another string and if it is a match save a 1 to outputs else save a zero. I thought the code below would do that trick, but it seems not. Where have I gone wrong?

   double[][] feature_matrix = new double[ number_of_files ][ globo_dict_size ];
   int[] outputs = new int [ number_of_files ];

   //likely not the best way to do this
   for(int z = 0; z < number_of_files; z++)
   {

       for( Map.Entry< int[] , String > entry : train_freq_count_against_globo_dict.entrySet() ) 
       {
           int[] container_of_feature_vector = entry.getKey();

           for (int q = 0; q < globo_dict_size; q++) 
           {
               feature_matrix[z][q] = container_of_feature_vector[q];
           }
           outputs[z] =  String.valueOf( entry.getValue() ).equals(LABEL) ? 1 : 0;
       }
   }
smatthewenglish
  • 2,831
  • 4
  • 36
  • 72

0 Answers0