SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1901.08930 · 2019

Effectiveness of Tree-based Ensembles for Anomaly Discovery: Insights, Batch and Streaming Active Learning

arXiv · PDF · Open in the Atlas

Code that ran

2 of 21 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 19 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1901.08930.json · badge: /api/ran/1901.08930.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
shubhomoydas/ad_examples canonical (classifier label)
classifier basis: classifier_2025
0 ran · 5 no recorded run
freedombenLiu/ad_examples community (classifier label)
classifier basis not recorded on the link
2 ran · 14 no recorded run
FunctionStatusWhere it lives
aad_loss_linear Ran
ran on a synthesized input
freedombenLiu/ad_examples/ad_examples/aad/aad_loss.py
code served (permissive licence) · get_code("c14e158c80a69604")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from scipy.sparse import csr_matrix

np.random.seed(0)

# Create a small sparse matrix for xi (features)
# Shape: (n_samples=2, n_features=4)
xi_dense = np.array([[1.0, 2.0, 0.5, 1.5],
                     [0.0, 1.0, 2.0, 0.5]])
xi = csr_matrix(xi_dense)

# Create labels: 1 for anomaly, 0 for normal
yi = np.array([1, 0])

# Create weight vector w (same dimension as features)
w = np.array([0.1, 0.2, -0.1, 0.3])

# Quantile value
qval = 0.5

# Optional: constraint set (which samples are in constraint set)
in_constr_set = np.array([1, 1])

# Optional: tau-weighted feature matrix
x_tau_dense = np.array([[0.2, 0.3, 0.1, 0.2],
                        [0.1, 0.15, 0.2, 0.1]])
x_tau = csr_matrix(x_tau_dense)

# Prior weight vector
w_prior = np.array([0.0, 0.0, 0.0, 0.0])

