sklearn-onnx
sklearn-onnx copied to clipboard
Converter for pyod.models.feature_bagging.FeatureBagging
Is it possible to get converter and shape calculator for pyod feature bagging? https://pyod.readthedocs.io/en/latest/_modules/pyod/models/feature_bagging.html
import pandas as pd
from pyod.models.feature_bagging import FeatureBagging
from sklearn.preprocessing import MinMaxScaler
from onnxmltools.convert.common.data_types import FloatTensorType
from skl2onnx import to_onnx
data = {'First': [500,500,400,100,200,300,100,500,500,400,100,200,300,100,200,300,100,500,500,400,100,200],
'Second': ['a','b','a','b','a','b','c','a','b','a','b','a','b','c','a','b','c','a','b','a','b','c']}
df = pd.DataFrame(data,columns=['First','Second'])
dumdf = pd.get_dummies(df)
scaler = MinMaxScaler()
scaler.partial_fit(dumdf)
sc_data = scaler.transform(dumdf)
# pip install combo
fb_clf = FeatureBagging(n_estimators=10, contamination=0.1).fit(sc_data)
feature_names = dumdf.columns
initial_type = [('float_input', FloatTensorType([None, len(feature_names)]))]
FBOnnx_model = to_onnx(fb_clf, initial_types=initial_type)
I understand there are lot of algorithms where all of them cannot be supported, Just would like to know the possibility, Thank you very much
Sorry for the later answer. FeaureBagging is outside ot scikit-learn and that's out of the library scope. It could be possible to add it to the documentation as an example. It could help if you would have a function written in numpy equivalent to FeatureBagging.decision_function
.