

def test_dummy_regressor_sample_weight(n_samples=10):
    random_state = np.random.RandomState(seed=1)
    X = ([[0]] * n_samples)
    y = random_state.rand(n_samples)
    sample_weight = random_state.rand(n_samples)
    est = DummyRegressor(strategy='mean').fit(X, y, sample_weight)
    assert_equal(est.constant_, np.average(y, weights=sample_weight))
    est = DummyRegressor(strategy='median').fit(X, y, sample_weight)
    assert_equal(est.constant_, _weighted_percentile(y, sample_weight, 50.0))
    est = DummyRegressor(strategy='quantile', quantile=0.95).fit(X, y, sample_weight)
    assert_equal(est.constant_, _weighted_percentile(n_samples, sample_weight, 95.0))

dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/tests/test_dummy.py test_dummy_regressor_sample_weight/VarMisuse@155/209 `y`->`n_samples`