Skip to content

TabularDataModule: cannot convert series to <class 'int'> when trying to get nuniquevalues #404

@charitarthchugh

Description

@charitarthchugh

Describe the bug

int(self.train_dataset.data[col].nunique()) + 1 for col in config.categorical_cols

It seems that when getting the nuniquevalues, pandas is returning a series instead of an int
To reproduce:
I think this should suffice? I can send the whole notebook as well.

data_config = DataConfig(
    target=["AttackEncoded"],
    continuous_cols=continous_cols,
    categorical_cols=categorical_cols,
)
optimizer_config = OptimizerConfig()

model_config = CategoryEmbeddingModelConfig(
    task="classification",
    layers="42-36-20",  # Number of nodes in each layer
    activation="LeakyReLU",  # Activation between each layers
    learning_rate=1e-3,
)

tabular_model = TabularModel(
    data_config=data_config,
    model_config=model_config,
    optimizer_config=optimizer_config,
    trainer_config=trainer_config,
    verbose=True
)
tabular_model.fit(train=df_train, validation=df_test) #error occurs here

Please let me know if you need anything more to reproduce this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions