How to use scitime - 10 common examples

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 / testing / test_train.py View on Github external
def setUp(self):
        self.rf_trainer_metarf = Model(drop_rate=1,
                                       verbose=3,
                                       algo='RandomForestRegressor',
                                       meta_algo='RF')

        self.svc_trainer_metarf = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='RF')

        self.km_trainer_metarf = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='RF')

        self.rf_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='RandomForestRegressor',
                                       meta_algo='NN')

        self.svc_trainer_metann = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='NN')

        self.km_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='NN')
github nathan-toubiana / scitime / testing / test_train.py View on Github external
def setUp(self):
        self.rf_trainer_metarf = Model(drop_rate=1,
                                       verbose=3,
                                       algo='RandomForestRegressor',
                                       meta_algo='RF')

        self.svc_trainer_metarf = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='RF')

        self.km_trainer_metarf = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='RF')

        self.rf_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='RandomForestRegressor',
                                       meta_algo='NN')

        self.svc_trainer_metann = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='NN')

        self.km_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='NN')
github nathan-toubiana / scitime / testing / test_train.py View on Github external
verbose=3,
                                       algo='RandomForestRegressor',
                                       meta_algo='RF')

        self.svc_trainer_metarf = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='RF')

        self.km_trainer_metarf = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='RF')

        self.rf_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='RandomForestRegressor',
                                       meta_algo='NN')

        self.svc_trainer_metann = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='NN')

        self.km_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='NN')
github nathan-toubiana / scitime / testing / test_train.py View on Github external
def setUp(self):
        self.rf_trainer_metarf = Model(drop_rate=1,
                                       verbose=3,
                                       algo='RandomForestRegressor',
                                       meta_algo='RF')

        self.svc_trainer_metarf = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='RF')

        self.km_trainer_metarf = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='RF')

        self.rf_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='RandomForestRegressor',
                                       meta_algo='NN')

        self.svc_trainer_metann = Model(drop_rate=1,
github nathan-toubiana / scitime / testing / test_train.py View on Github external
self.svc_trainer_metarf = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='RF')

        self.km_trainer_metarf = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='RF')

        self.rf_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='RandomForestRegressor',
                                       meta_algo='NN')

        self.svc_trainer_metann = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='NN')

        self.km_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='NN')
github nathan-toubiana / scitime / testing / test_train.py View on Github external
def setUp(self):
        self.rf_trainer_metarf = Model(drop_rate=1,
                                       verbose=3,
                                       algo='RandomForestRegressor',
                                       meta_algo='RF')

        self.svc_trainer_metarf = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='RF')

        self.km_trainer_metarf = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='RF')

        self.rf_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='RandomForestRegressor',
                                       meta_algo='NN')

        self.svc_trainer_metann = Model(drop_rate=1,
                                        verbose=3, algo='SVC', meta_algo='NN')

        self.km_trainer_metann = Model(drop_rate=1,
                                       verbose=3, algo='KMeans',
                                       meta_algo='NN')
github nathan-toubiana / scitime / testing / test_estimator.py View on Github external
def setUp(self):
        self.estimator_metarf = Estimator(meta_algo='RF', verbose=0)
        self.estimator_metann = Estimator(meta_algo='NN', verbose=0)
github nathan-toubiana / scitime / testing / test_estimator.py View on Github external
def setUp(self):
        self.estimator_metarf = Estimator(meta_algo='RF', verbose=0)
        self.estimator_metann = Estimator(meta_algo='NN', verbose=0)
github nathan-toubiana / scitime / scitime / _model.py View on Github external
train_test_split(X, y, test_size=0.20, random_state=42)

        if self.meta_algo == 'NN':
            X_train_scaled, X_test_scaled = \
                self._scale_data(X_train, X_test, save_model)

            meta_algo.fit(X_train_scaled, y_train)

        else:
            meta_algo.fit(X_train, y_train)

        if save_model:
            if self.verbose >= 2:
                self.logger.info(f'''Saving {self.meta_algo} to {self.meta_algo}_{self.algo}_estimator.pkl''')

            model_path = f'''{get_path("models")}/{self.meta_algo}_{self.algo}_estimator.pkl'''

            joblib.dump(meta_algo, model_path)

            json_path = f'''{get_path("models")}/{self.meta_algo}_{self.algo}_estimator.json'''

            with open(json_path, 'w') as outfile:
                json.dump({"dummy": list(cols),
                           "original": list(original_cols)}, outfile)

        if self.meta_algo == 'NN':
            if self.verbose >= 2:
                self.logger.info(f'''R squared on train set is {r2_score(y_train, meta_algo.predict(X_train_scaled))}''')

            # MAPE is the mean absolute percentage error
            test_relu = [max(i, 0) for i in meta_algo.predict(X_test_scaled)]
            train_relu = [max(i, 0) for i in meta_algo.predict(X_train_scaled)]
github nathan-toubiana / scitime / scitime / _model.py View on Github external
saves the scaler as a pkl file if specified

        :param X_train: pd.DataFrame chosen as input for the training set
        :param X_test: pd.DataFrame chosen as input for the test set
        :param save_model: boolean set to True if the model needs to be saved
        :return: X_train and X_test data scaled
        :rtype: pd.DataFrame
        """
        scaler = StandardScaler()
        scaler.fit(X_train)

        if save_model:
            if self.verbose >= 2:
                self.logger.info(f'''Saving scaler model to scaler_{self.algo}_estimator.pkl''')

            model_path = f'''{get_path("models")}/scaler_{self.algo}_estimator.pkl'''
            joblib.dump(scaler, model_path)

        X_train_scaled = scaler.transform(X_train)
        X_test_scaled = scaler.transform(X_test)

        return X_train_scaled, X_test_scaled

scitime

Training time estimator for scikit-learn algorithms

BSD-3-Clause
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis