How to use the scitime._log.LogMixin function in scitime

To help you get started, we’ve selected a few scitime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nathan-toubiana / scitime / scitime / _log.py View on Github external
def timeit(method):
    """takes method and wraps it in a timer"""
    log = LogMixin()

    def timed(*args, **kw):
        ts = time.time()
        result = method(*args, **kw)
        te = time.time()

        log.logger.info(f'''{method.__qualname__} took
        {round(te - ts, 3)}s seconds''')

        return result

    timed.__name__ = method.__name__
    timed.__doc__ = method.__doc__

    return timed
github nathan-toubiana / scitime / scitime / estimate.py View on Github external
import os
import psutil

import joblib
import pandas as pd
import numpy as np
import time
import json
from scipy import stats

import warnings

warnings.simplefilter("ignore")


class Estimator(LogMixin):
    # default meta-algorithm
    META_ALGO = 'RF'
    # bins to consider for computing confindence intervals (for NN meta algo)
    BINS = [(1, 5), (5, 30), (30, 60), (60, 10 * 60)]
    BINS_VERBOSE = ['less than 1s',
                    'between 1s and 5s',
                    'between 5s and 30s',
                    'between 30s and 1m',
                    'between 1m and 10m',
                    'more than 10m']

    def __init__(self, meta_algo=META_ALGO, verbose=3, confidence=0.95):
        self.meta_algo = meta_algo
        self.verbose = verbose
        self.confidence = confidence
        self.bins = self.BINS, self.BINS_VERBOSE

scitime

Training time estimator for scikit-learn algorithms

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis