Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Dupre <[email protected]>
  • Loading branch information
xadupre committed Jul 28, 2023
1 parent 93c26be commit a4074cb
Show file tree
Hide file tree
Showing 27 changed files with 339 additions and 173 deletions.
7 changes: 3 additions & 4 deletions docs/examples/plot_convert_lightgbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
+++++++++++++
"""

import os
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer
import numpy
import onnx
import sklearn
Expand Down Expand Up @@ -83,9 +85,6 @@
# ++++++++++++++++++++++
#
# Finally, let's see the graph converted with *onnxmltools*.
import os
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer

pydot_graph = GetPydotGraph(
onx.graph,
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/plot_convert_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
A very basic example using random forest and
the iris dataset.
"""

import os
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer
import numpy
import onnx
import sklearn
Expand Down Expand Up @@ -93,9 +95,6 @@
# ++++++++++++++++++++++
#
# Finally, let's see the graph converted with *onnxmltools*.
import os
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer

pydot_graph = GetPydotGraph(
onx.graph,
Expand Down
8 changes: 3 additions & 5 deletions docs/examples/plot_convert_sparkml.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
+++++++++++++
"""

import os
import numpy
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer
from pandas import DataFrame
import onnx
import sklearn
Expand All @@ -29,8 +32,6 @@
import onnxruntime as rt
import pyspark
from pyspark.sql import SparkSession
from pyspark.ml.classification import LogisticRegression
from pyspark.ml.classification import LogisticRegression
from pyspark.ml.feature import VectorAssembler, StringIndexer
import onnxmltools
from onnxconverter_common.data_types import FloatTensorType
Expand Down Expand Up @@ -114,9 +115,6 @@ def stop_spark(spark):
# ++++++++++++++++++++++
#
# Finally, let's see the graph converted with *onnxmltools*.
import os
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer

pydot_graph = GetPydotGraph(
onx.graph,
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/plot_convert_xgboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
+++++++++++++
"""

import os
import numpy
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer
import onnx
import sklearn
from sklearn.datasets import load_iris
Expand Down Expand Up @@ -84,9 +86,6 @@
# ++++++++++++++++++++++
#
# Finally, let's see the graph converted with *onnxmltools*.
import os
import matplotlib.pyplot as plt
from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer

pydot_graph = GetPydotGraph(
onx.graph,
Expand Down
9 changes: 6 additions & 3 deletions onnxmltools/convert/common/_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class H2OModelContainer(CommonSklearnModelContainer):
class SparkmlModelContainer(RawModelContainer):
def __init__(self, sparkml_model):
super(SparkmlModelContainer, self).__init__(sparkml_model)
# Sparkml models have no input and output specified, so we create them and store them in this container.
# Sparkml models have no input and output specified,
# so we create them and store them in this container.
self._inputs = []
self._outputs = []

Expand All @@ -34,12 +35,14 @@ def output_names(self):
return [variable.raw_name for variable in self._outputs]

def add_input(self, variable):
# The order of adding variables matters. The final model's input names are sequentially added as this list
# The order of adding variables matters. The final model's
# input names are sequentially added as this list
if variable not in self._inputs:
self._inputs.append(variable)

def add_output(self, variable):
# The order of adding variables matters. The final model's output names are sequentially added as this list
# The order of adding variables matters.
# The final model's output names are sequentially added as this list
if variable not in self._outputs:
self._outputs.append(variable)

Expand Down
3 changes: 2 additions & 1 deletion onnxmltools/convert/common/interface.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

# This file defines the interface of the converter internal object for callback,
# So the usage of the methods and properties list here will not be affected among the different versions.
# So the usage of the methods and properties list here
# will not be affected among the different versions.

from onnxconverter_common.interface import * # noqa
Loading

0 comments on commit a4074cb

Please sign in to comment.