<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calculate_relevance_table(X, y, ml_task='auto', n_jobs=defaults.N_PROCESSES, chunksize=defaults.CHUNKSIZE, test_for_binary_target_binary_feature=defaults.TEST_FOR_BINARY_TARGET_BINARY_FEATURE, test_for_binary_target_real_feature=defaults.TEST_FOR_BINARY_TARGET_REAL_FEATURE, test_for_real_target_binary_feature=defaults.TEST_FOR_REAL_TARGET_BINARY_FEATURE, test_for_real_target_real_feature=defaults.TEST_FOR_REAL_TARGET_REAL_FEATURE, fdr_level=defaults.FDR_LEVEL, hypotheses_independent=defaults.HYPOTHESES_INDEPENDENT):
 """ Calculate the relevance table for the features contained in feature matrix `X` with respect to target vector `y`. The relevance table is calculated for the intended machine learning task `ml_task`. To accomplish this for each feature from the input pandas.DataFrame an univariate feature significance test is conducted. Those tests generate p values that are then evaluated by the Benjamini Hochberg procedure to decide which features to keep and which to delete. We are testing :math:`H_0` = the Feature is not relevant and should not be added against :math:`H_1` = the Feature is relevant and should be kept or in other words :math:`H_0` = Target and Feature are independent / the Feature has no influence on the target :math:`H_1` = Target and Feature are associated / dependent When the target is binary this becomes :math:`H_0 = \\left( F_{\\text{target}=1} = F_{\\text{target}=0} \\right)` :math:`H_1 = \\left( F_{\\text{target}=1} \\neq F_{\\text{target}=0} \\right)` Where :math:`F` is the distribution of the target. In the same way we can state the hypothesis when the feature is binary :math:`H_0 = \\left( T_{\\text{feature}=1} = T_{\\text{feature}=0} \\right)` :math:`H_1 = \\left( T_{\\text{feature}=1} \\neq T_{\\text{feature}=0} \\right)` Here :math:`T` is the distribution of the target. TODO: And for real valued? :param X: Feature matrix in the format mentioned before which will be reduced to only the relevant features. It can contain both binary or real-valued features at the same time. :type X: pandas.DataFrame :param y: Target vector which is needed to test which features are relevant. Can be binary or real-valued. :type y: pandas.Series or numpy.ndarray :param ml_task: The intended machine learning task. Either `'classification'`, `'regression'` or `'auto'`. Defaults to `'auto'`, meaning the intended task is inferred from `y`. If `y` has a boolean, integer or object dtype, the task is assumend to be classification, else regression. :type ml_task: str :param test_for_binary_target_binary_feature: Which test to be used for binary target, binary feature (currently unused) :type test_for_binary_target_binary_feature: str :param test_for_binary_target_real_feature: Which test to be used for binary target, real feature :type test_for_binary_target_real_feature: str :param test_for_real_target_binary_feature: Which test to be used for real target, binary feature (currently unused) :type test_for_real_target_binary_feature: str :param test_for_real_target_real_feature: Which test to be used for real target, real feature (currently unused) :type test_for_real_target_real_feature: str :param fdr_level: The FDR level that should be respected, this is the theoretical expected percentage of irrelevant features among all created features. :type fdr_level: float :param hypotheses_independent: Can the significance of the features be assumed to be independent? Normally, this should be set to False as the features are never independent (e.g. mean and median) :type hypotheses_independent: bool :param n_jobs: Number of processes to use during the p-value calculation :type n_jobs: int :param chunksize: The size of one chunk that is submitted to the worker process for the parallelisation. Where one chunk is defined as a singular time series for one id and one kind. If you set the chunksize to 10, then it means that one task is to calculate all features for 10 time series. If it is set it to None, depending on distributor, heuristics are used to find the optimal chunksize. If you get out of memory exceptions, you can try it with the dask distributor and a smaller chunksize. :type chunksize: None or int :return: A pandas.DataFrame with each column of the input DataFrame X as index with information on the significance of this particular feature. The DataFrame has the columns "Feature", "type" (binary, real or const), "p_value" (the significance of this feature as a p-value, lower means more significant) "relevant" (True if the Benjamini Hochberg procedure rejected the null hypothesis [the feature is not relevant] for this feature) :rtype: pandas.DataFrame """

    if ml_task not in ['auto', 'classification', 'regression']:
        raise ValueError('ml_task must be one of: \'auto\', \'classification\', \'regression\'')
    elif ml_task == 'auto':
        ml_task = infer_ml_task(y)

    if n_jobs == 0:
        map_function = map
    else:
        pool = Pool(n_jobs)
        map_function = partial(pool.map, chunksize=chunksize)

    relevance_table = pd.DataFrame(index=pd.Series(X.columns, name='feature'))
    relevance_table['feature'] = relevance_table.index
    relevance_table['type'] = pd.Series(
        map_function(get_feature_type, [X[feature] for feature in relevance_table.index]),
        index=relevance_table.index
    )
    table_real = relevance_table[relevance_table.type == 'real'].copy()
    table_binary = relevance_table[relevance_table.type == 'binary'].copy()

    table_const = relevance_table[relevance_table.type == 'constant'].copy()
    table_const['p_value'] = np.NaN
    table_const['relevant'] = False

    if len(table_const) == len(relevance_table):
        return table_const

    if ml_task == 'classification':
        tables = []
        for label in y.unique():
            _test_real_feature = partial(target_binary_feature_real_test, y=(y == label),
                                              test=test_for_binary_target_real_feature)
            _test_binary_feature = partial(target_binary_feature_binary_test, y=(y == label))
            tmp = _calculate_relevance_table_for_implicit_target(
                table_real, table_binary, X, _test_real_feature, _test_binary_feature, hypotheses_independent,
                fdr_level, map_function
            )
            tables.append(tmp)
        relevance_table = combine_relevance_tables(tables)
    elif ml_task == 'regression':
        _test_real_feature = partial(target_real_feature_real_test, y=y)
        _test_binary_feature = partial(target_real_feature_binary_test, y=y)
        relevance_table = _calculate_relevance_table_for_implicit_target(
            table_real, table_binary, X, _test_real_feature, _test_binary_feature, hypotheses_independent, fdr_level,
            map_function
        )

    relevance_table = pd.concat([relevance_table, table_const], axis=0)

    if n_jobs != 0:
        pool.close()
        pool.terminate()
        pool.join()

    if sum(relevance_table['relevant']) == 0:
        _logger.warning("No feature was found relevant for {} for fdr level = {}. "
                        "Consider using a lower fdr level or other features.".format(ml_task, fdr_level))

    return relevance_table