xorbits
xorbits copied to clipboard
BUG: `LogisticRegression.fit` has poor performance on speed
trafficstars
Describe the bug
LogisticRegression.fit never stops with a bit larger data.
To Reproduce
When max_iter=1 everything works fine
from xorbits._mars.learn.glm import LogisticRegression
import numpy as np
n_rows = 100
n_cols = 2
X = np.random.randn(n_rows, n_cols)
y = np.random.randint(0, 2, n_rows)
lr = LogisticRegression(max_iter=1)
lr.fit(X, y)
However, just increase max_iter to 100, the program seems never stop (at least after 1min, it's weird.)
lr = LogisticRegression(max_iter=100)
lr.fit(X, y)
- Your Python version: 3.10.2
- The version of Xorbits you use: HEAD, install on my local device.
- I'm working on my Macbook with m1 pro chip
After some inspection, https://github.com/mars-project/mars/issues/2505#issue-1021662005 perhaps explain it, gradient based loop solution for logistic regression is inefficient for xorbits.
Maybe we should use a different approach on the control flows, like for loop. For example, the method in this paper.