| DensificationPerturbation |
Ran ran on a synthesized input |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("63eade775fbf2a51") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
# Create a small sample DataFrame for testing
np.random.seed(42)
n_samples = 2
n_features = 4
data = np.random.rand(n_samples, n_features)
data[data < 0.5] = 0 # Introduce sparsity
X = pd.DataFrame(data, columns=[f'feature_{i}' for i in range(n_features)])
INIT_ARGS = {
'protected_features': ['feature_0']
}
ARGS = {
'X': X,
'target_sparsity': 0.3,
'seed': 42,
'verbose': True
}
METHOD = 'apply'
# Construct and call the class
from typing import List, Optional
class Perturbation:
"""
Base class for individual perturbation strategies.
Subclasses implement `apply(X, **kwargs) -> pd.DataFrame`.
Protected features are never modified.
"""
def __init__(self, protected_features: Optional[List[str]]=None):
self.protected_features: List[str] = protected_features or []
def _modifiable(self, X: pd.DataFrame) -> List[str]:
return [c for c in X.columns if c not in self.protected_features]
@staticmethod
def _renormalize(X: pd.DataFrame, verbose: bool=False) -> pd.DataFrame:
"""Divide each row by its sum so rows sum to 1. Rows of all-zeros are left as-is."""
X = X.astype(float)
row_sums = X.sum(axis=1)
zero_rows = row_sums == 0
if verbose and zero_rows.any():
print(f'Warning: {zero_rows.sum()} samples are all-zero after perturbation.')
result = X.copy()
result.loc[~zero_rows] = X.loc[~zero_rows].div(row_sums[~zero_rows], axis=0)
return result
def apply(self, X: pd.DataFrame, **kwargs) -> pd.DataFrame:
raise NotImplementedError
class DensificationPerturbation(Perturbation):
"""
Reduce sparsity by filling zeros in non-protected features with real values
sampled from the same non-protected features (cross-sample).
Biologically motivated: simulates species already present in the dataset
but undetected in certain samples due to sequencing depth limitations.
The filled values are drawn from the empirical distribution of non-zero
abundances of non-protected features, preserving realistic abundance ranges.
Parameters
----------
target_sparsity : float
Target sparsity LOWER than current. If >= current, returns X unchanged.
seed : int, optional
verbose : bool
"""
def apply(self, X: pd.DataFrame, target_sparsity: float=0.5, seed: Optional[int]=None, verbose: bool=True) -> pd.DataFrame:
X = X.copy().astype(float)
modifiable = self._modifiable(X)
rng = np.random.default_rng(seed)
current_sparsity = float((X == 0).sum().sum() / X.size)
total_elements = X.size
current_zeros = int(current_sparsity * total_elements)
target_zeros = int(target_sparsity * total_elements)
need_to_fill = current_zeros - target_zeros
if verbose:
print(f' Zero imputation: sparsity {current_sparsity:.3f} → target {target_sparsity:.3f} (fill {need_to_fill} zeros)')
if need_to_fill <= 0:
if verbose:
print(' target_sparsity >= current_sparsity — no zero imputation needed.')
return X
mod_cols = list(modifiable)
zero_mask = X[modifiable] == 0
zero_positions = np.argwhere(zero_mask.values)
if len(zero_positions) < need_to_fill:
if verbose:
print(f' [WARN] Only {len(zero_positions)} zeros available; clipping to that.')
need_to_fill = len(zero_positions)
feature_nonzero = {}
for col in mod_cols:
vals = X[col].values
nz = vals[vals > 0]
if len(nz) > 0:
feature_nonzero[col] = nz
if len(feature_nonzero) == 0:
if verbose:
print(' [WARN] No non-zero values in non-protected features — cannot densify.')
return X
chosen_pos = rng.choice(len(zero_positions), size=need_to_fill, replace=False)
for pos_idx in chosen_pos:
row_i, col_i = zero_positions[pos_idx]
col_name = mod_cols[col_i]
if col_name in feature_nonzero:
pool = feature_nonzero[col_name]
else:
fallback = rng.choice(list(feature_nonzero.keys()))
pool = feature_nonzero[fallback]
fill_val = rng.choice(pool)
X.at[X.index[row_i], col_name] = fill_val
X = self._renormalize(X, verbose)
final_sparsity = float((X == 0).sum().sum() / X.size)
if verbose:
print(f' Final sparsity: {final_sparsity:.4f}')
return X
# Instantiate and call
instance = DensificationPerturbation(**INIT_ARGS)
result = getattr(instance, METHOD)(**ARGS)
print("\nResult:")
print(result)
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
- 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| FeatureSelector |
Ran ran on a synthesized input · constructed an object; no result was computed |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("6036b20bbf4528af") How it ranRan 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 an instance of its own class, FeatureSelector: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
# Create a small synthetic dataset
np.random.seed(42)
n_samples = 20
n_features = 5
# Generate feature matrix
X_data = np.random.randn(n_samples, n_features)
X = pd.DataFrame(X_data, columns=[f'feature_{i}' for i in range(n_features)])
# Generate binary target variable
y = pd.Series(np.random.randint(0, 2, n_samples), name='target')
ARGS = {
'X': X,
'y': y,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type FeatureSelector — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FeatureSelector output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- 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
|
| Perturbation |
Ran ran on a synthesized input · constructed an object; no result was computed |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("a84e50ff24941d7b") How it ranRan 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 an instance of its own class, Perturbation: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
import numpy as np
from typing import List, Optional
# Create a sample DataFrame for testing
np.random.seed(0)
sample_data = {
'feature_1': [0.1, 0.2, 0.3],
'feature_2': [0.4, 0.5, 0.0],
'feature_3': [0.5, 0.3, 0.7],
'protected_col': ['A', 'B', 'C']
}
X = pd.DataFrame(sample_data)
# Define protected features list
protected_features = ['protected_col']
ARGS = {
'protected_features': protected_features
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Perturbation — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Perturbation output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- 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
|
| PerturbationStats |
Ran ran on a synthesized input · constructed an object; no result was computed |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("ef93195611f2fa55") How it ranRan 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 an instance of its own class, PerturbationStats: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
from typing import List, Optional, Tuple
# Create small sample DataFrames for testing
np.random.seed(0)
# Create first dataset - small DataFrame with numeric data
X1 = pd.DataFrame(
np.random.rand(3, 4) * 10,
columns=['feat_0', 'feat_1', 'feat_2', 'feat_3']
)
X1.iloc[0, 0] = 0 # Add some sparsity
X1.iloc[1, 2] = 0
X1.iloc[2, 1] = 0
# Create second dataset
X2 = pd.DataFrame(
np.random.rand(2, 4) * 8,
columns=['feat_0', 'feat_1', 'feat_2', 'feat_3']
)
X2.iloc[0, 3] = 0
X2.iloc[1, 0] = 0
# Create third dataset with different characteristics
X3 = pd.DataFrame(
np.random.rand(4, 4) * 5,
columns=['feat_0', 'feat_1', 'feat_2', 'feat_3']
)
# Prepare datasets list for compute_all
datasets = [
('dataset_A', X1, {'treatment': 'control', 'batch': 1}),
('dataset_B', X2, {'treatment': 'perturbed', 'batch': 1}),
('dataset_C', X3, None),
]
# Define metrics to use
metrics_list = ['sparsity', 'n_features', 'mean_abundance', 'diversity']
ARGS = {
'metrics': metrics_list,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type PerturbationStats — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PerturbationStats output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- 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
|
| RemoveFeaturesPerturbation |
Ran ran on a synthesized input |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("420a1cef63da4850") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
# Create sample compositional data
np.random.seed(42)
n_samples = 2
n_features = 4
data = np.random.dirichlet(np.ones(n_features), size=n_samples)
X = pd.DataFrame(data, columns=[f'feature_{i}' for i in range(n_features)])
INIT_ARGS = {
'protected_features': ['feature_0']
}
ARGS = {
'X': X,
'k': 2,
'selection_method': 'random',
'seed': 42,
'verbose': True
}
METHOD = 'apply'
# Construct and call
from typing import List, Optional
import sys
class Perturbation:
"""
Base class for individual perturbation strategies.
Subclasses implement `apply(X, **kwargs) -> pd.DataFrame`.
Protected features are never modified.
"""
def __init__(self, protected_features: Optional[List[str]]=None):
self.protected_features: List[str] = protected_features or []
def _modifiable(self, X: pd.DataFrame) -> List[str]:
return [c for c in X.columns if c not in self.protected_features]
@staticmethod
def _renormalize(X: pd.DataFrame, verbose: bool=False) -> pd.DataFrame:
"""Divide each row by its sum so rows sum to 1. Rows of all-zeros are left as-is."""
X = X.astype(float)
row_sums = X.sum(axis=1)
zero_rows = row_sums == 0
if verbose and zero_rows.any():
print(f'Warning: {zero_rows.sum()} samples are all-zero after perturbation.')
result = X.copy()
result.loc[~zero_rows] = X.loc[~zero_rows].div(row_sums[~zero_rows], axis=0)
return result
def apply(self, X: pd.DataFrame, **kwargs) -> pd.DataFrame:
raise NotImplementedError
class RemoveFeaturesPerturbation(Perturbation):
"""
Remove k features from compositional data and renormalize.
Protected features are never removed.
Selection methods
-----------------
'random' – uniform random sample
'lowest_abundance' – k features with lowest mean abundance
'highest_abundance' – k features with highest mean abundance
'lowest_prevalence' – k features present in fewest samples
'highest_prevalence' – k features present in most samples
"""
VALID_METHODS = {'random', 'lowest_abundance', 'highest_abundance', 'lowest_prevalence', 'highest_prevalence'}
def apply(self, X: pd.DataFrame, k: Optional[int]=None, features_to_remove: Optional[List[str]]=None, selection_method: str='random', seed: Optional[int]=None, verbose: bool=True) -> pd.DataFrame:
"""
Parameters
----------
X : pd.DataFrame – compositional data (rows sum to 1)
k : int – number of features to remove
features_to_remove : list of str, optional
Explicit list of features to remove (overrides k / selection_method)
selection_method : str
seed : int, optional
verbose : bool
"""
X = X.copy()
modifiable = self._modifiable(X)
if verbose and self.protected_features:
print(f' Protected features : {len(self.protected_features)}')
print(f' Modifiable features: {len(modifiable)}')
if features_to_remove is not None:
bad = set(features_to_remove) & set(self.protected_features)
if bad:
raise ValueError(f'Cannot remove protected features: {bad}')
return self._remove_and_renormalize(X, list(features_to_remove), verbose)
if k is None:
raise ValueError("Provide either 'k' or 'features_to_remove'.")
if k > len(modifiable):
raise ValueError(f'k={k} exceeds modifiable feature count ({len(modifiable)}); {len(self.protected_features)} features are protected.')
if selection_method not in self.VALID_METHODS:
raise ValueError(f"Unknown selection_method '{selection_method}'. Choose from {self.VALID_METHODS}.")
rng = np.random.default_rng(seed)
X_mod = X[modifiable].astype(float)
if selection_method == 'random':
to_remove = rng.choice(modifiable, size=k, replace=False).tolist()
elif selection_method == 'lowest_abundance':
to_remove = X_mod.mean().nsmallest(k).index.tolist()
elif selection_method == 'highest_abundance':
to_remove = X_mod.mean().nlargest(k).index.tolist()
elif selection_method == 'lowest_prevalence':
to_remove = (X_mod > 0).sum().nsmallest(k).index.tolist()
elif selection_method == 'highest_prevalence':
to_remove = (X_mod > 0).sum().nlargest(k).index.tolist()
return self._remove_and_renormalize(X, to_remove, verbose)
def _remove_and_renormalize(self, X: pd.DataFrame, features_to_remove: List[str], verbose: bool) -> pd.DataFrame:
keep = [c for c in X.columns if c not in features_to_remove]
if verbose:
print(f' Removing {len(features_to_remove)} features → {len(keep)} remaining.')
if self.protected_features:
n_protected_kept = len(set(keep) & set(self.protected_features))
print(f' Protected features kept: {n_protected_kept}/{len(self.protected_features)}')
return self._renormalize(X[keep], verbose)
instance = RemoveFeaturesPerturbation(**INIT_ARGS)
result = getattr(instance, METHOD)(**ARGS)
print("\nResult shape:", result.shape)
print("Result:\n", result)
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
- 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| _adaptive_params |
Ran ran; our contract draft was wrong, not the code |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("f9d164903ef08d0c") How it ranRan 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 list, ndim 1, 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 typing import List, Optional, Tuple
# Set random seeds for reproducibility
np.random.seed(42)
# Define ARGS dict with all parameters for _adaptive_params
ARGS = {
'pert_type': 'remove_features',
'n_features': 20,
'actual_sparsity': 0.3,
'seed': 42
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
- 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
|
| _coerce_inputs |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("000102c326bfc425") How it ranRan 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 tuple. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
# Set up test data
np.random.seed(0)
# Create small training and test datasets
X_train = np.random.randn(2, 4) # 2 samples, 4 features
X_test = np.random.randn(3, 4) # 3 samples, 4 features
y_train = np.array([0, 1]) # 2 labels
col_names = ['feat_0', 'feat_1', 'feat_2', 'feat_3'] # 4 feature names
# Test with different model names to exercise different code paths
# This dict uses 'tabdpt' which triggers np.asarray conversion
ARGS = {
'model_name': 'tabdpt',
'X_train': X_train,
'X_test': X_test,
'y_train': y_train,
'col_names': col_names
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- 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
|
| _cv_scores |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("54093043dc722691") How it ranRan 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 tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type 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 pandas as pd
from sklearn.datasets import make_classification
np.random.seed(42)
# Create synthetic data for _cv_scores
n_samples = 20
n_features = 5
X_array, y_array = make_classification(
n_samples=n_samples,
n_features=n_features,
n_informative=3,
n_redundant=1,
n_classes=2,
random_state=42
)
X = pd.DataFrame(X_array, columns=[f'feat_{i}' for i in range(n_features)])
y = y_array
ARGS = {
'model_name': 'rf',
'X': X,
'y': y,
'cv': 2,
'n_features_max': 5,
'device': 'cpu',
'random_state': 42
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas, sap_rpt_oss, sklearn, tabdpt, tabicl, tabpfn, torch, xgboost — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- 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
|
| _cv_scores_ood |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("90bb6831eb7433f8") How it ranRan 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 tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type 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 pandas as pd
from sklearn.model_selection import StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
# Set random seed for reproducibility
np.random.seed(42)
# Create small synthetic dataset
n_samples = 20
n_features = 8
n_classes = 2
# Generate features and labels
X_data = np.random.randn(n_samples, n_features).astype(np.float32)
y_data = np.random.randint(0, n_classes, n_samples)
# Create X_original and X_perturbed as DataFrames
col_names = [f'feature_{i}' for i in range(n_features)]
X_original = pd.DataFrame(X_data, columns=col_names)
X_perturbed = pd.DataFrame(X_data + np.random.randn(n_samples, n_features) * 0.1, columns=col_names)
ARGS = {
'model_name': 'rf',
'X_original': X_original,
'X_perturbed': X_perturbed,
'y': y_data,
'cv': 2,
'n_features_max': 6,
'device': 'cpu',
'random_state': 42,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas, sap_rpt_oss, sklearn, tabdpt, tabicl, tabpfn, torch, xgboost — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- 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
|
| _param_label |
Ran ran; our contract draft was wrong, not the code |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("e987a86942eaaef7") How it ranRan 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 tuple, ndim 1, 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 torch
def _param_label(params: dict) -> tuple:
filtered = {k: v for k, v in params.items() if k != 'seed'}
if 'k' in filtered and 'selection_method' in filtered:
return ('k / method', f"k={filtered['k']} / {filtered['selection_method']}")
key = next(iter(filtered))
return (key, str(filtered[key]))
# Test case 1: params with both 'k' and 'selection_method'
ARGS = {
'params': {
'k': 5,
'selection_method': 'random',
'seed': 42
}
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
- 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
|
| _params_to_filename |
Ran ran; our contract draft was wrong, not the code |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("f407e35eb0cd1163") How it ranRan 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 str. The image it ran in was not recorded. If your copy returns the same type 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 torch
import torch.nn as nn
torch.manual_seed(0)
# Test case 1: 'remove_features' perturbation type
ARGS_remove_features = {
'pert_type': 'remove_features',
'params': {'k': 5}
}
# Test case 2: 'zero_inflation' perturbation type
ARGS_zero_inflation = {
'pert_type': 'zero_inflation',
'params': {'target_sparsity': 0.7}
}
# Test case 3: 'zero_imputation' perturbation type
ARGS_zero_imputation = {
'pert_type': 'zero_imputation',
'params': {'target_sparsity': 0.5}
}
# Test case 4: default case (unknown pert_type)
ARGS_default = {
'pert_type': 'unknown_type',
'params': {}
}
# Use the first test case as the main ARGS
ARGS = ARGS_remove_features
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- 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
|
| _reduce_features |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("369f916506c2feb2") How it ranRan 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 1, dtype family int, shape (3,) 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
from sklearn.feature_selection import SelectKBest, f_classif
# Create small sample data
np.random.seed(0)
X_train = np.random.randn(10, 8).astype(np.float32) # 10 samples, 8 features
y_train = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) # 10 binary labels
n_features_max = 3
ARGS = {
"X_train": X_train,
"y_train": y_train,
"n_features_max": n_features_max,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family int, shape (3,) — shape (3,) 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
|
| load_tabfn_model |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("234f6411b51d431e") How it ranRan 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 RandomForestClassifier. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type 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 torch
import numpy as np
torch.manual_seed(0)
# The function takes two parameters: model_name and device
# model_name is a string that determines which model to load
# device is a string that defaults to 'cuda' but we'll use 'cpu'
ARGS = {
'model_name': 'rf',
'device': 'cpu'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sap_rpt_oss, sklearn, tabdpt, tabicl, tabpfn, torch, xgboost — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type RandomForestClassifier — a RandomForestClassifier output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RandomForestClassifier output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- 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
|
| open_and_filter |
Ran ran; our contract draft was wrong, not the code |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("9c060c8d27a0128b") How it ranRan 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 tuple. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
# Create a sample DataFrame with the required structure
# sampleID, label, and multiple feature columns
np.random.seed(0)
# Create sample data
n_samples = 10
n_features = 8
data = {
'sampleID': [f'sample_{i}' for i in range(n_samples)],
'label': np.random.choice(['class_A', 'class_B'], n_samples),
}
# Add feature columns with numeric values
for i in range(n_features):
data[f'feature_{i}'] = np.random.uniform(0, 1, n_samples)
df = pd.DataFrame(data)
# Ensure the DataFrame has the correct structure
# Columns: sampleID, label, feature_0, feature_1, ..., feature_n
df_test = df.copy()
ARGS = {
'df': df_test,
'th_presence': 0.2,
'th_abundance': 1e-05
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- 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
|
| presence_abundance_filter |
Ran ran, honoured the contract we drafted |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("794a870e1843e495") How it ranRan 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 DataFrame. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
# Create a small DataFrame with numeric and non-numeric values
# to test the presence_abundance_filter function
df = pd.DataFrame({
'col1': [10, 20, 30, 0, 15],
'col2': [0.5, 0.8, 0, 0, 0.3],
'col3': [100, 150, 200, 250, 300],
'col4': [1, 0, 0, 0, 0],
'col5': ['a', 'b', 'c', 'd', 'e'] # non-numeric column
})
# Threshold for presence: minimum proportion of non-zero values required
th_presence = 0.3
# Threshold for abundance: minimum maximum value required in a column
th_abundance = 5.0
ARGS = {
'df': df,
'th_presence': th_presence,
'th_abundance': th_abundance
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family int describe that coercion, not the output, and are not stated
- 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
|
| presence_abundance_filter_per_class |
Ran ran; our contract draft was wrong, not the code |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("bc2888b76dd18239") How it ranRan 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 tuple. The image it ran in was not recorded. If your copy returns the same type 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 pandas as pd
# Create a sample dataframe with the required structure
# sampleID, label, and feature columns
np.random.seed(0)
# Create sample data
n_samples = 10
n_features = 6
data = {
'sampleID': [f'sample_{i}' for i in range(n_samples)],
'label': ['classA'] * 5 + ['classB'] * 5,
}
# Add feature columns with numeric values
# Some features will have low abundance/presence to test filtering
for i in range(n_features):
if i < 2:
# Features with low abundance - will be filtered out
data[f'feature_{i}'] = np.random.uniform(1e-7, 1e-6, n_samples)
elif i < 4:
# Features with moderate abundance and presence
data[f'feature_{i}'] = np.random.uniform(1e-4, 1e-3, n_samples)
else:
# Features with high abundance and presence
data[f'feature_{i}'] = np.random.uniform(0.1, 1.0, n_samples)
df = pd.DataFrame(data)
ARGS = {
'df': df,
'th_presence': 0.2,
'th_abundance': 1e-05,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- 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
|
| Benchmarker |
Not yet run unverified (harvested, no recorded run) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("195aa4ba088809dc") How it ran |
| DataGenerator |
Not yet run unverified (harvested, no recorded run) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("5e07f4c9a857174a") How it ran |
| DataLoader |
Not yet run unverified (harvested, no recorded run) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("f0cc3b2498455251") How it ran |
| PerturbationVisualizer |
Not yet run unverified (harvested, no recorded run) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("c262e37a31a52c4b") How it ran |
| SparsityPerturbation |
Not yet run unverified (harvested, no recorded run) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("56be4578f0db8775") How it ran |
| open_pasolli |
Not yet run unverified (harvested, no recorded run) |
UMMISCO/metagenomics-fm/benchmarking/benchmarking.py code served (permissive licence) · get_code("98e1b933fd7703fb") How it ran |