def check_fit(self): """Assert that the object is fit Raises a `NotFittedError` if the model is not fitted. """ if not self.fitted: raise NotFittedError("This model is not fitted.")
def check_fit(self): """Assert that the model is fit and the computed `theta` is valid. Raises a `NotFittedError` if the model is not fitted. Raises a `ValueError` if the computed theta is invalid.""" if not self.theta: raise NotFittedError("This model is not fitted.") self.check_theta()
def sample_all(self, num_rows=5): """Sample the whole dataset. Args: num_rows (int): Amount of rows to sample. """ if self.sampler is None: raise NotFittedError('SDV instance has not been fitted') return self.sampler.sample_all(num_rows)
def sample_table(self, table_name): """Samples the given table to its original size. Args: table_name (str): Table to sample. """ if self.sampler is None: raise NotFittedError('SDV instance has not been fitted') return self.sampler.sample_table(table_name)
def check_fit(self): """Check whether this model has already been fit to a random variable. Raise a ``NotFittedError`` if it has not. Raises: NotFittedError: if the model is not fitted. """ if not self.fitted: raise NotFittedError("This model is not fitted.")
def sample_rows(self, table_name, num_rows): """Sample `num_rows` rows from the given table. Args: table_name(str): Name of the table to sample from. num_rows(int): Amount of rows to sample. """ if self.sampler is None: raise NotFittedError('SDV instance has not been fitted') return self.sampler.sample_rows(table_name, num_rows)
def sample_all(self, num_rows=5, reset_primary_keys=False): """Sample the whole dataset. Args: num_rows(int): Amount of rows to sample. reset_primary_keys(bool): Wheter or not reset the pk generators. """ if self.sampler is None: raise NotFittedError('SDV instance has not been fitted') return self.sampler.sample_all(num_rows, reset_primary_keys=reset_primary_keys)
def sample_table(self, table_name, reset_primary_keys=False): """Samples the given table to its original size. Args: table_name (str): Table to sample. reset_primary_keys(bool): Wheter or not reset the pk generators. """ if self.sampler is None: raise NotFittedError('SDV instance has not been fitted') return self.sampler.sample_table(table_name, reset_primary_keys=reset_primary_keys)
def sample_rows(self, table_name, num_rows, reset_primary_keys=False): """Sample `num_rows` rows from the given table. Args: table_name(str): Name of the table to sample from. num_rows(int): Amount of rows to sample. reset_primary_keys(bool): Wheter or not reset the pk generators. """ if self.sampler is None: raise NotFittedError('SDV instance has not been fitted') return self.sampler.sample_rows(table_name, num_rows, reset_primary_keys=reset_primary_keys)