Skip to content

Commit

Permalink
Merge pull request byzer-org#313 from wuheyi/fix_model_explain_python…
Browse files Browse the repository at this point in the history
…_file_not_found

[update] 更新线上python资源文件
  • Loading branch information
allwefantasy authored Jul 2, 2018
2 parents fac30f9 + f21fb57 commit 3aa5fa1
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 946 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
import json
import numpy as np
import pickle
def save_attributes(model_file, attributes_file):
with open(model_file, 'rb') as fr:
model = pickle.load(fr)
attribute_dict_numpy = {k: repr(v.tolist()).replace("\n", "").replace(" ", "") for (k, v) in model.__dict__.items() if (type(v) == np.ndarray)}
attribute_dict_normal = {k: repr(v) for (k, v) in model.__dict__.items() if (type(v) != np.ndarray)}
attribute_dict = dict(attribute_dict_numpy, **attribute_dict_normal)
attribute_json = json.dumps(attribute_dict)
with open(attributes_file, 'w') as f:
f.write(attribute_json)
params_file = os.path.join(os.getcwd(), "python_temp.pickle")

model_path = ""
tempModelLocalPath = ""
with open(params_file, 'rb', 1 << 20) as f:
params = pickle.load(f)
if "modelPath" in params:
model_path = params["modelPath"]
if "internalSystemParam" in params:
isp = params["internalSystemParam"]
if "tempModelLocalPath" not in isp:
raise Exception("tempModelLocalPath is not configured")
tempModelLocalPath = isp["tempModelLocalPath"]


save_attributes(model_path, tempModelLocalPath + "/attributes.json")

This file was deleted.

289 changes: 0 additions & 289 deletions streamingpro-mlsql/src/main/resources-online/python/python/mlsql.py

This file was deleted.

Loading

0 comments on commit 3aa5fa1

Please sign in to comment.