Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into master-dl
- Loading branch information
Showing
358 changed files
with
289,633 additions
and
21,632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Binary file added
BIN
+9.98 KB
...mple_ALSRecommend.csv/part-00000-41d44bb8-3671-405e-befb-115f0e2eb1f0-c000.snappy.parquet
Binary file not shown.
Empty file.
Binary file added
BIN
+12.2 KB
...load/sample_ANOVA.csv/part-00000-5c60a788-b1c9-4953-9b5a-6b3e43bcc2ab-c000.snappy.parquet
Binary file not shown.
Empty file.
Binary file added
BIN
+1.07 KB
...laceMissingNumber.csv/part-00000-ec8f2016-4f54-45b5-9b1b-e2a07cbd10ca-c000.snappy.parquet
Binary file not shown.
Empty file.
Binary file added
BIN
+2.95 KB
...meSeriesDistance1.csv/part-00000-a732ff5b-9333-49bf-ba2c-8d42784d7fc0-c000.snappy.parquet
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added
BIN
+52 Bytes
...ple_ner_crf_train.csv/.part-00001-3cccdfea-037a-4f0d-b985-cd41eb8e501c.snappy.parquet.crc
Binary file not shown.
Binary file added
BIN
+5.35 KB
...d/sample_ner_crf_train.csv/part-00001-3cccdfea-037a-4f0d-b985-cd41eb8e501c.snappy.parquet
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added
BIN
+64 Bytes
...d/sample_text_kor.csv/.part-00001-c1430b07-c6a1-4bae-958c-f093a2e72259.snappy.parquet.crc
Binary file not shown.
Binary file added
BIN
+6.79 KB
...upload/sample_text_kor.csv/part-00001-c1430b07-c6a1-4bae-958c-f093a2e72259.snappy.parquet
Binary file not shown.
Binary file added
BIN
+12 Bytes
...mple_ts_user_dict.csv/.part-00001-6be200ad-5a0a-4066-a886-7d594c44c246.snappy.parquet.crc
Binary file not shown.
Binary file added
BIN
+390 Bytes
...ad/sample_ts_user_dict.csv/part-00001-6be200ad-5a0a-4066-a886-7d594c44c246.snappy.parquet
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Copyright 2019 Samsung SDS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
def to_json(data, for_redis=False): | ||
from .encoder import encode | ||
return encode(data, for_redis) | ||
|
||
|
||
def from_json(json_str): | ||
from .decoder import decode | ||
return decode(json_str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
Copyright 2019 Samsung SDS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
import json | ||
import pickle | ||
import numpy | ||
|
||
|
||
def decode(obj): | ||
def redis_read_hook(o): | ||
if '__inf__' in o: | ||
return float(o['__inf__']) | ||
if '__set__' in o: | ||
return set(o['__set__']) | ||
if '__tuple__' in o: | ||
return tuple(o['__tuple__']) | ||
if '__numpy__' in o: | ||
return numpy.array(o['__numpy__']) | ||
# TODO add more support types | ||
if '__pickled__' in o: | ||
import array | ||
return pickle.loads(array.array('B', o['__pickled__']).tobytes()) | ||
return o | ||
|
||
return json.loads(obj, object_hook=redis_read_hook) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
""" | ||
Copyright 2019 Samsung SDS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
import json | ||
import pickle | ||
import numpy | ||
import pandas as pd | ||
from brightics.common.repr import BrtcReprBuilder | ||
|
||
def _to_default_list(np_arr): | ||
return numpy.where(pd.isnull(np_arr), None, np_arr).tolist() | ||
|
||
class DefaultEncoder(json.JSONEncoder): | ||
""" | ||
DefaultEncoder is used for building viewable json string for in browser | ||
""" | ||
|
||
def default(self, obj): | ||
# TODO add more support types | ||
if isinstance(obj, set): | ||
return list(obj) | ||
elif isinstance(obj, numpy.ndarray): | ||
return _to_default_list(obj) | ||
else: | ||
rb = BrtcReprBuilder() | ||
rb.addRawTextMD(str(obj)) | ||
return {'type':'python object', '_repr_brtc_':rb.get()} | ||
|
||
|
||
class PickleEncoder(DefaultEncoder): | ||
""" | ||
PickleEncoder is used for building json string saved in redis | ||
""" | ||
|
||
def encode(self, obj): | ||
|
||
def hint_tuples(item): | ||
if isinstance(item, tuple): | ||
new_tuple = [] | ||
for i in item: | ||
if (isinstance(i,numpy.floating) or isinstance(i,float)) and i == numpy.inf: | ||
new_tuple.append({'__inf__':'inf'}) | ||
elif (isinstance(i,numpy.floating) or isinstance(i,float)) and i == -numpy.inf: | ||
new_tuple.append({'__inf__':'-inf'}) | ||
elif (isinstance(i,numpy.floating) or isinstance(i,float)) and pd.isnull(i): | ||
new_tuple.append(None) | ||
else: | ||
new_tuple.append(hint_tuples(i)) | ||
return {'__tuple__': new_tuple} | ||
if isinstance(item, list): | ||
new_list = [] | ||
for i in item: | ||
if (isinstance(i,numpy.floating) or isinstance(i,float)) and i == numpy.inf: | ||
new_list.append({'__inf__':'inf'}) | ||
elif (isinstance(i,numpy.floating) or isinstance(i,float)) and i == -numpy.inf: | ||
new_list.append({'__inf__':'-inf'}) | ||
elif (isinstance(i,numpy.floating) or isinstance(i,float)) and pd.isnull(i): | ||
new_list.append(None) | ||
else: | ||
new_list.append(hint_tuples(i)) | ||
return new_list | ||
if isinstance(item, dict): | ||
new_dict = {} | ||
for key in item: | ||
if (isinstance(item[key],numpy.floating) or isinstance(item[key],float)) and item[key] == numpy.inf: | ||
new_dict[key] = {'__inf__':'inf'} | ||
elif (isinstance(item[key],numpy.floating) or isinstance(item[key],float)) and item[key] == -numpy.inf: | ||
new_dict[key] = ({'__inf__':'-inf'}) | ||
elif (isinstance(item[key],numpy.floating) or isinstance(item[key],float)) and pd.isnull(item[key]): | ||
new_dict[key] = None | ||
else: | ||
new_dict[key] = hint_tuples(item[key]) | ||
return new_dict | ||
else: | ||
return item | ||
|
||
return super(DefaultEncoder, self).encode(hint_tuples(obj)) | ||
|
||
def default(self, o): | ||
# TODO add more support types | ||
if isinstance(o, set): | ||
return {'__set__': _to_default_list(list(o))} | ||
elif isinstance(o, numpy.ndarray): | ||
return {'__numpy__': _to_default_list(o)} | ||
elif hasattr(o, '_repr_html_'): | ||
rb = BrtcReprBuilder() | ||
rb.addHTML(o._repr_html_()) | ||
if isinstance(o, pd.DataFrame): | ||
return {'_repr_brtc_':rb.get(), '__pickled__': list(pickle.dumps(o)), 'type':'table'} | ||
else: | ||
return {'_repr_brtc_':rb.get(), '__pickled__': list(pickle.dumps(o))} | ||
elif hasattr(o, 'savefig'): | ||
rb = BrtcReprBuilder() | ||
rb.addPlt(o) | ||
if isinstance(o, pd.DataFrame): | ||
return {'_repr_brtc_':rb.get(), '__pickled__': list(pickle.dumps(o)), 'type':'table'} | ||
else: | ||
return {'_repr_brtc_':rb.get(), '__pickled__': list(pickle.dumps(o))} | ||
else: | ||
rb = BrtcReprBuilder() | ||
rb.addRawTextMD(str(o)) | ||
if isinstance(o, pd.DataFrame): | ||
return {'_repr_brtc_':rb.get(), '__pickled__': list(pickle.dumps(o)), 'type':'table'} | ||
else: | ||
return {'_repr_brtc_':rb.get(), '__pickled__': list(pickle.dumps(o))} | ||
|
||
|
||
|
||
def encode(obj, for_redis): | ||
if for_redis: | ||
return json.dumps(obj, cls=PickleEncoder) | ||
else: | ||
return json.dumps(obj, cls=DefaultEncoder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
function/python/brightics/function/classification/meta/classification_predict.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
function/python/brightics/function/classification/meta/logistic_regression_predict.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.