code: def make_country_matrix(self, loc):
          
  
          top = loc['features']['ct_mention']
          top_count = loc['features']['ctm_count1']
          two = loc['features']['ct_mention2']
          two_count = loc['features']['ctm_count2']
          word_vec = loc['features']['word_vec']
          first_back = loc['features']['first_back']
          most_alt = loc['features']['most_alt']
          most_pop = loc['features']['most_pop']
  
          possible_labels = set([top, two, word_vec, first_back, most_alt, most_pop])
          possible_labels = [i for i in possible_labels if i]
  
          X_mat = []
  
          for label in possible_labels:
              inputs = np.array([word_vec, first_back, most_alt, most_pop])
              x = inputs == label
              x = np.asarray((x * 2) - 1) # convert to -1, 1
  
              # get missing values
              exists = inputs != ""
              exists = np.asarray((exists * 2) - 1)
  
              counts = np.asarray([top_count, two_count])  # cludgy, should be up with "inputs"
              right = np.asarray([top, two]) == label
              right = right * 2 - 1
              right[counts == 0] = 0
  
              # get correct values
              features = np.concatenate([x, exists, counts, right])
              X_mat.append(np.asarray(features))
  
          keras_inputs = {"labels": possible_labels,
                          "matrix" : np.asmatrix(X_mat)}
          return keras_inputs
docs: Create features for all possible country labels, return as matrix for keras.
  
          Parameters
          ----------
          loc: dict
              one entry from the list of locations and features that come out of make_country_features
  
          Returns
          --------
          keras_inputs: dict with two keys, "label" and "matrix"