def check_clusterings(labels_true, labels_pred):
 labels_true = np.asarray(labels_true)
 labels_pred = np.asarray(labels_pred)
 if (labels_true.ndim != 1):
  raise ValueError(('labels_true must be 1D: shape is %r' % (labels_true.shape,)))
 if (labels_pred.ndim != 1):
  raise ValueError(('labels_pred must be 1D: shape is %r' % (labels_pred.shape,)))
 if (labels_true.shape != labels_pred.shape):
  raise ValueError(('labels_true and labels_pred must have same size, got %d and %d' % (labels_true.shape[0], labels_pred.shape[0])))
 return (labels_true, labels_pred)

def check_clusterings ( labels_true , labels_pred ) : labels_true = np . asarray ( labels_true ) labels_pred = np . asarray ( labels_pred ) if ( labels_true . ndim != 1 ) : raise ValueError ( ( 'labels_true must be 1D: shape is %r' % ( labels_true . shape , ) ) ) if ( labels_pred . ndim != 1 ) : raise ValueError ( ( 'labels_pred must be 1D: shape is %r' % ( labels_pred . shape , ) ) ) if ( labels_true . shape != labels_pred . shape ) : raise ValueError ( ( 'labels_true and labels_pred must have same size, got %d and %d' % ( labels_true . shape [ 0 ] , labels_pred . shape [ 0 ] ) ) ) return ( labels_true , labels_pred )
check that the two clusterings matching 1d integer arrays .