Exemplo n.º 1
0
def test_stability_selection_to_threshold_int():
    n_boots_sel = 48
    # stability selection is a single integer
    test_int = 36
    selection_thresholds = stability_selection_to_threshold(
        test_int, n_boots_sel)
    assert_array_equal(selection_thresholds, [36])
Exemplo n.º 2
0
def test_stability_selection_to_threshold_floats():
    n_boots_sel = 48
    # stability selection is a list of floats
    test_floats = [0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
    selection_thresholds = stability_selection_to_threshold(
        test_floats, n_boots_sel)
    assert_array_equal(selection_thresholds, [24, 28, 33, 38, 43, 48])
Exemplo n.º 3
0
def test_stability_selection_to_threshold_float():
    n_boots_sel = 48
    # stability selection is a single float
    test_float = 0.5
    selection_thresholds = stability_selection_to_threshold(
        test_float, n_boots_sel)
    assert_array_equal(selection_thresholds, [24])
Exemplo n.º 4
0
def test_stability_selection_to_threshold_int():
    """Tests whether stability_selection_to_threshold correctly outputs the
    correct threshold when provided a single integer."""

    n_boots_sel = 48
    # stability selection is a single integer
    test_int = 36
    selection_thresholds = stability_selection_to_threshold(
        test_int, n_boots_sel)

    assert_array_equal(selection_thresholds, np.array([36]))
Exemplo n.º 5
0
def test_stability_selection_to_threshold_float():
    """Tests whether stability_selection_to_threshold correctly outputs the
    correct threshold when provided a single float."""

    n_boots_sel = 48
    # stability selection is a single float
    test_float = 0.5
    selection_thresholds = stability_selection_to_threshold(
        test_float, n_boots_sel)

    assert_array_equal(selection_thresholds, np.array([24]))
Exemplo n.º 6
0
def test_stability_selection_to_threshold_floats():
    """Tests whether stability_selection_to_threshold correctly outputs the
    correct threshold when provided a list of floats."""
    n_boots_sel = 48
    # stability selection is a list of floats
    test_floats = [0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
    selection_thresholds = stability_selection_to_threshold(
        test_floats, n_boots_sel)

    assert_array_equal(
        selection_thresholds,
        np.array([24, 28, 33, 38, 43, 48]))
Exemplo n.º 7
0
def test_stability_selection_to_threshold_ints_np():
    """Tests whether stability_selection_to_threshold correctly outputs the
    correct threshold when provided a numpy array of ints."""

    n_boots_sel = 48
    # stability selection is a list of ints
    test_ints_np = np.array([24, 28, 33, 38, 43, 48])
    selection_thresholds = stability_selection_to_threshold(
        test_ints_np, n_boots_sel)

    assert_array_equal(
        selection_thresholds,
        np.array([24, 28, 33, 38, 43, 48]))
Exemplo n.º 8
0
def test_stability_selection_to_threshold_one_bootstrap():
    """Tests whether stability_selection_to_threshold correctly handles the
    edge case where one bootstrap is requested."""

    n_boots_sel = 1
    # stability selection can only be one value
    threshold = 1

    selection_thresholds = stability_selection_to_threshold(
        n_boots_sel,
        threshold)

    assert_array_equal(
        selection_thresholds,
        np.array([1]))