parameters: (self, parameter_group, final_param_ndarray, v_vector, w_vector)
return_statement: return np.array(coefs)
docstring: Calculates the scale factors for plotting points
          in the 2D space spanned by the vectors v and w.
docstring_summary: Calculates the scale factors for plotting points
          in the 2D space spanned by the vectors v and w.
docstring_tokens: Calculates the scale factors for plotting points in the 2D space spanned by the vectors v and w .
function: def _calc_coefs(self, parameter_group, final_param_ndarray, v_vector, w_vector):
          """
          Calculates the scale factors for plotting points
          in the 2D space spanned by the vectors v and w.
          """
  
          matris = [v_vector, w_vector]
          matris = np.vstack(matris)
          matris = matris.T
  
          pas = self._flat_ndarray(final_param_ndarray)
          coefs = list()
          for parameters in parameter_group:
              testi = list()
              for param in parameters:
                  # Here as MindSpore ckpt has hyperparameters,
                  # we should skip them to make sure PCA calculation is correct
                  if ('weight' not in param.name and 'bias' not in param.name) or ('moment' in param.name):
                      continue
                  testi.append(param.data.asnumpy().copy())
  
              st_vec = self._flat_ndarray(testi)
              b_vec = st_vec - pas
              # Here using least square method to get solutions of a equation system to generate alpha and beta.
              coefs.append(np.hstack(np.linalg.lstsq(matris, b_vec, rcond=None)[0]))
  
          return np.array(coefs)
function_tokens: def _calc_coefs ( self , parameter_group , final_param_ndarray , v_vector , w_vector ) : matris = [ v_vector , w_vector ] matris = np . vstack ( matris ) matris = matris . T pas = self . _flat_ndarray ( final_param_ndarray ) coefs = list ( ) for parameters in parameter_group : testi = list ( ) for param in parameters : # Here as MindSpore ckpt has hyperparameters, # we should skip them to make sure PCA calculation is correct if ( 'weight' not in param . name and 'bias' not in param . name ) or ( 'moment' in param . name ) : continue testi . append ( param . data . asnumpy ( ) . copy ( ) ) st_vec = self . _flat_ndarray ( testi ) b_vec = st_vec - pas # Here using least square method to get solutions of a equation system to generate alpha and beta. coefs . append ( np . hstack ( np . linalg . lstsq ( matris , b_vec , rcond = None ) [ 0 ] ) ) return np . array ( coefs )