Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit 1cd2ad5

Browse files
committed
fixes from testing
1 parent f5aaa7a commit 1cd2ad5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sapientml_loaddata/generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def generate_code(self, dataset: Dataset, task: Task):
4545
code.predict += _render(tpl, dataset=dataset, task=task, script_type="predict")
4646

4747
tpl = template_env.get_template("split.py.jinja")
48-
code.validation += _render(tpl, task=task, validation=True)
49-
code.test += _render(tpl, task=task, validation=False)
48+
code.validation += _render(tpl, dataset=dataset, task=task, validation=True)
49+
code.test += _render(tpl, dataset=dataset, task=task, validation=False)
5050

5151
tpl = template_env.get_template("subsample.py.jinja")
5252
code.validation += _render(tpl, task=task, sample_size=ROW_THRESHOLD_FOR_SAMPLING)

sapientml_loaddata/templates/split.py.jinja

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% if (validation and (not dataset.validation_data_path)) or ((not validation) and (not dataset.test_data_path)) %}
2+
13
# TRAIN-TEST SPLIT
24
{% if task.split_method == "random" %}
35
{% if task.split_stratify == True %}
@@ -35,10 +37,11 @@ def split_dataset(dataset, split_column_name="{{ task.split_column_name }}", spl
3537
train_dataset.loc[:, col] = False
3638
return train_dataset, test_dataset
3739
{% endif %}
38-
{% if not task.test_dataset_path %}
40+
{% if not dataset.test_data_path %}
3941
__train_dataset, __test_dataset = split_dataset(__train_dataset)
4042
{% endif %}
41-
{% if validation and (not task.validation_dataset_path) %}
43+
{% endif %}
44+
{% if validation and (not dataset.validation_data_path) %}
4245
__train_dataset, __validation_dataset = split_dataset(__train_dataset)
4346
{% endif %}
4447
{% if validation %}

0 commit comments

Comments
 (0)