Skip to content

Commit

Permalink
fixed hashing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
simplymathematics committed Aug 13, 2024
1 parent 4490435 commit a38ed17
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions deckard/base/model/sklearn_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)


from ..utils import Hashable
from ..utils import my_hash

__all__ = ["SklearnModelPipelineStage", "SklearnModelPipeline"]
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -140,7 +140,9 @@ def __len__(self):

def __iter__(self):
return iter(self.pipeline)

def __hash__(self):
return int(my_hash(self), 16)

def __call__(self, model):
params = deepcopy(asdict(self))
pipeline = params.pop("pipeline")
Expand Down Expand Up @@ -206,6 +208,9 @@ class SklearnModelInitializer(Hashable):
pipeline: SklearnModelPipeline = field(default_factory=None)
kwargs: Union[dict, None] = field(default_factory=dict)

def __hash__(self):
return int(my_hash(self), 16)

def __init__(self, data, model=None, library="sklearn", pipeline={}, **kwargs):
self.data = data
self.model = model
Expand Down

0 comments on commit a38ed17

Please sign in to comment.