nodes: 0, module; 1, function_definition; 2, function_name:LDA_discriminants; 3, parameters; 4, block; 5, identifier:x; 6, identifier:labels; 7, expression_statement; 8, comment:# validate inputs; 9, try_statement; 10, comment:# make the LDA; 11, expression_statement; 12, return_statement; 13, comment:"""
      Linear Discriminant Analysis helper for determination how many columns of
      data should be reduced.
  
      **Args:**
  
      * `x` : input matrix (2d array), every row represents new sample
  
      * `labels` : list of labels (iterable), every item should be label for \
          sample with corresponding index
  
      **Returns:**
      
      * `discriminants` : array of eigenvalues sorted in descending order
  
      """; 14, block; 15, except_clause; 16, assignment; 17, subscript; 18, expression_statement; 19, block; 20, pattern_list; 21, call; 22, identifier:eigen_values; 23, call; 24, assignment; 25, raise_statement; 26, identifier:eigen_values; 27, identifier:eigen_vectors; 28, identifier:LDA_base; 29, argument_list; 30, attribute; 31, argument_list; 32, identifier:x; 33, call; 34, call; 35, identifier:x; 36, identifier:labels; 37, parenthesized_expression; 38, identifier:argsort; 39, attribute; 40, argument_list; 41, identifier:ValueError; 42, argument_list; 43, unary_operator; 44, identifier:np; 45, identifier:array; 46, identifier:x; 47, string; 48, identifier:eigen_values; 49, string_content:Impossible to convert x to a numpy array.
code: def LDA_discriminants(x, labels):
      """
      Linear Discriminant Analysis helper for determination how many columns of
      data should be reduced.
  
      **Args:**
  
      * `x` : input matrix (2d array), every row represents new sample
  
      * `labels` : list of labels (iterable), every item should be label for \
          sample with corresponding index
  
      **Returns:**
      
      * `discriminants` : array of eigenvalues sorted in descending order
  
      """
      # validate inputs
      try:    
          x = np.array(x)
      except:
          raise ValueError('Impossible to convert x to a numpy array.')
      # make the LDA
      eigen_values, eigen_vectors = LDA_base(x, labels)
      return eigen_values[(-eigen_values).argsort()]