Skip to content

Commit

Permalink
fix count for new polars
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Dec 22, 2023
1 parent 9ce6224 commit 7f0e920
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions inst/python/Dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, data, labels=None, numerical_features=None):

# numerical data,
# N x C, dense matrix with values for N patients/visits for C numerical features
if pl.count(self.numerical_features) == 0:
if self.numerical_features.count() == 0:
self.num = None
else:
map_numerical = dict(
Expand Down Expand Up @@ -100,7 +100,7 @@ def __init__(self, data, labels=None, numerical_features=None):
self.num = torch.sparse_coo_tensor(
indices=indices.T,
values=values.squeeze(),
size=(observations, pl.count(self.numerical_features)),
size=(observations, self.numerical_features.count()),
).to_dense()
delta = time.time() - start
print(f"Processed data in {delta:.2f} seconds")
Expand Down Expand Up @@ -128,3 +128,8 @@ def __getitem__(self, item):
):
batch["num"] = batch["num"].unsqueeze(0)
return [batch, self.target[item].squeeze()]





0 comments on commit 7f0e920

Please sign in to comment.