Beispiel #1
0
 def test_illegal_bootstrap_count(self):
     with self.assertRaises(ValueError):
         Bootstrapper(bootstrap_count=0)
     with self.assertRaises(ValueError):
         Bootstrapper(bootstrap_count=-1)
     with self.assertRaises(ValueError):
         Bootstrapper(bootstrap_count=128.256)
Beispiel #2
0
 def __init__(self,
              host,
              port,
              db,
              matrix,
              rel,
              seeds,
              n,
              keep,
              reset,
              scorer,
              it=1):
     self.logger = multiprocessing.get_logger()
     #self.logger.setLevel(logging.DEBUG)
     self.logger.setLevel(logging.INFO)
     #self.logger.setLevel(logging.WARNING)
     if len(self.logger.handlers) == 0:
         handler = logging.StreamHandler()
         handler.setLevel(logging.INFO)
         fmt = '%(asctime)s [%(levelname)s/CPL:' + rel + '] %(message)s'
         formatter = logging.Formatter(fmt)
         handler.setFormatter(formatter)
         self.logger.addHandler(handler)
     self.boot_i = '%s_%s_cpl_i' % (matrix, rel)
     self.boot_p = '%s_%s_cpl_p' % (matrix, rel)
     Bootstrapper.__init__(self, host, port, db, matrix, rel, seeds, n,
                           keep, reset, scorer, it)
Beispiel #3
0
 def __init__(self,
              host,
              port,
              db,
              matrix,
              rel,
              seeds,
              n,
              keep,
              reset,
              scorer,
              it=1):
     #logging.basicConfig()
     self.logger = logging.getLogger('Espresso')
     self.logger.setLevel(logging.INFO)
     #self.logger.setLevel(logging.WARNING)
     if len(self.logger.handlers) == 0:
         handler = logging.StreamHandler()
         handler.setLevel(logging.INFO)
         fmt = '%(asctime)s [%(levelname)s/Espresso:' + rel + '] %(message)s'
         formatter = logging.Formatter(fmt)
         handler.setFormatter(formatter)
         self.logger.addHandler(handler)
     Bootstrapper.__init__(self, host, port, db, matrix, rel, seeds, n,
                           keep, reset, scorer, it)
Beispiel #4
0
 def test_illegal_n_jobs(self):
     with self.assertRaises(ValueError):
         Bootstrapper(n_jobs=0)
     with self.assertRaises(ValueError):
         Bootstrapper(n_jobs=-2)
     with self.assertRaises(ValueError):
         Bootstrapper(n_jobs=1.2)
Beispiel #5
0
 def __init__(self, host, port, db, matrix, rel, seeds, n, keep, reset, scorer, it=1):
     # logging.basicConfig()
     self.logger = logging.getLogger("Espresso")
     self.logger.setLevel(logging.INFO)
     # self.logger.setLevel(logging.WARNING)
     if len(self.logger.handlers) == 0:
         handler = logging.StreamHandler()
         handler.setLevel(logging.INFO)
         fmt = "%(asctime)s [%(levelname)s/Espresso:" + rel + "] %(message)s"
         formatter = logging.Formatter(fmt)
         handler.setFormatter(formatter)
         self.logger.addHandler(handler)
     Bootstrapper.__init__(self, host, port, db, matrix, rel, seeds, n, keep, reset, scorer, it)
Beispiel #6
0
 def __init__(self, host, port, db, matrix, rel,
              seeds, n, keep, reset, scorer, it=1):
     self.logger = multiprocessing.get_logger()
     #self.logger.setLevel(logging.DEBUG)
     self.logger.setLevel(logging.INFO)
     #self.logger.setLevel(logging.WARNING)
     if len(self.logger.handlers) == 0:
         handler = logging.StreamHandler()
         handler.setLevel(logging.INFO)
         fmt = '%(asctime)s [%(levelname)s/CPL:' + rel + '] %(message)s'
         formatter = logging.Formatter(fmt)
         handler.setFormatter(formatter)
         self.logger.addHandler(handler)
     self.boot_i = '%s_%s_cpl_i' % (matrix, rel)
     self.boot_p = '%s_%s_cpl_p' % (matrix, rel)
     Bootstrapper.__init__(
         self, host, port, db, matrix, rel, 
         seeds, n, keep, reset, scorer, it
         )
Beispiel #7
0
    def one_rep_bootstrap(self) -> None:
        self.one_rep()
        loglik = self.res.llf

        bs = Bootstrapper(self.df)
        df_copies = [self.df.copy()] * bs.num_copies
        loglik_copies = [0.] * bs.num_copies
        self.bootstrap_and_refit(bs, df_copies, loglik_copies)

        if loglik < max(loglik_copies):
            max_index = np.argmax(loglik_copies)
            self.df = df_copies[max_index]
    def setUp(self):
        self.number_of_resamples = 10000

        # import dataset from file
        filename = 'flicker.xlsx'
        self.__fh = FileHandling()
        self.original_data_dict = self.__fh.import_spreadsheet(filename)

        # resample dataset
        self.__bootstrapper = Bootstrapper(self.original_data_dict,
                                           self.number_of_resamples)

        #init bootstrap analysis tools
        self.analysis = BootstrapAnalysis(self.__bootstrapper)
    def __init__(self, filename, number_of_resamples=10000):

        """
        Initializing the Bootstrapit class executes the resampling of the imported dataset.
        :param filename: The filename including filepath to the import data file.
        :param number_of_resamples: The number of resamples to perform.
        """
        self.number_of_resamples = number_of_resamples

        # import dataset from file
        self.__fh = FileHandling()
        self.original_data_dict = self.__fh.import_spreadsheet(filename)

        # resample dataset
        self.__bootstrapper = Bootstrapper(self.original_data_dict, number_of_resamples)

        #init bootstrap analysis tools
        self.__analysis = BootstrapAnalysis(self.__bootstrapper)

        #init plotter
        self.__plotter = Plotting(self.__fh.export_order)
Beispiel #10
0
from flask import Flask, render_template, request, Response
import qbittorrentapi
from bootstrapper import Status, Bootstrapper

app = Flask(__name__)
app.config['DEBUG'] = True

bs = Bootstrapper()


@app.route("/")
def index():
    return render_template("index.html")


@app.route("/bootstrap", methods=['POST'])
def bootstrap():
    if bs is not None and bs.is_working():
        res = Response()
        return res, 102
    bs.bootstrap(request.json['magnet'])
    return " ".join(["OK", bs.token])


@app.route("/status")
def status():
    if bs is None:
        return "0 IDLE"
    else:
        return " ".join([bs.get_status(), bs.get_status_string()])
Beispiel #11
0
 def test_full_argument(self):
     Bootstrapper(n_jobs=2, bootstrap_count=256)
Beispiel #12
0
 def test_emtpy_argument(self):
     Bootstrapper()
Beispiel #13
0
def main():
    bootstrapper = Bootstrapper()
    bootstrapper.initialize()

    tests = Tests()
    tests.run()