Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.estimator_metarf = Estimator(meta_algo='RF', verbose=0)
self.estimator_metann = Estimator(meta_algo='NN', verbose=0)
def setUp(self):
self.estimator_metarf = Estimator(meta_algo='RF', verbose=0)
self.estimator_metann = Estimator(meta_algo='NN', verbose=0)
from sklearn.ensemble import RandomForestRegressor
from sklearn.neural_network import MLPRegressor
from sklearn.metrics import r2_score, mean_squared_error
from sklearn.model_selection import train_test_split, RandomizedSearchCV
from sklearn.preprocessing import StandardScaler
import warnings
warnings.simplefilter("ignore")
from scitime.estimate import Estimator
from scitime._utils import get_path, config
from scitime._log import LogMixin, timeit
class Model(Estimator, LogMixin):
# default meta-algorithm
META_ALGO = 'RF'
# the drop rate is used to fit the meta-algo on random parameters
DROP_RATE = 0.9
# the default estimated algorithm is a Random Forest from sklearn
ALGO = 'RandomForestRegressor'
def __init__(self, drop_rate=DROP_RATE, meta_algo=META_ALGO, algo=ALGO, verbose=0, bins=None):
# the end user will estimate the fitting time of self.algo using the package
super().__init__(bins)
self.algo = algo
self.drop_rate = drop_rate
self.meta_algo = meta_algo
self.verbose = verbose
if self.verbose >= 2:
self.logger.info(f'Model object created with verbose={self.verbose}, algo={self.algo}, meta_algo={self.meta_algo} and drop_rate={self.drop_rate}')