h2o-py/h2o/h2o.py
def interaction(data, factors, pairwise, max_factors, min_occurrence, destination_frame=None):
    """
    Categorical Interaction Feature Creation in H2O.

    Creates a frame in H2O with n-th order interaction features between categorical columns, as specified by
    the user.

    :param data: the H2OFrame that holds the target categorical columns.
    :param factors: factor columns (either indices or column names).
    :param pairwise: If True, create pairwise interactions between factors (otherwise create one
        higher-order interaction). Only applicable if there are 3 or more factors.
    :param max_factors: Max. number of factor levels in pair-wise interaction terms (if enforced, one extra
        catch-all factor will be made).
    :param min_occurrence: Min. occurrence threshold for factor levels in pair-wise interaction terms
    :param destination_frame: a string indicating the destination key. If empty, this will be auto-generated by H2O.

    :returns: :class:`H2OFrame`
    """
    assert_is_type(data, H2OFrame)
    assert_is_type(factors, [str, int])
    assert_is_type(pairwise, bool)
    assert_is_type(max_factors, int)
    assert_is_type(min_occurrence, int)
    assert_is_type(destination_frame, str, None)
    factors = [data.names[n] if is_type(n, int) else n for n in factors]
    parms = {"dest": py_tmp_key(append=h2oconn.session_id) if destination_frame is None else destination_frame,
             "source_frame": data.frame_id,
             "factor_columns": [quoted(f) for f in factors],
             "pairwise": pairwise,
             "max_factors": max_factors,
             "min_occurrence": min_occurrence,
             }
    H2OJob(api("POST /3/Interaction", data=parms), "Interactions").poll()
    return get_frame(parms["dest"])
def interaction(data, factors, pairwise, max_factors, min_occurrence, destination_frame=None):
    """
    Categorical Interaction Feature Creation in H2O.

    Creates a frame in H2O with n-th order interaction features between categorical columns, as specified by
    the user.

    :param data: the H2OFrame that holds the target categorical columns.
    :param factors: factor columns (either indices or column names).
    :param pairwise: If True, create pairwise interactions between factors (otherwise create one
        higher-order interaction). Only applicable if there are 3 or more factors.
    :param max_factors: Max. number of factor levels in pair-wise interaction terms (if enforced, one extra
        catch-all factor will be made).
    :param min_occurrence: Min. occurrence threshold for factor levels in pair-wise interaction terms
    :param destination_frame: a string indicating the destination key. If empty, this will be auto-generated by H2O.

    :returns: :class:`H2OFrame`
    """
    assert_is_type(data, H2OFrame)
    assert_is_type(factors, [str, int])
    assert_is_type(pairwise, bool)
    assert_is_type(max_factors, int)
    assert_is_type(min_occurrence, int)
    assert_is_type(destination_frame, str, None)
    factors = [data.names[n] if is_type(n, int) else n for n in factors]
    parms = {"dest": py_tmp_key(append=h2oconn.session_id) if destination_frame is None else destination_frame,
             "source_frame": data.frame_id,
             "factor_columns": [quoted(f) for f in factors],
             "pairwise": pairwise,
             "max_factors": max_factors,
             "min_occurrence": min_occurrence,
             }
    H2OJob(api("POST /3/Interaction", data=parms), "Interactions").poll()
    return get_frame(parms["dest"])
Categorical Interaction Feature Creation in H2O.

    Creates a frame in H2O with n-th order interaction features between categorical columns, as specified by
    the user.

    :param data: the H2OFrame that holds the target categorical columns.
    :param factors: factor columns (either indices or column names).
    :param pairwise: If True, create pairwise interactions between factors (otherwise create one
        higher-order interaction). Only applicable if there are 3 or more factors.
    :param max_factors: Max. number of factor levels in pair-wise interaction terms (if enforced, one extra
        catch-all factor will be made).
    :param min_occurrence: Min. occurrence threshold for factor levels in pair-wise interaction terms
    :param destination_frame: a string indicating the destination key. If empty, this will be auto-generated by H2O.

    :returns: :class:`H2OFrame`