Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/tests_extended/data_frame_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def execute(self, df, output_names=None, output_types=None, run_options=None):
continue

r = np.split(r, r.shape[-1], axis=-1) \
if r.shape[-1] > 1 else [r]
if (r.shape[-1] > 1 and r.shape[0] > 1) else [r]

for suffix, col in enumerate(r):
col = col.flatten()
Expand Down
4 changes: 1 addition & 3 deletions src/python/tests_extended/test_export_to_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
SsaForecaster)
from data_frame_tool import DataFrameTool as DFT


SHOW_ONNX_JSON = False
SHOW_TRANSFORMED_RESULTS = True
SHOW_FULL_PANDAS_OUTPUT = False
Expand Down Expand Up @@ -580,7 +579,6 @@ def test_export_to_onnx(estimator, class_name):
try:
onnxrunner = OnnxRunner(model_file=onnx_path)
result_onnx = onnxrunner.fit_transform(dataset)

df_tool = DFT(onnx_path)
result_ort = df_tool.execute(dataset, [])

Expand Down Expand Up @@ -615,7 +613,7 @@ def test_export_to_onnx(estimator, class_name):
for entry_point in entry_points:
class_name = entry_point['NewName']

# if not class_name in ['Handler']:
# if not class_name in ['FastLinearClassifier']:
# continue

print('\n===========> %s' % class_name)
Expand Down
38 changes: 25 additions & 13 deletions src/python/tests_extended/vinod.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import os
import time
import tempfile
import nimbusml.linear_model as nml_linear
from nimbusml.feature_extraction.categorical import OneHotVectorizer
from nimbusml.preprocessing.missing_values import Handler
from nimbusml import FileDataStream
from nimbusml.preprocessing import DatasetTransformer
from nimbusml.preprocessing.schema import ColumnSelector
from nimbusml import Pipeline
from nimbusml.preprocessing import OnnxRunner
from data_frame_tool import DataFrameTool as DFT

def get_tmp_file(suffix=None):
fd, file_name = tempfile.mkstemp(suffix=suffix)
Expand Down Expand Up @@ -38,26 +41,35 @@ def get_tmp_file(suffix=None):
print('export done')

# Perform the transform using the standard ML.Net backend
result_standard = pipe_training.transform(X_test_dprep)
start = time.time()
result_standard = pipe_training.predict(X_test_dprep)
end = time.time()
print(result_standard)
print('done transform using standard backend')
# c1 c2
# 0 0.025025 0.000998
# 1 0.305305 0.000998
print('%ss done transform using standard backend' % round(end - start, 3))

# Perform the transform using the ONNX backend.
# Note, the extra columns and column name differences
# is a known issue with the ML.Net backend.
onnxrunner = OnnxRunner(model_file=onnx_path)
result_onnx = onnxrunner.fit_transform(X_test_dprep)
print('done transform using onnx backend')
print(result_onnx)
# c1 c2 c12.0 c22.0
# 0 2.5 1.0 0.025025 0.000998
# 1 30.5 1.0 0.305305 0.000998
onnxrunner = Pipeline([OnnxRunner(model_file=onnx_path),
ColumnSelector(columns=['Score'])])
# Performance issue, commenting out for now
#start = time.time()
#result_onnx = onnxrunner.fit_transform(X_test_dprep, as_binary_data_stream=True)
#end = time.time()
#print(result_onnx.head(5))
#print('%ss done transform using onnx backend' % round(end - start, 3))

df_tool = DFT(onnx_path)
dataset = X_test_dprep.to_df()
start = time.time()
result_ort = df_tool.execute(dataset, [])
end = time.time()
print(result_ort)
print('%ss done transform using ORT backend (excludes df load time)' % round(end - start, 3))


except Exception as e:
print('tragedy')
print('=============== ERROR =================')
print(e)

print ("done")
6 changes: 3 additions & 3 deletions src/python/tools/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1903,9 +1903,9 @@
}
},
{
"Name": "SupressScoresAndLabels",
"Name": "SuppressScoresAndLabels",
"Type": "Bool",
"Desc": "Supress labels and scores in per-instance outputs?",
"Desc": "Suppress labels and scores in per-instance outputs?",
"Aliases": [
"noScores"
],
Expand Down Expand Up @@ -23945,7 +23945,7 @@
{
"Name": "SupressTypeErrors",
"Type": "Bool",
"Desc": "Supress the errors that would occur if a column and impute mode are imcompatible. If true, will skip the column. If false, will stop and throw an error.",
"Desc": "Suppress the errors that would occur if a column and impute mode are incompatible. If true, will skip the column. If false, will stop and throw an error.",
"Aliases": [
"error"
],
Expand Down