# Build the ARGS dictionary with all parameters
ARGS = {
    'w': w,
    'xi': xi,
    'yi': yi,
    'qval': qval,
    'in_constr_set': in_constr_set,
    'x_tau': x_tau,
    'Ca': 1.0,
    'Cn': 1.0,
    'Cx': 1.0,
    'withprior': True,
    'w_prior': w_prior,
    'sigma2': 1.0,
    'prior_influence': 1.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluate_forest_original Ran
ran on a synthesized input
freedombenLiu/ad_examples/ad_examples/aad/aad_test_support.py
code served (permissive licence) · get_code("f83d93a9883765bf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family int, shape (3, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch
from torch import nn

# Build a mock forest object that has the required methods/attributes
class MockForest:
    def __init__(self, n_features, n_estimators):
        self.n_features = n_features
        self.n_estimators = n_estimators
        # The function accesses forest.d, so we need to define it
        self.d = np.arange(n_estimators)
    
    def decision_function(self, x):
        # x shape: (n_samples, n_features)
        # Return scores of shape (n_samples,)
        return np.random.randn(x.shape[0])
    
    def get_score(self, x, w):
        # x shape: (n_samples, n_features)
        # w shape: (n_estimators,)
        # Return aggregated scores of shape (n_samples,)
        return np.random.randn(x.shape[0])

# Set random seed for reproducibility
np.random.seed(0)

# Create mock data
n_samples = 8
n_features = 4
budget = 3
n_estimators = 5

# x: feature matrix (n_samples, n_features)
x = np.random.randn(n_samples, n_features)

# y: binary labels (n_samples,)
y = np.array([0, 1, 1, 0, 1, 0, 1, 0])

# x_new: new feature matrix (n_samples, n_features) or None
x_new = np.random.randn(n_samples, n_features)

# forest: mock forest object with decision_function and get_score methods
forest = MockForest(n_features, n_estimators)

ARGS = {
    'x': x,
    'y': y,
    'budget': budget,
    'forest': forest,
    'x_new': x_new
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (3, 2) — shape (3, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
aad_loss_gradient_linear Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_loss.py
code served (permissive licence) · get_code("8badd090540c89ba")
How it ran

no invocation recorded.

describe_instances Not yet run
unverified (harvested, no recorded run)
shubhomoydas/ad_examples/ad_examples/aad/demo_aad.py
code served (permissive licence) · get_code("151fc694a94564e2")
How it ran

no invocation recorded.

detect_anomalies_and_describe Not yet run
unverified (harvested, no recorded run)
shubhomoydas/ad_examples/ad_examples/aad/demo_aad.py
code served (permissive licence) · get_code("f958c10e9cffa78e")
How it ran

no invocation recorded.

estimate_qtau Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_base.py
code served (permissive licence) · get_code("eb82e43983ab9524")
How it ran

no invocation recorded.

get_aad_command_args Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_globals.py
code served (permissive licence) · get_code("e3cbbcf9de858a91")
How it ran

no invocation recorded.

get_aad_metrics_structure Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_base.py
code served (permissive licence) · get_code("f3f7f564b0d36cdb")
How it ran

no invocation recorded.

get_aad_model Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_support.py
code served (permissive licence) · get_code("a7f5521ccb2189dd")
How it ran

no invocation recorded.

get_budget_topK Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_base.py
code served (permissive licence) · get_code("be92dddc5f891292")
How it ran

no invocation recorded.

get_first_val_not_marked Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_globals.py
code served (permissive licence) · get_code("8693d09b634b4c69")
How it ran

no invocation recorded.

get_first_vals_not_marked Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_globals.py
code served (permissive licence) · get_code("407db3dd36ec6a4d")
How it ran

no invocation recorded.

get_mean_euclidean_distance Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/query_model_euclidean.py
code served (permissive licence) · get_code("4f9fdcf28e80b3bc")
How it ran

no invocation recorded.

get_min_euclidean_distance Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/query_model_euclidean.py
code served (permissive licence) · get_code("3aaf622d2fa22ace")
How it ran

no invocation recorded.

get_rulesets Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_ruleset_support.py
code served (permissive licence) · get_code("2633e06aed91c4d2")
How it ran

no invocation recorded.

get_score_ranges Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_support.py
code served (permissive licence) · get_code("35491236d4cbf696")
How it ran

no invocation recorded.

prepare_aad_model Not yet run
unverified (harvested, no recorded run)
shubhomoydas/ad_examples/ad_examples/aad/aad_stream.py
code served (permissive licence) · get_code("99863fb4df7a185c")
How it ran

no invocation recorded.

prepare_conjunctive_rulesets Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_ruleset_support.py
code served (permissive licence) · get_code("b6e9c8b277dfd2e6")
How it ran

no invocation recorded.

prepare_stream_anomaly_detector Not yet run
unverified (harvested, no recorded run)
shubhomoydas/ad_examples/ad_examples/aad/aad_stream.py
code served (permissive licence) · get_code("3cf89ba27b591b36")
How it ran

no invocation recorded.

summarize_aad_metrics Not yet run
unverified (harvested, no recorded run)
freedombenLiu/ad_examples/ad_examples/aad/aad_support.py
code served (permissive licence) · get_code("61602ce877390332")
How it ran

no invocation recorded.

train_aad_model Not yet run
unverified (harvested, no recorded run)
shubhomoydas/ad_examples/ad_examples/aad/aad_stream.py
code served (permissive licence) · get_code("8f255acab32975b3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 21 samples lifted from this paper's linked repositories, 21 carry a function identity and 0 do not. Of the 21 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 21 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

In many real-world AD applications including computer security and fraud prevention, the anomaly detector must be configurable by the human analyst to minimize the effort on false positives. One important way to configure the detector is by providing true labels (nominal or anomaly) for a few instances. Recent work on active anomaly discovery has shown that greedily querying the top-scoring instance and tuning the weights of ensemble detectors based on label feedback allows us to quickly discover true anomalies. This paper makes four main contributions to improve the state-of-the-art in anomaly discovery using tree-based ensembles. First, we provide an important insight that explains the practical successes of unsupervised tree-based ensembles and active learning based on greedy query selection strategy. We also present empirical results on real-world data to support our insights and theoretical analysis to support active learning. Second, we develop a novel batch active learning algorithm to improve the diversity of discovered anomalies based on a formalism called compact description to describe the discovered anomalies. Third, we develop a novel active learning algorithm to handle streaming data setting. We present a data drift detection algorithm that not only detects the drift robustly, but also allows us to take corrective actions to adapt the anomaly detector in a principled manner. Fourth, we present extensive experiments to evaluate our insights and our tree-based active anomaly discovery algorithms in both batch and streaming data settings. Our results show that active learning allows us to discover significantly more anomalies than state-of-the-art unsupervised baselines, our batch active learning algorithm discovers diverse anomalies, and our algorithms under the streaming-data setup are competitive with the batch setup.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1901.08930")
get_code_for_paper("1901.08930")
have("1901.08930")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1901.08930.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1901.08930.svg)](https://syntology.ai/paper/1901.08930)

Connect an agent — have() is free.