| build_ellipse |
Ran ran on a synthesized input |
maxhalford/prince/prince/plot.py code served (permissive licence) · get_code("401a4194818f1a11") 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 numpy as np
from scipy import linalg
# Create sample 1D arrays for X and Y
X = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
Y = np.array([2.0, 4.0, 5.0, 4.0, 6.0])
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, scipy — 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
|
| check_is_dataframe_input |
Ran ran on a synthesized input |
maxhalford/prince/prince/utils.py code served (permissive licence) · get_code("a380c57525bec844") 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 function. 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 functools
from collections.abc import Callable
from typing import ParamSpec, TypeVar
import pandas as pd
P = ParamSpec('P')
R = TypeVar('R')
def check_is_dataframe_input(func: Callable[P, R]) -> Callable[P, R]:
@functools.wraps(func)
def wrapper(*args, **kwargs):
X = args[1]
if not isinstance(X, pd.DataFrame):
raise ValueError(f'The X argument must be a pandas DataFrame, but got {type(X).__name__}')
return func(*args, **kwargs)
return wrapper
# Create a simple function to be decorated
def dummy_function(self, X, y=None):
return "success"
# Create a simple class to hold the decorated method
class DummyModel:
@check_is_dataframe_input
def predict(self, X, y=None):
return "success"
# Create test arguments
df = pd.DataFrame({
'feature1': [1, 2, 3],
'feature2': [4.0, 5.0, 6.0],
'feature3': ['a', 'b', 'c']
})
model_instance = DummyModel()
ARGS = {
'func': model_instance.predict
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| check_is_fitted |
Ran ran on a synthesized input |
maxhalford/prince/prince/utils.py code served (permissive licence) · get_code("53135379e14fd93f") 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 function. 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 functools
from collections.abc import Callable
from typing import ParamSpec, TypeVar
from sklearn.utils import validation
import torch
import torch.nn as nn
P = ParamSpec('P')
R = TypeVar('R')
def check_is_fitted(method: Callable[P, R]) -> Callable[P, R]:
@functools.wraps(method)
def _impl(self, *method_args, **method_kwargs):
validation.check_is_fitted(self)
return method(self, *method_args, **method_kwargs)
return _impl
# Create a simple sklearn-compatible estimator class
class SimpleEstimator:
def __init__(self):
self.is_fitted_ = True
def predict(self, X):
return X
# Create a simple method to decorate
@check_is_fitted
def simple_method(self, x):
return x * 2
# Define the ARGS dict mapping parameters to values
ARGS = {
'method': simple_method
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| compute_svd |
Ran ran on a synthesized input |
maxhalford/prince/prince/svd.py code served (permissive licence) · get_code("e1845a3b3a8f3316") 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 SVD. 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 dataclasses
import numpy as np
import scipy
from sklearn.utils import extmath
@dataclasses.dataclass
class SVD:
U: np.ndarray
s: np.ndarray
V: np.ndarray
# Create test data
np.random.seed(42)
X = np.random.randn(6, 4)
n_components = 3
n_iter = 2
row_weights = np.array([1.0, 1.2, 0.9, 1.1, 0.8, 1.3])
column_weights = np.array([1.0, 0.9, 1.1, 0.8])
ARGS = {
"X": X,
"n_components": n_components,
"n_iter": n_iter,
"engine": "sklearn",
"random_state": 42,
"row_weights": row_weights,
"column_weights": column_weights,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, scipy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type SVD — a SVD output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SVD 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
|
| make_labels_and_names |
Ran ran on a synthesized input |
maxhalford/prince/prince/utils.py code served (permissive licence) · get_code("b82049109a993489") 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 pandas as pd
import numpy as np
# Test case 1: pandas DataFrame with named index and columns
df_with_names = pd.DataFrame(
np.random.randn(4, 3),
index=pd.Index(['row0', 'row1', 'row2', 'row3'], name='MyRows'),
columns=pd.Index(['col0', 'col1', 'col2'], name='MyCols')
)
# Test case 2: numpy array (2D)
numpy_array = np.random.randn(4, 3)
# Use the DataFrame case as the main argument
ARGS = {
'X': df_with_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
|
| select_active_columns |
Ran ran on a synthesized input |
maxhalford/prince/prince/ca.py code served (permissive licence) · get_code("87aa5108b3a372ac") 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 function. 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 functools
from collections.abc import Callable
from typing import Any, ParamSpec, TypeVar, cast
import pandas as pd
import numpy as np
P = ParamSpec('P')
R = TypeVar('R')
def select_active_columns(method: Callable[P, R]) -> Callable[P, R]:
@functools.wraps(method)
def _impl(self: Any, X: Any=None, *method_args: Any, **method_kwargs: Any) -> R:
if hasattr(self, 'active_cols_') and isinstance(X, pd.DataFrame):
return method(self, X[self.active_cols_], *method_args, **method_kwargs)
return method(self, X, *method_args, **method_kwargs)
return cast(Callable[P, R], _impl)
# Create a simple class with a decorated method to test the decorator
class SimpleModel:
def __init__(self):
self.active_cols_ = ['col_a', 'col_b']
@select_active_columns
def fit(self, X, y=None):
return X.shape
# Create test data
df = pd.DataFrame({
'col_a': [1, 2, 3],
'col_b': [4, 5, 6],
'col_c': [7, 8, 9]
})
model_instance = SimpleModel()
# The decorator function takes a method (Callable) as its only parameter
test_method = model_instance.fit.__wrapped__
ARGS = {
'method': test_method
}
- 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| select_active_rows |
Ran ran on a synthesized input |
maxhalford/prince/prince/ca.py code served (permissive licence) · get_code("52e691ce86333610") 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 function. 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 functools
from collections.abc import Callable
from typing import Any, ParamSpec, TypeVar, cast
import pandas as pd
import torch
import torch.nn as nn
torch.manual_seed(0)
P = ParamSpec('P')
R = TypeVar('R')
def select_active_rows(method: Callable[P, R]) -> Callable[P, R]:
@functools.wraps(method)
def _impl(self: Any, X: Any=None, *method_args: Any, **method_kwargs: Any) -> R:
if hasattr(self, 'active_rows_') and isinstance(X, pd.DataFrame):
return method(self, X.loc[self.active_rows_], *method_args, **method_kwargs)
return method(self, X, *method_args, **method_kwargs)
return cast(Callable[P, R], _impl)
# Create a minimal class with active_rows_ attribute and a method to decorate
class MinimalModel:
def __init__(self):
self.active_rows_ = [0, 1]
@select_active_rows
def process(self, X, extra_arg=None):
return X
# Create test data
df = pd.DataFrame({
'col1': [1.0, 2.0, 3.0],
'col2': [4.0, 5.0, 6.0],
'col3': [7.0, 8.0, 9.0]
})
model_instance = MinimalModel()
# The function signature has these parameters:
# - method: Callable[P, R]
# - (self, X, *method_args, **method_kwargs are in _impl but not in select_active_rows signature)
# The decorator is applied to a method, so we pass a decorated method
decorated_method = select_active_rows(model_instance.process)
ARGS = {
'method': model_instance.process
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| select_active_variables |
Ran ran on a synthesized input |
maxhalford/prince/prince/pca.py code served (permissive licence) · get_code("cdc0e8fa3c2b8a1e") 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 function. 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 functools
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar, cast
import pandas as pd
import numpy as np
P = ParamSpec('P')
R = TypeVar('R')
def select_active_variables(method: Callable[P, R]) -> Callable[P, R]:
@functools.wraps(method)
def _impl(self: Any, X: Any=None, *method_args: Any, **method_kwargs: Any) -> R:
if hasattr(self, 'feature_names_in_') and isinstance(X, pd.DataFrame):
return method(self, X[self.feature_names_in_], *method_args, **method_kwargs)
return method(self, X, *method_args, **method_kwargs)
return cast(Callable[P, R], _impl)
class MockModel:
"""A minimal sklearn-like model with feature_names_in_ attribute"""
def __init__(self):
self.feature_names_in_ = ['feat_a', 'feat_b']
@select_active_variables
def predict(self, X, *args, **kwargs):
"""Mock prediction method"""
return np.ones(len(X))
def mock_method(self, X, *args, **kwargs):
"""A simple method to be decorated"""
return X
# Create test data
df_data = pd.DataFrame({
'feat_a': [1.0, 2.0],
'feat_b': [3.0, 4.0],
'feat_c': [5.0, 6.0]
})
# Create instance with feature_names_in_ attribute
instance = MockModel()
# Build the decorator with the mock method
decorated_method = select_active_variables(mock_method)
ARGS = {
'method': mock_method
}
- 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| stylize_axis |
Ran ran on a synthesized input |
maxhalford/prince/prince/plot.py code served (permissive licence) · get_code("5ad83f57b4d2d2ec") 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 Axes. 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 matplotlib.pyplot as plt
from collections import OrderedDict
GRAY = OrderedDict([('light', '#bababa'), ('dark', '#404040')])
def stylize_axis(ax, grid=True):
if grid:
ax.grid()
ax.xaxis.set_ticks_position('none')
ax.yaxis.set_ticks_position('none')
ax.axhline(y=0, linestyle='-', linewidth=1.2, color=GRAY['dark'], alpha=0.6)
ax.axvline(x=0, linestyle='-', linewidth=1.2, color=GRAY['dark'], alpha=0.6)
return ax
fig, ax = plt.subplots()
ARGS = {
'ax': ax,
'grid': True
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- matplotlib — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Axes — a Axes output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Axes 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
|
| unscaled_procrustes |
Ran ran on a synthesized input |
maxhalford/prince/prince/gpa.py code served (permissive licence) · get_code("fa46e7074c2047ba") 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 3, 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.linalg import orthogonal_procrustes
# Create small distinct-sized arrays for reference and data
# reference: 5 points in 3 dimensions
# data: 5 points in 3 dimensions (same shape but different values to test alignment)
np.random.seed(0)
reference = np.array([
[1.0, 2.0, 3.0],
[2.0, 3.0, 4.0],
[3.0, 4.0, 5.0],
[4.0, 5.0, 6.0],
[5.0, 6.0, 7.0]
], dtype=np.double)
data = np.array([
[5.1, 4.9, 3.1],
[4.0, 5.1, 4.0],
[3.1, 3.9, 5.0],
[2.0, 4.0, 6.1],
[1.1, 5.9, 7.0]
], dtype=np.double)
ARGS = {
"reference": reference,
"data": data
}
- 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 tuple, ndim 3, 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
|
| load_energy_mix |
Not yet run unverified (harvested, no recorded run) |
maxhalford/prince/prince/datasets.py code served (permissive licence) · get_code("857609b1581915f0") How it ran |