From e653a5ea1c0b62ff073b017a597e51f429ec569a Mon Sep 17 00:00:00 2001 From: Lieke Michielsen Date: Tue, 30 Apr 2024 12:42:17 +0200 Subject: [PATCH] Update predict.py --- scHPL/predict.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scHPL/predict.py b/scHPL/predict.py index 3ba174a..a7af3de 100644 --- a/scHPL/predict.py +++ b/scHPL/predict.py @@ -7,7 +7,10 @@ import numpy as np from numpy import linalg as LA from .utils import TreeNode -from .faissKNeighbors import FaissKNeighbors +try: + from .faissKNeighbors import FaissKNeighbors +except: + None try: from tqdm import tqdm except ImportError: @@ -58,11 +61,14 @@ def predict_labels(testdata, pca, pcs = tree[0].get_pca() testdata = pca.transform(testdata) dimred = True - - if (tree[0].classifier and - tree[0].classifier.__class__ == FaissKNeighbors and - gpu is not None): - tree[0].classifier.to_gpu(gpu) + + try: + if (tree[0].classifier and + tree[0].classifier.__class__ == FaissKNeighbors and + gpu is not None): + tree[0].classifier.to_gpu(gpu) + except: + None labels_all = [] prob_all = np.zeros((np.shape(testdata)[0],1))