def compute(<EOL>self, X: DataFrame, Y: Series=None,<EOL>column_types: Dict[str, str]=None, metafeature_ids: List=None,<EOL>exclude: List=None, sample_shape=None, seed=None, n_folds=<NUM_LIT:2>,<EOL>verbose=False, timeout=None<EOL>) -> dict:
start_time = time.time()<EOL>self._validate_compute_arguments(<EOL>X, Y, column_types, metafeature_ids, exclude, sample_shape, seed,<EOL>n_folds, verbose<EOL>)<EOL>if timeout is None:<EOL><INDENT>def check_time():<EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>def check_time():<EOL><INDENT>if time.time() - start_time > timeout:<EOL><INDENT>raise TimeoutError()<EOL><DEDENT><DEDENT><DEDENT>self._check_timeout = check_time<EOL>if column_types is None:<EOL><INDENT>column_types = self._infer_column_types(X, Y)<EOL><DEDENT>if metafeature_ids is None:<EOL><INDENT>metafeature_ids = self._get_metafeature_ids(exclude)<EOL>exclude = None<EOL><DEDENT>if sample_shape is None:<EOL><INDENT>sample_shape = (None, None)<EOL><DEDENT>if seed is None:<EOL><INDENT>seed = np.random.randint(np.iinfo(np.int32).max)<EOL><DEDENT>self._validate_compute_arguments(<EOL>X, Y, column_types, metafeature_ids, exclude, sample_shape, seed,<EOL>n_folds, verbose<EOL>)<EOL>self._init_resources(<EOL>X, Y, column_types, sample_shape, seed, n_folds<EOL>)<EOL>computed_metafeatures = {name: {self.VALUE_KEY: self.TIMEOUT, self.COMPUTE_TIME_KEY: <NUM_LIT:0>}<EOL>for name in metafeature_ids}<EOL>try:<EOL><INDENT>for metafeature_id in metafeature_ids:<EOL><INDENT>self._check_timeout()<EOL>if verbose:<EOL><INDENT>print(metafeature_id)<EOL><DEDENT>if self._resource_is_target_dependent(metafeature_id) and (<EOL>Y is None or column_types[Y.name] == self.NUMERIC<EOL>):<EOL><INDENT>if Y is None:<EOL><INDENT>value = self.NO_TARGETS<EOL><DEDENT>else:<EOL><INDENT>value = self.NUMERIC_TARGETS<EOL><DEDENT>compute_time = None<EOL><DEDENT>else:<EOL><INDENT>value, compute_time = self._get_resource(metafeature_id)<EOL><DEDENT>computed_metafeatures[metafeature_id] = {<EOL>self.VALUE_KEY: value,<EOL>self.COMPUTE_TIME_KEY: compute_time<EOL>}<EOL><DEDENT><DEDENT>except TimeoutError:<EOL><INDENT>pass<EOL><DEDENT>return computed_metafeatures<EOL>
Parameters
----------
X: pandas.DataFrame, the dataset features
Y: pandas.Series, the dataset targets
column_types: Dict[str, str], dict from column name to column type as
    "NUMERIC" or "CATEGORICAL" or "TEXT", must include Y column
metafeature_ids: list, the metafeatures to compute. default of None
    indicates to compute all metafeatures
exclude: list, default None. The metafeatures to be excluded from computation.
    Must be None if metafeature_ids is not None.
sample_shape: tuple, the shape of X after sampling (X,Y) uniformly.
    Default is (None, None), indicate not to sample rows or columns.
seed: int, the seed used to generate pseudo-random numbers. when None
    is given, a seed will be generated pseudo-randomly. this can be
    used for reproducibility of metafeatures. a generated seed can be
    accessed through the 'seed' property, after calling this method.
n_folds: int, the number of cross validation folds used by the
    landmarking metafeatures. also affects the sample_shape validation
verbose: bool, default False. When True, prints the ID of each
    metafeature right before it is about to be computed.
timeout: float, default None. If timeout is None, compute_metafeatures
    will be run to completion. Otherwise, execution will halt after
    approximately timeout seconds. Any metafeatures that have not been
    computed will be labeled 'TIMEOUT'.

Returns
-------
A dictionary mapping the metafeature id to another dictionary containing
the `value` and `compute_time` (if requested) of the referencing
metafeature. The value is typically a number, but can be a string
indicating a reason why the value could not be computed.