Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This package has compatibility issues with Python 3.13.x as mentioned in #488
Issue Analysis
The primary issue was a build failure in surprise/prediction_algorithms/co_clustering.pyx due to the use of np.int_t, which has been deprecated and removed in newer versions of NumPy's Cython interface. Additionally, Cython 3.x introduced stricter pickling requirements for classes defined in .pyx files when using typed features.
Fixes Implemented - Refactored co_clustering.pyx:
np.ndarraytype declarations with modern Cython typed memoryviews(long [::1], double [::1], etc.).compute_averagesmethod to a standalone function to prevent Cython from implicitly converting theCoClustering classinto a non-picklable extension type.np.asarray()before being stored as instance attributes(self.cltr_u, self.user_mean, etc.), resolving aTypeErrorduring pickling (dumping).Verification Results
I verified the fixes by building the package extensions and running the complete test suite:
Build: Successfully compiled all Cython extensions on Python 3.13.3.
Tests: All 82 tests passed, including specific tests for algorithm convergence and model dumping/loading.