예제 #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)
예제 #2
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)
예제 #3
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)
예제 #5
0
    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)
예제 #6
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()])
예제 #7
0
 def test_full_argument(self):
     Bootstrapper(n_jobs=2, bootstrap_count=256)
예제 #8
0
 def test_emtpy_argument(self):
     Bootstrapper()