Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions mambular/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@

# The following line *must* be the last in the module, exactly as formatted:

__version__ = "1.3.1"

__version__ = "1.3.2"
6 changes: 6 additions & 0 deletions mambular/models/utils/sklearn_base_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import torch
from sklearn.metrics import accuracy_score, log_loss
from .sklearn_parent import SklearnBase
import numpy as np


class SklearnBaseClassifier(SklearnBase):
Expand Down Expand Up @@ -85,6 +86,8 @@ def build_model(
The built classifier.
"""

num_classes = len(np.unique(y))

return super()._build_model(
X,
y,
Expand All @@ -94,6 +97,7 @@ def build_model(
y_val=y_val,
embeddings=embeddings,
embeddings_val=embeddings_val,
num_classes=num_classes,
random_state=random_state,
batch_size=batch_size,
shuffle=shuffle,
Expand Down Expand Up @@ -190,6 +194,7 @@ def fit(
The fitted classifier.
"""

num_classes = len(np.unique(y))
return super().fit(
X=X,
y=y,
Expand All @@ -215,6 +220,7 @@ def fit(
train_metrics=train_metrics,
val_metrics=val_metrics,
rebuild=rebuild,
num_classes=num_classes,
**trainer_kwargs,
)

Expand Down
2 changes: 2 additions & 0 deletions mambular/models/utils/sklearn_base_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def build_model(
y_val=y_val,
embeddings=embeddings,
embeddings_val=embeddings_val,
num_classes=1,
random_state=random_state,
batch_size=batch_size,
shuffle=shuffle,
Expand Down Expand Up @@ -198,6 +199,7 @@ def fit(
y_val=y_val,
embeddings=embeddings,
embeddings_val=embeddings_val,
num_classes=1,
max_epochs=max_epochs,
random_state=random_state,
batch_size=batch_size,
Expand Down
4 changes: 4 additions & 0 deletions mambular/models/utils/sklearn_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def _build_model(
y_val=None,
embeddings=None,
embeddings_val=None,
num_classes: int = None,
random_state: int = 101,
batch_size: int = 128,
shuffle: bool = True,
Expand Down Expand Up @@ -223,6 +224,7 @@ def _build_model(
weight_decay=(
weight_decay if weight_decay is not None else self.config.weight_decay
),
num_classes=num_classes,
train_metrics=train_metrics,
val_metrics=val_metrics,
optimizer_type=self.optimizer_type,
Expand Down Expand Up @@ -273,6 +275,7 @@ def fit(
y_val=None,
embeddings=None,
embeddings_val=None,
num_classes: int = None,
max_epochs: int = 100,
random_state: int = 101,
batch_size: int = 128,
Expand Down Expand Up @@ -357,6 +360,7 @@ def fit(
y_val=y_val,
embeddings=embeddings,
embeddings_val=embeddings_val,
num_classes=num_classes,
random_state=random_state,
batch_size=batch_size,
shuffle=shuffle,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "mambular"

version = "1.3.1"
version = "1.3.2"

description = "A python package for tabular deep learning with mamba blocks."
authors = ["Anton Thielmann", "Manish Kumar", "Christoph Weisser"]
Expand Down