yobx.sklearn.linear_model.logistic_regression#
- yobx.sklearn.linear_model.logistic_regression.sklearn_logistic_regression(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: LogisticRegression | LogisticRegressionCV, X: str, name: str = 'logistic_regression') Tuple[str, str][source]#
Converts a
class sklearn.linear_model.LogisticRegressioninto ONNX.The graph structure depends on the number of classes.
Binary classification (
coef_.shape[0] == 1):X ──Gemm(coef, intercept)──► decision │ ┌────────┴────────┐ Sigmoid Sub(1, ·) │ │ proba_pos proba_neg └────────┬────────┘ Concat ──► probabilities │ ArgMax ──Cast──Gather(classes) ──► labelMulticlass (
coef_.shape[0] > 1):X ──Gemm(coef, intercept)──► decision │ Softmax ──► probabilities │ ArgMax ──Cast──Gather(classes) ──► label- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
LogisticRegressionoutputs – desired names (label, probabilities)
X – inputs
name – prefix names for the added nodes
- Returns:
tuple
(label_result_name, proba_result_name)