def __init__(self, n_trees: int = 10, step: float = 1., criterion: str = 'unif', max_depth: int = -1, min_samples_split: int = 50, n_threads: int = 1, seed: int = -1, verbose: bool = True, warm_start: bool = True, n_splits: int = 10): Base.__init__(self) if not hasattr(self, "_actual_kwargs"): self._actual_kwargs = {} self._fitted = False self.n_trees = n_trees self.step = step self.criterion = criterion self.max_depth = max_depth self.min_samples_split = min_samples_split self.n_threads = n_threads self.seed = seed self.verbose = verbose self.warm_start = warm_start self.n_splits = n_splits self._forest = _OnlineForestRegressor( n_trees, step, self._criterion, #max_depth, # min_samples_split, n_threads, seed, verbose)
def __init__(self): Base.__init__(self) self._minimum_col_width = 9 self.print_order = ["n_iter", "obj", "step", "rel_obj"] # Instantiate values of the history self._clear() self._minimizer = None self._minimum = None self._set("values", None) self._col_widths = None self._n_iter = None # History function to compute history values based on parameters # used in a solver history_func = {} self._history_func = history_func # Default print style of history values. Default is %.2e print_style = defaultdict(lambda: "%.2e") print_style["n_iter"] = "%d" print_style["n_epoch"] = "%d" print_style["n_inner_prod"] = "%d" print_style["spars"] = "%d" print_style["rank"] = "%d" self._print_style = print_style
def __init__(self): Base.__init__(self) self._fitted = False self._model = None setattr(self, N_CALLS_LOSS, 0) setattr(self, PASS_OVER_DATA, 0) self.dtype = None
def __init__(self, n_lags=0, n_jobs=-1): Base.__init__(self) if n_lags < 0: raise ValueError("`n_lags` should be non-negative.") self.n_lags = n_lags self.n_jobs = n_jobs self._cpp_preprocessor = None self._reset()
def __init__(self, exposure_type="infinite", n_threads=-1): Base.__init__(self) if exposure_type not in ["infinite", "short"]: raise ValueError("exposure_type should be either 'infinite' or\ 'short', not %s" % exposure_type) self.n_threads = n_threads self.exposure_type = exposure_type self._reset()
def __init__(self, penalty='l2', C=1e3, solver="svrg", step=None, tol=1e-5, max_iter=100, verbose=True, warm_start=False, print_every=10, record_every=10, sdca_ridge_strength=1e-3, elastic_net_ratio=0.95, random_state=None, blocks_start=None, blocks_length=None, extra_model_kwargs=None, extra_prox_kwarg=None): Base.__init__(self) if not hasattr(self, "_actual_kwargs"): self._actual_kwargs = {} # Construct the model if extra_model_kwargs is None: extra_model_kwargs = {} self._model_obj = self._construct_model_obj(**extra_model_kwargs) # Construct the solver. The solver is created at creation of the # learner, and cannot be instantiated again (using another solver type) # afterwards. self.solver = solver self._set_random_state(random_state) self._solver_obj = self._construct_solver_obj( solver, step, max_iter, tol, print_every, record_every, verbose, sdca_ridge_strength) # Construct the prox. The prox is created at creation of the # learner, and cannot be instantiated again (using another prox type) # afterwards. self.penalty = penalty if extra_prox_kwarg is None: extra_prox_kwarg = {} self._prox_obj = self._construct_prox_obj(penalty, elastic_net_ratio, blocks_start, blocks_length, extra_prox_kwarg) # Set C after creating prox to set prox strength if 'C' in self._actual_kwargs or penalty != 'none': # Print self.C = C self.C = C self.record_every = record_every self.step = step self._fitted = False self.warm_start = warm_start if 'sdca_ridge_strength' in self._actual_kwargs or solver == 'sdca': self.sdca_ridge_strength = sdca_ridge_strength if 'elastic_net_ratio' in self._actual_kwargs or \ penalty == 'elasticnet': self.elastic_net_ratio = elastic_net_ratio if 'blocks_start' in self._actual_kwargs or penalty == 'binarsity': self.blocks_start = blocks_start if 'blocks_length' in self._actual_kwargs or penalty == 'binarsity': self.blocks_length = blocks_length
def __init__(self, epoch_size: int=None, rand_type: str="unif", seed=-1): Base.__init__(self) # The C++ wrapped solver is to be given in child classes self._solver = None self._rand_type = None self._rand_max = None self.epoch_size = epoch_size self.rand_type = rand_type self.seed = seed
def __init__(self, seed: int = None, verbose: bool = True): Base.__init__(self) self.seed = seed self.verbose = verbose if seed is not None and seed >= 0: self._set_seed() self._set("time_start", None) self._set("time_elapsed", None) self._set("time_end", None) self._set("_time_start", None)
def __init__(self, method="quantile", n_cuts=10, detect_column_type="auto", remove_first=False, bins_boundaries=None): Base.__init__(self) self.method = method self.n_cuts = n_cuts self.detect_column_type = detect_column_type self.remove_first = remove_first self.bins_boundaries = bins_boundaries self.reset()
def __init__(self, n_classes: int, n_trees: int = 10, step: float = 1., criterion: str = 'log', use_aggregation: bool = True, dirichlet: float = None, split_pure: bool = False, max_nodes: int = None, min_extension_size: float = 0, min_samples_split: int = -1, max_features: int = -1, n_threads: int = 1, use_feature_importances=True, seed: int = -1, verbose: bool = True, print_every=1000, memory: int = 512): Base.__init__(self) if not hasattr(self, "_actual_kwargs"): self._actual_kwargs = {} self._fitted = False self.n_trees = n_trees self.n_features = None self.n_classes = n_classes self.step = step self.criterion = criterion self.split_pure = split_pure if max_nodes is not None: self.max_nodes = max_nodes else: self.max_nodes = -1 self.min_extension_size = min_extension_size self.min_samples_split = min_samples_split self.max_features = max_features self.n_threads = n_threads self._forest = None self._given_feature_importances = None self._feature_importances_type = None self.use_feature_importances = use_feature_importances self.seed = seed self.verbose = verbose self.print_every = print_every self.use_aggregation = use_aggregation self._forest = None if dirichlet is None: if self.n_classes == 2: self.dirichlet = 0.5 else: self.dirichlet = 0.01 else: self.dirichlet = dirichlet self._set('_memory', memory)
def __init__(self, n_lags: np.array, penalized_features: np.array = None, C_tv=None, C_group_l1=None, step: float = None, tol: float = 1e-5, max_iter: int = 100, verbose: bool = False, print_every: int = 10, record_every: int = 10, random_state: int = None): Base.__init__(self) # Init objects to be computed later self.n_cases = None self.n_intervals = None self.n_features = None self.n_coeffs = None self._coeffs = None self.confidence_intervals = Confidence_intervals( list(), list(), list(), None) self._fitted = None self._step_size = None # Init user defined parameters self._features_offset = None self._n_lags = None self.n_lags = n_lags self._penalized_features = None self.penalized_features = penalized_features self._C_tv = None self._C_group_l1 = None self.C_tv = C_tv self.C_group_l1 = C_group_l1 self._step_size = step self.tol = tol self.max_iter = max_iter self.verbose = verbose, self.print_every = print_every self.record_every = record_every random_state = int( np.random.randint(0, 1000, 1 )[0] if random_state is None else random_state) self._random_state = None self.random_state = random_state # Construct objects self._preprocessor_obj = self._construct_preprocessor_obj() self._model_obj = None self._solver_obj = self._construct_solver_obj(step, max_iter, tol, print_every, record_every, verbose, random_state)
def __init__(self, integration_support=100.): Base.__init__(self) self.integration_support = integration_support self._learner = _HawkesCumulant(self.integration_support) self.L = None self.C = None self.K_c = None self._L_day = None self._J = None self._events_of_cumulants = None
def __init__(self, x0: int, arg0, y0: float = 0., kwarg0='string'): Base.__init__(self) self.set_x0(x0) self.y0 = y0 self.creation_time = self._get_now() self._prop0 = None # Two flags to know weather getter and setters have been called self._getter_called = False self._setter_called = False self._a0 = _A0() # Test that we can assign fields only declared in __init__ self.arg0 = arg0 self.kwarg0 = kwarg0
def __init__(self, tol=0., max_iter=100, verbose=True, print_every=10, record_every=1): Base.__init__(self) self.tol = tol self.max_iter = max_iter self.verbose = verbose self.print_every = print_every self.record_every = record_every # Create an history object which deals with printing information # along the optimization loop, and stores information self.history = History() self.time_start = None self._time_start = None self.time_elapsed = None self.time_end = None self.solution = None
def __init__(self): Base.__init__(self) self._kernel = _HawkesKernel()
def _as_dict(self): dd = Base._as_dict(self) dd.pop("intercept", None) dd.pop("weights", None) return dd
def __init__(self, range: tuple = None): Base.__init__(self) self._range = None self._prox = None self.range = range
def _as_dict(self): dd = Base._as_dict(self) dd.pop("values", None) return dd
def _as_dict(self): dd = Base._as_dict(self) dd.pop("coeffs", None) return dd
def __init__(self, delta_lag=.1, min_lag=1e-4, max_lag=40, n_quad=50, max_support=40, min_support=1e-4, quad_method='gauss', marked_components=None, delayed_component=None, delay=0.00001, model=None, n_threads=1, claw_method='lin'): Base.__init__(self) # Init the claw sampling parameters self.delta_lag = delta_lag self.max_lag = max_lag self.min_lag = min_lag self.claw_method = claw_method # Init quadrature method self.quad_method = quad_method self.n_quad = n_quad self.min_support = min_support self.max_support = max_support # Init marked components if marked_components is None: marked_components = dict() self.marked_components = marked_components # Init attributes self.n_realizations = 0 self._lags = None self._compute_lags() self.symmetries1d = [] self.symmetries2d = [] self.delayed_component = np.array(delayed_component) self.delay = delay # _claw : list of 2-tuple # Represents the conditional laws written above (lexical order on i, # j and l, see below). Each conditional law is represented by a # pair (x, c) where x are the abscissa self._claw = None # _claw1 : list of list # Represents the conditional laws written above without conditioning by # the mark (so a i,j list) self._claw1 = None self._lock = None # quad_x : `np.ndarray`, shape=(n_quad, ) # The abscissa of the quadrature points used for the Fredholm system self._quad_x = None # quad_w : `np.ndarray`, shape=(n_quad, ) # The weights the quadrature points used for the Fredholm system self._quad_w = None self._phi_ijl, self._norm_ijl = None, None self.kernels, self.kernels_norms, self.baseline = None, None, None self.mark_functions = None if n_threads == -1: import multiprocessing n_threads = multiprocessing.cpu_count() self.n_threads = n_threads if model: self.set_model(model)
def __init__(self, n_jobs=-1): Base.__init__(self) self.n_jobs = n_jobs