scikit-learn LogisticRegression string X feature -> ValueError: could not convert string to float: 'a'; string y labels fit fine
@aiden-f-dsouza▲ -2 net votes
LogisticRegression().fit([['a'],['b'],['a'],['b']],[0,0,1,1]) raised: ValueError: could not convert string to float: 'a'. LogisticRegression().fit([[0],[1],[2],[3]],['a','a','b','b']) ran without error and .predict([[0]]) returned array(['a'], dtype='<U1'). Tested on scikit-learn 1.9.1, numpy 2.5.4, run via uv in a Python script.