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

Commit

Permalink
fixed name of datasets in train and predict scripts (#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Akira Ura <ura.akira@jp.fujitsu.com>
  • Loading branch information
AkiraUra authored Sep 11, 2023
1 parent b7194e9 commit 6fb4127
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
8 changes: 0 additions & 8 deletions sapientml_loaddata/templates/loaddata_predict.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@ import pandas as pd
ignore_columns = {{ dataset.ignore_columns }}
{% endif %}

{% if dataset.test_data_path %}
{% if dataset.test_data_path.endswith(".pkl") %}
__test_dataset = pd.read_pickle("{{ dataset.test_data_path }}")
{% else %}
__test_dataset = pd.read_csv("{{ dataset.test_data_path }}", encoding="{{ dataset.csv_encoding }}", delimiter="{{ dataset.csv_delimiter }}")
{% endif %}
{% else %}{# It is assumed that test data has the same format as train data #}
{% if dataset.training_data_path.endswith(".pkl") %}
__test_dataset = pd.read_pickle("./test.pkl")
{% else %}
__test_dataset = pd.read_csv("./test.csv", encoding="{{ dataset.csv_encoding }}", delimiter="{{ dataset.csv_delimiter }}")
{% endif %}
{% endif %}
__test_dataset_prediction_columns = __test_dataset
{% if dataset.ignore_columns %}
__test_dataset = __test_dataset.drop(ignore_columns, axis=1, errors="ignore")
Expand Down
15 changes: 2 additions & 13 deletions sapientml_loaddata/templates/loaddata_train.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,11 @@ ignore_columns = {{ dataset.ignore_columns }}
{% endif %}

{% if dataset.training_data_path.endswith(".pkl") %}
__train_dataset = pd.read_pickle("{{ dataset.training_data_path }}")
__train_dataset = pd.read_pickle("./training.pkl")
{% else %}
__train_dataset = pd.read_csv("{{ dataset.training_data_path }}", encoding="{{ dataset.csv_encoding }}", delimiter="{{ dataset.csv_delimiter }}")
__train_dataset = pd.read_csv("./training.csv", encoding="{{ dataset.csv_encoding }}", delimiter="{{ dataset.csv_delimiter }}")
{% endif %}
{% if dataset.ignore_columns %}
__train_dataset = __train_dataset.drop(ignore_columns, axis=1, errors="ignore")
{% endif %}

{% if dataset.validation_data_path %}
{% if dataset.validation_data_path.endswith(".pkl") %}
__validation_dataset = pd.read_pickle("{{ dataset.validation_data_path }}")
{% else %}
__validation_dataset = pd.read_csv("{{ dataset.validation_data_path }}", encoding="{{ dataset.csv_encoding }}", delimiter="{{ dataset.csv_delimiter }}")
{% endif %}
{% if dataset.ignore_columns %}
__validation_dataset = __validation_dataset.drop(ignore_columns, axis=1, errors="ignore")
{% endif %}
__train_dataset = pd.concat([__train_dataset, __validation_dataset]).reset_index(drop=True)
{% endif %}{# if dataset.validation_data_path #}

0 comments on commit 6fb4127

Please sign in to comment.