def test_tree(n_samples=1000):
    X, y = generate_sample(n_samples=n_samples, n_features=5)
    X = numpy.array(X)
    w = numpy.ones(n_samples)
    tree = FastTreeRegressor()
    tree = tree.fit(X, y, sample_weight=w)
    prediction = tree.predict(X)
    tree.print_tree_stats()
    auc = roc_auc_score(y, prediction)
    assert auc > 0.7, 'quality is too poor, AUC = {}'.format(auc)

    # Testing apply method
    indices1, values1 = tree.apply(X)
    indices2, values2 = tree.fast_apply(X)

    assert numpy.all(values1 == values2), 'two apply methods give different results'
Testing quality of predictions of fasttree
dataset/ETHPy150Open anaderi/lhcb_trigger_ml/tests/test_fasttree.py/test_tree