AntiNex Python 客户端
项目描述
AntiNex Python 客户端
用于训练运行 REST API 的深度神经网络的 Python API 客户端
https://github.com/jay-johnson/train-ai-with-django-swagger-jwt
安装
点安装antinex客户端
AntiNex 堆栈状态
AntiNex 客户端是 AntiNex 堆栈的一部分:
零件 |
建造 |
文档链接 |
文档构建 |
|---|---|---|---|
运行预测
这些示例使用密码为123321的默认用户root。建议将来将其更改为您自己的用户。
使用 JSON 记录列表训练深度神经网络
ai -u root -p 123321 -f examples/predict-rows-scaler-django-simple.json
使用 AntiNex 数据集训练深度神经网络以预测攻击
请确保数据集可供 REST API、Celery worker 和 AntiNex Core worker 使用。数据集已包含在默认 compose.yml 文件中提供的docker容器ai-core中:
如果您在 docker 外部运行,请确保使用以下命令克隆 repo:
git clone https://github.com/jay-johnson/antinex-datasets.git /opt/antinex/antinex-datasets
训练 Django 防御性深度神经网络
请稍候,因为这需要几分钟才能返回并将预测转换为 pandas DataFrame。
ai -u root -p 123321 -f examples/scaler-full-django-antinex-simple.json ... [30200 rows x 72 columns]
使用预训练的神经网络进行预测
AntiNex Core管理内存中预训练的深度神经网络。这些可以与 REST API 一起使用,方法是在REST API compose.yml docker容器运行时将“publish_to_core”:true添加到请求中。
跑:
ai -u root -p 123321 -f examples/publish-to-core-scaler-full-django.json
以下是将使用预训练模型运行的请求与将训练新神经网络的请求之间的差异:
antinex-client$ diff examples/publish-to-core-scaler-full-django.json examples/scaler-full-django-antinex-simple.json 5d4 < "publish_to_core": true, antinex-client$
准备数据集
ai_prepare_dataset.py -u root -p 123321 -f examples/prepare-new-dataset.json
获取深度神经网络的工作记录
通过设置获取用户的 MLJob 记录:-i <MLJob.id>
这包括 Keras DNN 的模型 json 或模型描述。
ai_get_job.py -u root -p 123321 -i 4
获取深度神经网络的预测结果
通过设置获取用户的 MLJobResult 记录:-i <MLJobResult.id>
这包括来自训练或预测工作的预测。
ai_get_results.py -u root -p 123321 -i 4
获取准备好的数据集
通过设置获取用户的 MLPrepare 记录:-i <MLPrepare.id>
ai_get_prepared_dataset.py -u root -p 123321 -i 15
使用从环境变量构建的客户端
这就是网络管道将数据流式传输到AntiNex Core以使用预训练模型进行预测的方式。
导出示例环境文件:
source examples/example-prediction.env
运行客户端预测流脚本
ai_env_predict.py -f examples/predict-rows-scaler-full-django.json
发展
virtualenv -p python3 ~/.venvs/antinexclient && source ~/.venvs/antinexclient/bin/activate && pip install -e .
测试
全部运行
python setup.py test
掉毛
薄片8。
pycodestyle 。
执照
Apache 2.0 - 请参阅许可证以获取更多详细信息