def set_nthreads(nthreads): """ set_nthreads(nthreads) Sets the number of threads to be used during bcolz operation. This affects to both Blosc and Numexpr (if available). If you want to change this number only for Blosc, use `blosc_set_nthreads` instead. Parameters ---------- nthreads : int The number of threads to be used during bcolz operation. Returns ------- out : int The previous setting for the number of threads. See Also -------- blosc_set_nthreads """ nthreads_old = bcolz.blosc_set_nthreads(nthreads) if bcolz.numexpr_here: bcolz.numexpr.set_num_threads(nthreads) return nthreads_old
import time from tqdm import tqdm import h5py # for saving later usable files import gc from glob import glob from sklearn.metrics import fbeta_score from sklearn.model_selection import StratifiedKFold import tensorflow as tf import cv2 import bcolz bcolz.blosc_set_nthreads(4) bcolz.numexpr.set_num_threads(4) #from joblib import Parallel, delayed import image_ml_ext #modified ImageDataGenerator import random random_seed = 2017 random.seed(random_seed) np.random.seed(random_seed) def f2_score(y_true, y_pred): # from https://www.kaggle.com/teasherm/keras-metric-for-f-score-tf-only y_true = tf.cast(y_true, "int32") y_pred = tf.cast(tf.round(y_pred), "int32") # implicit 0.5 threshold via tf.round
""" from __future__ import absolute_import import os import sys sys.setrecursionlimit(8192) import time import re import shutil import zlib import numpy as np import bcolz import numexpr as ne bcolz.blosc_set_nthreads(2) ne.set_num_threads(2) import sqlalchemy as sql from . import database from . import compression from .gemini_utils import get_gt_cols def get_samples(metadata): return [x['name'] for x in metadata.tables['samples'].select().order_by("sample_id").execute()] def get_n_variants(cur): return next(iter(cur.execute(sql.text("select count(*) from variants"))))[0] def get_bcolz_dir(db): if not "://" in db: