(train_idx, test_idx, label_idx, unlabel_idx, path)
Save the split to file for auditting or loading for other methods.

    Parameters
    ----------
    saving_path: str
        path to save the settings. If a dir is not provided, it will generate a folder called
        'alipy_split' for saving.
Save the split to file for auditting or loading for other methods.
Save the split to file for auditting or loading for other methods .
def split_save(train_idx, test_idx, label_idx, unlabel_idx, path):
    """Save the split to file for auditting or loading for other methods.

    Parameters
    ----------
    saving_path: str
        path to save the settings. If a dir is not provided, it will generate a folder called
        'alipy_split' for saving.

    """
    if path is None:
        return
    else:
        if not isinstance(path, str):
            raise TypeError("A string is expected, but received: %s" % str(type(path)))

    saving_path = os.path.abspath(path)
    if os.path.isdir(saving_path):
        np.savetxt(os.path.join(saving_path, 'train_idx.txt'), train_idx, fmt='%d')
        np.savetxt(os.path.join(saving_path, 'test_idx.txt'), test_idx, fmt='%d')
        if len(np.shape(label_idx)) == 2:
            np.savetxt(os.path.join(saving_path, 'label_idx.txt'), label_idx, fmt='%d')
            np.savetxt(os.path.join(saving_path, 'unlabel_idx.txt'), unlabel_idx, fmt='%d')
        else:
            np.save(os.path.join(saving_path, 'label_idx.npy'), label_idx)
            np.save(os.path.join(saving_path, 'unlabel_idx.npy'), unlabel_idx)
    else:
        raise Exception("A path to a directory is expected.")
def split_save ( train_idx , test_idx , label_idx , unlabel_idx , path ) : if path is None : return else : if not isinstance ( path , str ) : raise TypeError ( "A string is expected, but received: %s" % str ( type ( path ) ) ) saving_path = os . path . abspath ( path ) if os . path . isdir ( saving_path ) : np . savetxt ( os . path . join ( saving_path , 'train_idx.txt' ) , train_idx , fmt = '%d' ) np . savetxt ( os . path . join ( saving_path , 'test_idx.txt' ) , test_idx , fmt = '%d' ) if len ( np . shape ( label_idx ) ) == 2 : np . savetxt ( os . path . join ( saving_path , 'label_idx.txt' ) , label_idx , fmt = '%d' ) np . savetxt ( os . path . join ( saving_path , 'unlabel_idx.txt' ) , unlabel_idx , fmt = '%d' ) else : np . save ( os . path . join ( saving_path , 'label_idx.npy' ) , label_idx ) np . save ( os . path . join ( saving_path , 'unlabel_idx.npy' ) , unlabel_idx ) else : raise Exception ( "A path to a directory is expected." )