mars icon indicating copy to clipboard operation
mars copied to clipboard

Add support for LogisticRegression

Open wuyeguo opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Implements LogisticRegression for Logistic Regression (aka logit, MaxEnt) classifier: API Like:https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html the param i need:

  • penalty {‘l1’, ‘l2’, ‘elasticnet’, ‘none’}, default=’l2’
    • Specify the norm of the penalty:
  • C float, default=1.0
    • Inverse of regularization strength; must be a positive float. Like in support vector machines, smaller values specify stronger regularization.
  • class_weight dict or ‘balanced’, default=None
    • Weights associated with classes in the form {class_label: weight}. If not given, all classes are supposed to have weight one.
  • solver {‘newton-cg’, ‘lbfgs’, ‘liblinear’, ‘sag’, ‘saga’}, default=’lbfgs’
    • Algorithm to use in the optimization problem. Default is ‘lbfgs’. To choose a solver, you might want to consider the following aspects:
    • like:lbfgs, saga
  • multi_class {‘auto’, ‘ovr’, ‘multinomial’}, default=’auto’
    • If the option chosen is ‘ovr’, then a binary problem is fit for each label. For ‘multinomial’ the loss minimised is the multinomial loss fit across the entire probability distribution, even when the data is binary. ‘multinomial’ is unavailable when solver=’liblinear’. ‘auto’ selects ‘ovr’ if the data is binary, or if solver=’liblinear’, and otherwise selects ‘multinomial’.
  • l1_ratio float, default=None
    • The Elastic-Net mixing parameter, with 0 <= l1_ratio <= 1. Only used if penalty='elasticnet'. Setting l1_ratio=0 is equivalent to using penalty='l2', while setting l1_ratio=1 is equivalent to using penalty='l1'. For 0 < l1_ratio <1, the penalty is a combination of L1 and L2.

wuyeguo avatar Feb 21 '22 10:02 wuyeguo

Perhaps not all solvers can be implemented as a distributed algorithm, do you need all solvers or just the one can work?

qinxuye avatar Feb 21 '22 10:02 qinxuye

just lbfgs is ok, if saga can be implemented is better

wuyeguo avatar Feb 21 '22 10:02 wuyeguo

class_weight and l1_ratio are not supported by now.

The other parts look good to work, we will try to implement the absent algo and optimize the performance.

qinxuye avatar Feb 24 '22 03:02 qinxuye