Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsparsify target variables for (Tuned)RF #425

Merged
merged 2 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frameworks/RandomForest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from amlb.benchmark import TaskConfig
from amlb.data import Dataset
from amlb.utils import call_script_in_same_dir
from amlb.utils import call_script_in_same_dir, unsparsify


def setup(*args, **kwargs):
Expand All @@ -14,6 +14,7 @@ def run(dataset: Dataset, config: TaskConfig):
encode = config.framework_params.get('_encode', True)
X_train, X_test = impute_array(dataset.train.X_enc, dataset.test.X_enc) if encode else (dataset.train.X, dataset.test.X)
y_train, y_test = (dataset.train.y_enc, dataset.test.y_enc) if encode else (dataset.train.y, dataset.test.y)
y_train, y_test = unsparsify(y_train, y_test)
data = dict(
train=dict(
X=X_train,
Expand Down
4 changes: 2 additions & 2 deletions frameworks/TunedRandomForest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from amlb.benchmark import TaskConfig
from amlb.data import Dataset
from amlb.utils import call_script_in_same_dir
from amlb.utils import call_script_in_same_dir, unsparsify


def setup(*args, **kwargs):
Expand All @@ -12,7 +12,7 @@ def run(dataset: Dataset, config: TaskConfig):
from frameworks.shared.caller import run_in_venv

X_train, X_test = impute_array(dataset.train.X_enc, dataset.test.X_enc)
y_train, y_test = (dataset.train.y_enc, dataset.test.y_enc)
y_train, y_test = unsparsify(dataset.train.y_enc, dataset.test.y_enc)
data = dict(
train=dict(
X=X_train,
Expand Down
2 changes: 1 addition & 1 deletion frameworks/shared/caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def run_in_venv(caller_file, script_file: str, *args,
ser_config = options['serialization']
env = options['env'] or ns()

with TemporaryDirectory() as tmpdir:
with TemporaryDirectory(prefix='amlb_', suffix='_xproc') as tmpdir:

ds = _make_input_dataset(input_data, dataset, tmpdir, serialization=ser_config)

Expand Down