-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ValueError: buffer source array is read-only in check_estimator #28026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like you have an old scikit-learn. Also the Cython version is pretty old. I think that we solved this issue in main and with newer Cython version. |
Uhm actually I can reproduce with |
It seems that one of the checks is to check that |
@jilljenn Except from the import numpy as np
import scipy.sparse as sp
from sklearn.base import BaseEstimator
from sklearn.datasets import dump_svmlight_file
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils.validation import check_is_fitted
class FMClassifier(BaseEstimator):
def __init__(self):
super().__init__()
def fit(self, X, y):
with open("tmp.txt", "wb") as f:
dump_svmlight_file(X, y, f)
self._is_fitted = True
return self
def predict_proba(self, X):
check_is_fitted(self)
if sp.issparse(X):
raise TypeError("Sparse data is not accepted")
return np.zeros(len(X))
def __sklearn_is_fitted__(self):
return hasattr(self, "_is_fitted") and self._is_fitted
def _more_tags(self):
return {"no_validation": True}
if __name__ == "__main__":
check_estimator(FMClassifier()) |
Describe the bug
I am trying to make a scikit-learn estimator
FMClassifier
based on Python wrapperpyWFM
for C++ librarylibFM
(yes 😅).Possibly related issues:
Steps/Code to Reproduce
Expected Results
Well I should get to the next error, should I? If it's illegal to write into memory (makes sense) then could it be written in the documentation somewhere?
Actual Results
Versions
The text was updated successfully, but these errors were encountered: