DataFushion_Plugins_Python说明
1.简介
针对Python算法在DataFushion平台使用所给出的插件,主要用于规范化算法的输入输出
2.使用
- Step1:引入datafushon包中的operation模块
- Step2:使用资源管理器进行数据拆解处理,并在其中实现自己需要实现的业务算法逻辑
from datafushion import operation
if __name__ == '__main__':
with operation() as destruction:
input_data_struct_list = destruction.input_data_struct_list
param_map = destruction.param_map
param_multiply = float(param_map['multiply'])
data_result = []
for input_data_struct in input_data_struct_list:
file_input_mapping = input_data_struct.file_input_mapping
data_list = input_data_struct.data_list
field_x = file_input_mapping['x'][0]
field_y = file_input_mapping['y'][0]
for data in data_list:
x = float(data[field_x])
y = float(data[field_y])
sum_result = param_multiply * (x + y)
res = {
"sum": sum_result,
"x": x,
"y": y,
}
data_result.append(res)
destruction.data_result = data_result
注意:
destruction为解构的HandleDataSet实体类,
input_data_struct_list中包含了输入数据的封装,其类型为List
其元素为HandleInputDataStruct类,包含的属性为file_type,file_path,file_input_mapping,data_list
算法需要使用的是file_input_mapping和data_list
data_list是输入数据的字典列表
file_input_mapping为输入数据字段的映射
param_map为算法的参数字典
在对数据进行业务算法处理完成后,需要将拆解的destruction中的data_result属性赋值为业务算法的最终数据结果
3.模型
DataFushion_Plugins_Python基础包中加入对PMML格式模型的依赖,以便后续需要在算法中读取已有的模型做准备
from pypmml import Model
if __name__ == '__main__':
model = Model.fromFile('model_file')
for item in model.inputFields:
print(item.name)
predict = model.predict({
'sepalWidth': 1.33,
'sepalLength': 2.44,
'petalsWidth': 5.87,
'petalsLength': 7.11,
})
print(predict)
Metadata
Release files for datafushion-plugins-python 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datafushion_plugins_python-1.0.7.tar.gz | 5.6 kB | Without provenance | Details for datafushion_plugins_python-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datafushion_plugins_python-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for datafushion_plugins_python-1.0.7-py3-none-any.whl |
Total release size: 14.9 kB
Release files / datafushion_plugins_python-1.0.7.tar.gz
| Download URL | datafushion_plugins_python-1.0.7.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68d840313284e3aa7592eba8788785ea7587f4af0cb1fb55b06ce36ab09209d6
|
|
BLAKE2b-256 checksum How to use checksums |
6c6cc3ebdfcd2fcfa027032acd94a0ecdb3087a2e3ce1f8a21fdb51241d68240
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.1
|
Release files / datafushion_plugins_python-1.0.7-py3-none-any.whl
| Download URL | datafushion_plugins_python-1.0.7-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e4d65b0dc7147d35d31aef9e1b2702371c1530a6f18f966fd5a2c8ae917b14e
|
|
BLAKE2b-256 checksum How to use checksums |
54c1022e0f23a1723373bb31483b8e4f965826ae8de4c4b17bc578823b49cc45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.1
|
Security for datafushion-plugins-python 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.