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

Write splits for sparse data into sparse arff format #376

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
5 changes: 3 additions & 2 deletions amlb/datasets/openml.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from ..data import AM, DF, Dataset, DatasetType, Datasplit, Feature
from ..resources import config as rconfig
from ..utils import as_list, lazy_property, path_from_split, profile, split_path, unsparsify
from ..utils import as_list, is_sparse, lazy_property, path_from_split, profile, split_path, unsparsify


log = logging.getLogger(__name__)
Expand Down Expand Up @@ -248,11 +248,12 @@ def _save_split(self, df, path, name):
else 'STRING'
))
for c, dt in zip(df.columns, df.dtypes)]
data = sp.coo_matrix(df.values) if is_sparse(df) else df.values
arff.dump(dict(
description=description,
relation=name,
attributes=attributes,
data=df.values
data=data
), file)

def _is_numeric(self, col):
Expand Down