From 3f97bfe96f43daa5e640f73763019446ee240b21 Mon Sep 17 00:00:00 2001 From: Lennart Purucker Date: Wed, 22 Jan 2025 10:36:14 +0100 Subject: [PATCH] fix: make fingerprint feature deterministic --- src/tabpfn/model/preprocessing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tabpfn/model/preprocessing.py b/src/tabpfn/model/preprocessing.py index 9575b5f2..ceecc8dd 100644 --- a/src/tabpfn/model/preprocessing.py +++ b/src/tabpfn/model/preprocessing.py @@ -2,6 +2,7 @@ from __future__ import annotations +import hashlib import warnings from abc import abstractmethod from collections import UserList @@ -474,8 +475,7 @@ def _transform(self, X: np.ndarray, *, is_test: bool = False) -> np.ndarray: def float_hash_arr(arr: np.ndarray) -> float: - b = arr.tobytes() - _hash = hash(b) + _hash = int(hashlib.sha256(arr.tobytes()).hexdigest(), 16) return _hash % _CONSTANT / _CONSTANT