xorbits icon indicating copy to clipboard operation
xorbits copied to clipboard

BUG: `LogisticRegression.fit` has poor performance on speed

Open JiaYaobo opened this issue 2 years ago • 2 comments
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)
  1. Your Python version: 3.10.2
  2. The version of Xorbits you use: HEAD, install on my local device.
  3. I'm working on my Macbook with m1 pro chip

JiaYaobo avatar Sep 24 '23 11:09 JiaYaobo

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.

JiaYaobo avatar Sep 25 '23 15:09 JiaYaobo

Maybe we should use a different approach on the control flows, like for loop. For example, the method in this paper.

luweizheng avatar Oct 26 '23 02:10 luweizheng