From 79ab1697a7a41ba88a8c0b39ba70fd33a11bbfd3 Mon Sep 17 00:00:00 2001
From: Matteo Interlandi Converters for scikit-learn linear models: LinearRegression, LogisticRegression, LinearSVC, SGDClassifier, LogisticRegressionCV. Converter for scikit-learn MissingIndicator. Converters for scikit-learn MLP models: MLPClassifier Defines the computation performed at every call. Should be overridden by all subclasses. Note Although the recipe for forward pass needs to be defined within
-this function, one should call the :class:
Expand source code
-Browse git
+Browse git
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
diff --git a/doc/html/hummingbird/ml/operator_converters/sklearn/index.html b/doc/html/hummingbird/ml/operator_converters/sklearn/index.html
index 8161d6d5..010b688d 100644
--- a/doc/html/hummingbird/ml/operator_converters/sklearn/index.html
+++ b/doc/html/hummingbird/ml/operator_converters/sklearn/index.html
@@ -66,6 +66,10 @@ All scikit-learn operators converters are stored under this package.
hummingbird.ml.operator_converters.sklearn.missing_indicator
hummingbird.ml.operator_converters.sklearn.mlp
hummingbird.ml.operator_converters.sklearn.gbdt
hummingbird.ml.operator_converters.sklearn.iforest
hummingbird.ml.operator_converters.sklearn.linear
hummingbird.ml.operator_converters.sklearn.missing_indicator
hummingbird.ml.operator_converters.sklearn.mlp
hummingbird.ml.operator_converters.sklearn.nb
hummingbird.ml.operator_converters.sklearn.normalizer
Methods
-def forward(self, x)
+def forward(self, x) -> Callable[..., Any]
Module
instance afterwards
-instead of this since the former takes care of running the
-registered hooks while the latter silently ignores them.
Expand source code
diff --git a/doc/html/hummingbird/ml/operator_converters/sklearn/pipeline.html b/doc/html/hummingbird/ml/operator_converters/sklearn/pipeline.html
index c200b1e4..e8d4b84d 100644
--- a/doc/html/hummingbird/ml/operator_converters/sklearn/pipeline.html
+++ b/doc/html/hummingbird/ml/operator_converters/sklearn/pipeline.html
@@ -26,7 +26,7 @@
Expand source code
-Browse git
+Browse git
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -88,6 +88,8 @@ def convert_sklearn_array_feature_extractor(operator, device, extra_config):
assert operator is not None
indices = operator.column_indices
+ if any([type(i) is bool for i in indices]):
+ indices = [i for i in range(len(indices)) if indices[i]]
return ArrayFeatureExtractor(np.ascontiguousarray(indices), device)
@@ -161,7 +163,7 @@ register_converter("SklearnMultiply", convert_sklearn_multiply)
Expand source code
-Browse git
+Browse git
def convert_sklearn_array_feature_extractor(operator, device, extra_config):
"""
@@ -178,6 +180,8 @@ register_converter("SklearnMultiply", convert_sklearn_multiply)
assert operator is not None
indices = operator.column_indices
+ if any([type(i) is bool for i in indices]):
+ indices = [i for i in range(len(indices)) if indices[i]]
return ArrayFeatureExtractor(np.ascontiguousarray(indices), device)
Expand source code
-Browse git
+Browse git
def convert_sklearn_concat(operator, device=None, extra_config={}):
"""
@@ -242,7 +246,7 @@ register_converter("SklearnMultiply", convert_sklearn_multiply)
Expand source code
-Browse git
+Browse git
def convert_sklearn_multiply(operator, device=None, extra_config={}):
"""
diff --git a/doc/html/hummingbird/ml/supported.html b/doc/html/hummingbird/ml/supported.html
index 67654b5f..663bd544 100644
--- a/doc/html/hummingbird/ml/supported.html
+++ b/doc/html/hummingbird/ml/supported.html
@@ -70,7 +70,7 @@ XGBRegressor
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -170,7 +170,6 @@ def _build_sklearn_operator_list():
# SVM-based models
from sklearn.svm import LinearSVC, SVC, NuSVC
-
# Imputers
from sklearn.impute import MissingIndicator
@@ -180,7 +179,6 @@ def _build_sklearn_operator_list():
# Naive Bayes Models
from sklearn.naive_bayes import BernoulliNB, GaussianNB, MultinomialNB
-
# Preprocessing
from sklearn.preprocessing import (
Binarizer,
@@ -458,9 +456,7 @@ CONTAINER = "container"
Expand source code
-
-Browse git
-
+Browse git
def get_onnxml_api_operator_name(model_type):
"""
@@ -497,9 +493,7 @@ or an object with scikit-learn API (e.g., LightGBM)
Expand source code
-
-Browse git
-
+Browse git
def get_sklearn_api_operator_name(model_type):
"""
diff --git a/hummingbird/ml/operator_converters/sklearn/pipeline.py b/hummingbird/ml/operator_converters/sklearn/pipeline.py
index 00c33642..06950f49 100644
--- a/hummingbird/ml/operator_converters/sklearn/pipeline.py
+++ b/hummingbird/ml/operator_converters/sklearn/pipeline.py
@@ -58,6 +58,8 @@ def convert_sklearn_array_feature_extractor(operator, device, extra_config):
assert operator is not None
indices = operator.column_indices
+ if any([type(i) is bool for i in indices]):
+ indices = [i for i in range(len(indices)) if indices[i]]
return ArrayFeatureExtractor(np.ascontiguousarray(indices), device)