qwak-sdk 0.5.102__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qwak_sdk/__init__.py +9 -0
- qwak_sdk/cli.py +79 -0
- qwak_sdk/commands/__init__.py +0 -0
- qwak_sdk/commands/_logic/__init__.py +0 -0
- qwak_sdk/commands/_logic/tools.py +6 -0
- qwak_sdk/commands/admin/__init__.py +0 -0
- qwak_sdk/commands/admin/admin_commands_group.py +17 -0
- qwak_sdk/commands/admin/apikeys/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/api_keys_commands_group.py +17 -0
- qwak_sdk/commands/admin/apikeys/generate/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/generate/_logic.py +21 -0
- qwak_sdk/commands/admin/apikeys/generate/ui.py +45 -0
- qwak_sdk/commands/admin/apikeys/revoke/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/revoke/_logic.py +22 -0
- qwak_sdk/commands/admin/apikeys/revoke/ui.py +31 -0
- qwak_sdk/commands/alerts/__init__.py +0 -0
- qwak_sdk/commands/alerts/alerts_commnad_group.py +18 -0
- qwak_sdk/commands/alerts/delete/__init__.py +0 -0
- qwak_sdk/commands/alerts/delete/_logic.py +5 -0
- qwak_sdk/commands/alerts/delete/ui.py +10 -0
- qwak_sdk/commands/alerts/list/__init__.py +0 -0
- qwak_sdk/commands/alerts/list/_logic.py +23 -0
- qwak_sdk/commands/alerts/list/ui.py +17 -0
- qwak_sdk/commands/alerts/register/__init__.py +0 -0
- qwak_sdk/commands/alerts/register/_logic.py +72 -0
- qwak_sdk/commands/alerts/register/ui.py +30 -0
- qwak_sdk/commands/audience/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/config_base.py +15 -0
- qwak_sdk/commands/audience/_logic/config/parser.py +30 -0
- qwak_sdk/commands/audience/_logic/config/v1/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/v1/audience_config.py +26 -0
- qwak_sdk/commands/audience/_logic/config/v1/conditions_config.py +59 -0
- qwak_sdk/commands/audience/_logic/config/v1/config_v1.py +23 -0
- qwak_sdk/commands/audience/_logic/config/v1/route_config.py +15 -0
- qwak_sdk/commands/audience/_logic/config/v1/spec.py +9 -0
- qwak_sdk/commands/audience/audience_api_dump.py +86 -0
- qwak_sdk/commands/audience/audience_commands_group.py +30 -0
- qwak_sdk/commands/audience/create/__init__.py +0 -0
- qwak_sdk/commands/audience/create/logic.py +41 -0
- qwak_sdk/commands/audience/create/ui.py +21 -0
- qwak_sdk/commands/audience/delete/__init__.py +0 -0
- qwak_sdk/commands/audience/delete/logic.py +13 -0
- qwak_sdk/commands/audience/delete/ui.py +17 -0
- qwak_sdk/commands/audience/get/__init__.py +0 -0
- qwak_sdk/commands/audience/get/logic.py +14 -0
- qwak_sdk/commands/audience/get/ui.py +25 -0
- qwak_sdk/commands/audience/list/__init__.py +0 -0
- qwak_sdk/commands/audience/list/logic.py +16 -0
- qwak_sdk/commands/audience/list/ui.py +26 -0
- qwak_sdk/commands/audience/update/__init__.py +0 -0
- qwak_sdk/commands/audience/update/logic.py +37 -0
- qwak_sdk/commands/audience/update/ui.py +26 -0
- qwak_sdk/commands/auto_scalling/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/_logic/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/_logic/config/__init__.py +3 -0
- qwak_sdk/commands/auto_scalling/_logic/config/config.py +152 -0
- qwak_sdk/commands/auto_scalling/_logic/config/parser.py +21 -0
- qwak_sdk/commands/auto_scalling/attach/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/attach/_logic.py +43 -0
- qwak_sdk/commands/auto_scalling/attach/ui.py +21 -0
- qwak_sdk/commands/auto_scalling/autoscaling_commands_group.py +15 -0
- qwak_sdk/commands/automations/__init__.py +0 -0
- qwak_sdk/commands/automations/automations_commands_group.py +30 -0
- qwak_sdk/commands/automations/delete/__init__.py +0 -0
- qwak_sdk/commands/automations/delete/_logic.py +6 -0
- qwak_sdk/commands/automations/delete/ui.py +23 -0
- qwak_sdk/commands/automations/executions/__init__.py +0 -0
- qwak_sdk/commands/automations/executions/executions_commands_group.py +14 -0
- qwak_sdk/commands/automations/executions/list/__init__.py +0 -0
- qwak_sdk/commands/automations/executions/list/_logic.py +8 -0
- qwak_sdk/commands/automations/executions/list/ui.py +25 -0
- qwak_sdk/commands/automations/list/__init__.py +0 -0
- qwak_sdk/commands/automations/list/_logic.py +36 -0
- qwak_sdk/commands/automations/list/ui.py +21 -0
- qwak_sdk/commands/automations/register/__init__.py +0 -0
- qwak_sdk/commands/automations/register/_logic.py +43 -0
- qwak_sdk/commands/automations/register/ui.py +44 -0
- qwak_sdk/commands/feature_store/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/_logic.py +140 -0
- qwak_sdk/commands/feature_store/backfill/streaming/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/streaming/_logic.py +50 -0
- qwak_sdk/commands/feature_store/backfill/streaming/ui.py +67 -0
- qwak_sdk/commands/feature_store/backfill/ui.py +146 -0
- qwak_sdk/commands/feature_store/delete/__init__.py +0 -0
- qwak_sdk/commands/feature_store/delete/_logic.py +104 -0
- qwak_sdk/commands/feature_store/delete/ui.py +40 -0
- qwak_sdk/commands/feature_store/execution/__init__.py +0 -0
- qwak_sdk/commands/feature_store/execution/ui.py +19 -0
- qwak_sdk/commands/feature_store/feature_store_command_group.py +29 -0
- qwak_sdk/commands/feature_store/list/__init__.py +0 -0
- qwak_sdk/commands/feature_store/list/ui.py +140 -0
- qwak_sdk/commands/feature_store/pause/__init__.py +0 -0
- qwak_sdk/commands/feature_store/pause/ui.py +18 -0
- qwak_sdk/commands/feature_store/register/__init__.py +0 -0
- qwak_sdk/commands/feature_store/register/_logic.py +367 -0
- qwak_sdk/commands/feature_store/register/ui.py +111 -0
- qwak_sdk/commands/feature_store/resume/__init__.py +0 -0
- qwak_sdk/commands/feature_store/resume/ui.py +18 -0
- qwak_sdk/commands/feature_store/trigger/__init__.py +0 -0
- qwak_sdk/commands/feature_store/trigger/ui.py +39 -0
- qwak_sdk/commands/models/__init__.py +0 -0
- qwak_sdk/commands/models/build/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/build_steps.py +42 -0
- qwak_sdk/commands/models/build/_logic/client_logs/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/client_logs/cli_phase_run_handler.py +123 -0
- qwak_sdk/commands/models/build/_logic/client_logs/cli_trigger_build_logger.py +19 -0
- qwak_sdk/commands/models/build/_logic/client_logs/logger.py +88 -0
- qwak_sdk/commands/models/build/_logic/client_logs/messages.py +36 -0
- qwak_sdk/commands/models/build/_logic/client_logs/spinner.py +14 -0
- qwak_sdk/commands/models/build/_logic/client_logs/trigger_build_logger.py +54 -0
- qwak_sdk/commands/models/build/_logic/client_logs/utils.py +12 -0
- qwak_sdk/commands/models/build/_logic/phase/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/phase/a_fetch_model_code/__init__.py +20 -0
- qwak_sdk/commands/models/build/_logic/phase/a_fetch_model_code/get_sdk_version_step.py +14 -0
- qwak_sdk/commands/models/build/_logic/phase/b_remote_register_qwak_build/__init__.py +16 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/__init__.py +6 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/build_polling_status.py +55 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/deploy_build.py +61 -0
- qwak_sdk/commands/models/build/_logic/util/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/util/protobuf_factory.py +45 -0
- qwak_sdk/commands/models/build/_logic/util/step_decorator.py +60 -0
- qwak_sdk/commands/models/build/_logic/util/text.py +9 -0
- qwak_sdk/commands/models/build/_logic/wait_until_finished.py +27 -0
- qwak_sdk/commands/models/build/ui.py +337 -0
- qwak_sdk/commands/models/builds/__init__.py +0 -0
- qwak_sdk/commands/models/builds/builds_commands_group.py +16 -0
- qwak_sdk/commands/models/builds/cancel/__init__.py +0 -0
- qwak_sdk/commands/models/builds/cancel/_logic.py +5 -0
- qwak_sdk/commands/models/builds/cancel/ui.py +15 -0
- qwak_sdk/commands/models/builds/logs/__init__.py +0 -0
- qwak_sdk/commands/models/builds/logs/ui.py +35 -0
- qwak_sdk/commands/models/builds/status/__init__.py +0 -0
- qwak_sdk/commands/models/builds/status/_logic.py +6 -0
- qwak_sdk/commands/models/builds/status/ui.py +39 -0
- qwak_sdk/commands/models/create/__init__.py +0 -0
- qwak_sdk/commands/models/create/_logic.py +36 -0
- qwak_sdk/commands/models/create/ui.py +43 -0
- qwak_sdk/commands/models/delete/__init__.py +0 -0
- qwak_sdk/commands/models/delete/_logic.py +5 -0
- qwak_sdk/commands/models/delete/ui.py +25 -0
- qwak_sdk/commands/models/deployments/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/advance_deployment_options_handler.py +31 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/base_deploy_executor.py +68 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deploy_config.py +261 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment.py +405 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_message_helpers.py +114 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_response_handler.py +156 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_size_mapper.py +96 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/get_latest_successful_build.py +28 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/local_deployment.py +193 -0
- qwak_sdk/commands/models/deployments/deploy/batch/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/advanced_deployment_mapper.py +15 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/batch/ui.py +126 -0
- qwak_sdk/commands/models/deployments/deploy/deploy_commands_group.py +19 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/advanced_deployment_mapper.py +21 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/serving_strategy_mapper.py +75 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/ui.py +209 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/serving_strategy_mapper.py +38 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/ui.py +213 -0
- qwak_sdk/commands/models/deployments/undeploy/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/undeploy/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/undeploy/_logic/request_undeploy.py +249 -0
- qwak_sdk/commands/models/deployments/undeploy/ui.py +72 -0
- qwak_sdk/commands/models/describe/__init__.py +0 -0
- qwak_sdk/commands/models/describe/_logic.py +169 -0
- qwak_sdk/commands/models/describe/ui.py +35 -0
- qwak_sdk/commands/models/executions/__init__.py +0 -0
- qwak_sdk/commands/models/executions/cancel/__init__.py +0 -0
- qwak_sdk/commands/models/executions/cancel/_logic.py +9 -0
- qwak_sdk/commands/models/executions/cancel/ui.py +27 -0
- qwak_sdk/commands/models/executions/execution_commands_group.py +24 -0
- qwak_sdk/commands/models/executions/report/__init__.py +0 -0
- qwak_sdk/commands/models/executions/report/_logic.py +14 -0
- qwak_sdk/commands/models/executions/report/ui.py +43 -0
- qwak_sdk/commands/models/executions/start/__init__.py +0 -0
- qwak_sdk/commands/models/executions/start/_logic.py +81 -0
- qwak_sdk/commands/models/executions/start/ui.py +208 -0
- qwak_sdk/commands/models/executions/status/__init__.py +0 -0
- qwak_sdk/commands/models/executions/status/_logic.py +13 -0
- qwak_sdk/commands/models/executions/status/ui.py +27 -0
- qwak_sdk/commands/models/init/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/initialize_model_structure.py +40 -0
- qwak_sdk/commands/models/init/_logic/template/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/conda.yml +10 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/data.csv +1001 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/model.py +95 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/it/test_churn.py +32 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/conda.yml +11 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/data.csv +1001 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/model.py +108 -0
- qwak_sdk/commands/models/init/_logic/template/general/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/cookiecutter.json +6 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/conda.yml +8 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/model.py +66 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.test_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.test_directory}}/test_qwak_model.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/conda.yml +11 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/model.py +98 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/it/test_titanic.py +24 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/model.py +98 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/pyproject.toml +20 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/it/test_titanic.py +25 -0
- qwak_sdk/commands/models/init/ui.py +61 -0
- qwak_sdk/commands/models/list/__init__.py +0 -0
- qwak_sdk/commands/models/list/_logic.py +5 -0
- qwak_sdk/commands/models/list/ui.py +40 -0
- qwak_sdk/commands/models/list_models/__init__.py +0 -0
- qwak_sdk/commands/models/list_models/_logic.py +5 -0
- qwak_sdk/commands/models/list_models/ui.py +60 -0
- qwak_sdk/commands/models/metadata/__init__.py +0 -0
- qwak_sdk/commands/models/metadata/_logic.py +5 -0
- qwak_sdk/commands/models/metadata/ui.py +60 -0
- qwak_sdk/commands/models/models_command_group.py +44 -0
- qwak_sdk/commands/models/runtime/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/logs/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/logs/ui.py +63 -0
- qwak_sdk/commands/models/runtime/runtime_commands_group.py +17 -0
- qwak_sdk/commands/models/runtime/update/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/update/_logic.py +9 -0
- qwak_sdk/commands/models/runtime/update/ui.py +15 -0
- qwak_sdk/commands/projects/__init__.py +0 -0
- qwak_sdk/commands/projects/create/__init__.py +0 -0
- qwak_sdk/commands/projects/create/_logic.py +9 -0
- qwak_sdk/commands/projects/create/ui.py +68 -0
- qwak_sdk/commands/projects/delete/__init__.py +0 -0
- qwak_sdk/commands/projects/delete/_logic.py +6 -0
- qwak_sdk/commands/projects/delete/ui.py +24 -0
- qwak_sdk/commands/projects/list/__init__.py +0 -0
- qwak_sdk/commands/projects/list/_logic.py +6 -0
- qwak_sdk/commands/projects/list/ui.py +45 -0
- qwak_sdk/commands/projects/projects_command_group.py +19 -0
- qwak_sdk/commands/secrets/__init__.py +0 -0
- qwak_sdk/commands/secrets/delete/__init__.py +0 -0
- qwak_sdk/commands/secrets/delete/_logic.py +5 -0
- qwak_sdk/commands/secrets/delete/ui.py +21 -0
- qwak_sdk/commands/secrets/get/__init__.py +0 -0
- qwak_sdk/commands/secrets/get/_logic.py +5 -0
- qwak_sdk/commands/secrets/get/ui.py +17 -0
- qwak_sdk/commands/secrets/secrets_commands_group.py +19 -0
- qwak_sdk/commands/secrets/set/__init__.py +0 -0
- qwak_sdk/commands/secrets/set/_logic.py +5 -0
- qwak_sdk/commands/secrets/set/ui.py +16 -0
- qwak_sdk/commands/ui_tools.py +18 -0
- qwak_sdk/commands/workspaces/__init__.py +0 -0
- qwak_sdk/commands/workspaces/_logic/__init__.py +0 -0
- qwak_sdk/commands/workspaces/_logic/tools.py +44 -0
- qwak_sdk/commands/workspaces/_logic/workspace_validations.py +41 -0
- qwak_sdk/commands/workspaces/config/__init__.py +0 -0
- qwak_sdk/commands/workspaces/config/workspace_config.py +35 -0
- qwak_sdk/commands/workspaces/create/__init__.py +0 -0
- qwak_sdk/commands/workspaces/create/_logic.py +54 -0
- qwak_sdk/commands/workspaces/create/ui.py +48 -0
- qwak_sdk/commands/workspaces/delete/__init__.py +0 -0
- qwak_sdk/commands/workspaces/delete/_logic.py +30 -0
- qwak_sdk/commands/workspaces/delete/ui.py +23 -0
- qwak_sdk/commands/workspaces/start/__init__.py +0 -0
- qwak_sdk/commands/workspaces/start/_logic.py +30 -0
- qwak_sdk/commands/workspaces/start/ui.py +23 -0
- qwak_sdk/commands/workspaces/stop/__init__.py +0 -0
- qwak_sdk/commands/workspaces/stop/_logic.py +30 -0
- qwak_sdk/commands/workspaces/stop/ui.py +23 -0
- qwak_sdk/commands/workspaces/update/__init__.py +0 -0
- qwak_sdk/commands/workspaces/update/_logic.py +82 -0
- qwak_sdk/commands/workspaces/update/ui.py +57 -0
- qwak_sdk/commands/workspaces/workspaces_commands_group.py +23 -0
- qwak_sdk/exceptions/__init__.py +11 -0
- qwak_sdk/exceptions/qwak_command_exception.py +2 -0
- qwak_sdk/exceptions/qwak_deploy_new_build_failed.py +5 -0
- qwak_sdk/exceptions/qwak_resource_not_found.py +2 -0
- qwak_sdk/inner/__init__.py +0 -0
- qwak_sdk/inner/file_registry.py +98 -0
- qwak_sdk/inner/tools/__init__.py +0 -0
- qwak_sdk/inner/tools/cli_tools.py +220 -0
- qwak_sdk/inner/tools/config_handler.py +27 -0
- qwak_sdk/inner/tools/dataclasses_utils.py +21 -0
- qwak_sdk/inner/tools/logger/__init__.py +3 -0
- qwak_sdk/inner/tools/logger/logger.py +269 -0
- qwak_sdk/inner/tools/logger/logging.yml +79 -0
- qwak_sdk/inner/tools/tracking.py +47 -0
- qwak_sdk/main.py +9 -0
- qwak_sdk/tools/__init__.py +0 -0
- qwak_sdk/tools/colors.py +13 -0
- qwak_sdk/tools/files.py +63 -0
- qwak_sdk/tools/log_handling.py +159 -0
- qwak_sdk/tools/utils.py +42 -0
- qwak_sdk-0.5.102.dist-info/METADATA +51 -0
- qwak_sdk-0.5.102.dist-info/RECORD +328 -0
- qwak_sdk-0.5.102.dist-info/WHEEL +4 -0
- qwak_sdk-0.5.102.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import qwak
|
|
6
|
+
from catboost import CatBoostClassifier, Pool, cv
|
|
7
|
+
from qwak.model.base import QwakModel
|
|
8
|
+
from qwak.model.schema import ExplicitFeature, InferenceOutput, ModelSchema
|
|
9
|
+
from sklearn.model_selection import train_test_split
|
|
10
|
+
|
|
11
|
+
RUNNING_FILE_ABSOLUTE_PATH = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CreditRisk(QwakModel):
|
|
15
|
+
"""The Model class inherit QwakModel base class"""
|
|
16
|
+
|
|
17
|
+
def __init__(self):
|
|
18
|
+
self.params = {
|
|
19
|
+
"iterations": int(os.getenv("iterations", 1000)),
|
|
20
|
+
"learning_rate": float(os.getenv("learning_rate", 0.1)),
|
|
21
|
+
"eval_metric": "Accuracy",
|
|
22
|
+
"random_seed": int(os.getenv("random_seed", 7)),
|
|
23
|
+
"logging_level": "Silent",
|
|
24
|
+
"loss_function": os.getenv("loss_fn", "Logloss"),
|
|
25
|
+
"use_best_model": True,
|
|
26
|
+
}
|
|
27
|
+
self.model = CatBoostClassifier(**self.params)
|
|
28
|
+
|
|
29
|
+
qwak.log_param(self.params)
|
|
30
|
+
|
|
31
|
+
def build(self):
|
|
32
|
+
df_credit = pd.read_csv(f"{RUNNING_FILE_ABSOLUTE_PATH}/data.csv", index_col=0)
|
|
33
|
+
|
|
34
|
+
# Creating an categorical variable to handle with the Age variable
|
|
35
|
+
interval = (18, 25, 35, 60, 120)
|
|
36
|
+
cats = ["Student", "Young", "Adult", "Senior"]
|
|
37
|
+
df_credit["Age_cat"] = pd.cut(df_credit.Age, interval, labels=cats).astype(
|
|
38
|
+
object
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
df_credit["Saving accounts"] = df_credit["Saving accounts"].fillna("no_inf")
|
|
42
|
+
df_credit["Checking account"] = df_credit["Checking account"].fillna("no_inf")
|
|
43
|
+
|
|
44
|
+
df_credit = df_credit.merge(
|
|
45
|
+
pd.get_dummies(df_credit.Risk, prefix="Risk"),
|
|
46
|
+
left_index=True,
|
|
47
|
+
right_index=True,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# Excluding the missing columns
|
|
51
|
+
del df_credit["Risk"]
|
|
52
|
+
del df_credit["Risk_good"]
|
|
53
|
+
|
|
54
|
+
df_credit["Credit amount"] = np.log(df_credit["Credit amount"])
|
|
55
|
+
|
|
56
|
+
# Creating the X and y variables
|
|
57
|
+
X = df_credit.drop(["Risk_bad"], axis=1)
|
|
58
|
+
y = df_credit["Risk_bad"]
|
|
59
|
+
categorical_features_indices = np.where(X.dtypes == object)[0]
|
|
60
|
+
|
|
61
|
+
# Spliting X and y into train and test version
|
|
62
|
+
X_train, X_test, y_train, y_test = train_test_split(
|
|
63
|
+
X, y, test_size=0.25, random_state=self.params["random_seed"]
|
|
64
|
+
)
|
|
65
|
+
self.model.fit(
|
|
66
|
+
X_train,
|
|
67
|
+
y_train,
|
|
68
|
+
cat_features=categorical_features_indices,
|
|
69
|
+
eval_set=(X_test, y_test),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Cross validating the model (5-fold)
|
|
73
|
+
cv_data = cv(
|
|
74
|
+
Pool(X_train, y_train, cat_features=categorical_features_indices),
|
|
75
|
+
self.model.get_params(),
|
|
76
|
+
fold_count=5,
|
|
77
|
+
)
|
|
78
|
+
print(
|
|
79
|
+
"the best cross validation accuracy is :{}".format(
|
|
80
|
+
np.max(cv_data["test-Accuracy-mean"])
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
qwak.log_metric({"val_accuracy": np.max(cv_data["test-Accuracy-mean"])})
|
|
84
|
+
|
|
85
|
+
def schema(self):
|
|
86
|
+
return ModelSchema(
|
|
87
|
+
inputs=[
|
|
88
|
+
ExplicitFeature(name="UserId", type=str),
|
|
89
|
+
ExplicitFeature(name="Age", type=int),
|
|
90
|
+
ExplicitFeature(name="Sex", type=str),
|
|
91
|
+
ExplicitFeature(name="Job", type=int),
|
|
92
|
+
ExplicitFeature(name="Housing", type=str),
|
|
93
|
+
ExplicitFeature(name="Saving accounts", type=str),
|
|
94
|
+
ExplicitFeature(name="Checking account", type=str),
|
|
95
|
+
ExplicitFeature(name="Credit amount", type=float),
|
|
96
|
+
ExplicitFeature(name="Duration", type=int),
|
|
97
|
+
ExplicitFeature(name="Purpose", type=str),
|
|
98
|
+
ExplicitFeature(name="Age_cat", type=str),
|
|
99
|
+
],
|
|
100
|
+
outputs=[InferenceOutput(name="Default_Probability", type=float)],
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
@qwak.api()
|
|
104
|
+
def predict(self, df: pd.DataFrame) -> pd.DataFrame:
|
|
105
|
+
df = df.drop(["UserId"], axis=1)
|
|
106
|
+
return pd.DataFrame(
|
|
107
|
+
self.model.predict_proba(df[self.model.feature_names_])[:, 1], columns=["Default_Probability"]
|
|
108
|
+
)
|
|
File without changes
|
qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import qwak
|
|
3
|
+
from qwak.model.base import QwakModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class {{cookiecutter.model_class_name}}(QwakModel):
|
|
7
|
+
""" The Model class inherit QwakModel base class
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
def build(self):
|
|
14
|
+
""" Responsible for loading the model. This method is invoked during build time (qwak build command)
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
>>> def build(self):
|
|
18
|
+
>>> ...
|
|
19
|
+
>>> train_pool = Pool(X_train, y_train, cat_features=categorical_features_indices)
|
|
20
|
+
>>> validate_pool = Pool(X_validation, y_validation, cat_features=categorical_features_indices)
|
|
21
|
+
>>> self.catboost.fit(train_pool, eval_set=validate_pool)
|
|
22
|
+
"""
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
def schema(self):
|
|
26
|
+
""" Specification of the model inputs and outputs. Optional method
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
>>> from qwak.model.schema import ModelSchema, InferenceOutput, ExplicitFeature
|
|
30
|
+
>>>
|
|
31
|
+
>>> def schema(self) -> ModelSchema:
|
|
32
|
+
>>> model_schema = ModelSchema(
|
|
33
|
+
>>> inputs=[
|
|
34
|
+
>>> ExplicitFeature(name="State", type=str),
|
|
35
|
+
>>> ],
|
|
36
|
+
>>> outputs=[
|
|
37
|
+
>>> InferenceOutput(name="score", type=float)
|
|
38
|
+
>>> ])
|
|
39
|
+
>>> return model_schema
|
|
40
|
+
|
|
41
|
+
Returns: a model schema specification
|
|
42
|
+
"""
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
def initialize_model(self):
|
|
46
|
+
"""
|
|
47
|
+
Invoked when a model is loaded at serving time. Called once per model instance initialization. Can be used for
|
|
48
|
+
loading and storing values that should only be available in a serving setting or loading pretrained models. Optional method
|
|
49
|
+
|
|
50
|
+
Example usage:
|
|
51
|
+
|
|
52
|
+
>>> def initialize_model(self):
|
|
53
|
+
>>> with open('model.pkl', 'rb') as infile:
|
|
54
|
+
>>> self.model = pickle.load(infile)
|
|
55
|
+
"""
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
@qwak.api()
|
|
59
|
+
def predict(self, df: pd.DataFrame) -> pd.DataFrame:
|
|
60
|
+
""" Invoked on every API inference request.
|
|
61
|
+
Args:
|
|
62
|
+
pd (DataFrame): the inference vector, as a pandas dataframe
|
|
63
|
+
|
|
64
|
+
Returns: model output (inference results), as a pandas dataframe
|
|
65
|
+
"""
|
|
66
|
+
pass
|
|
File without changes
|
|
File without changes
|
qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/__init__.py
ADDED
|
File without changes
|
qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/model.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import qwak
|
|
6
|
+
from catboost import CatBoostClassifier, Pool, cv
|
|
7
|
+
from catboost.datasets import titanic
|
|
8
|
+
from qwak.model.base import QwakModel
|
|
9
|
+
from qwak.model.schema import ExplicitFeature, InferenceOutput, ModelSchema
|
|
10
|
+
from sklearn.model_selection import train_test_split
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TitanicSurvivalPrediction(QwakModel):
|
|
14
|
+
def __init__(self):
|
|
15
|
+
loss_function = os.getenv("loss_fn", "Logloss")
|
|
16
|
+
learning_rate = os.getenv("learning_rate", None)
|
|
17
|
+
if learning_rate:
|
|
18
|
+
learning_rate = int(learning_rate)
|
|
19
|
+
iterations = int(os.getenv("iterations", 1000))
|
|
20
|
+
|
|
21
|
+
custom_loss = "Accuracy"
|
|
22
|
+
self.model = CatBoostClassifier(
|
|
23
|
+
iterations=iterations,
|
|
24
|
+
custom_loss=[custom_loss],
|
|
25
|
+
loss_function=loss_function,
|
|
26
|
+
learning_rate=learning_rate,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
qwak.log_param(
|
|
30
|
+
{
|
|
31
|
+
"loss_function": loss_function,
|
|
32
|
+
"learning_rate": learning_rate,
|
|
33
|
+
"iterations": iterations,
|
|
34
|
+
"custom_loss": custom_loss,
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def build(self):
|
|
39
|
+
titanic_train, _ = titanic()
|
|
40
|
+
|
|
41
|
+
# for the train data ,the age ,fare and embarked has null value,so just make it -999 for it
|
|
42
|
+
# and the catboost will distinguish it
|
|
43
|
+
titanic_train.fillna(-999, inplace=True)
|
|
44
|
+
|
|
45
|
+
x = titanic_train.drop(["Survived", "PassengerId"], axis=1)
|
|
46
|
+
y = titanic_train.Survived
|
|
47
|
+
|
|
48
|
+
x_train, x_test, y_train, y_test = train_test_split(
|
|
49
|
+
x, y, train_size=0.85, random_state=42
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# mark categorical features
|
|
53
|
+
cate_features_index = np.where(x_train.dtypes != float)[0]
|
|
54
|
+
|
|
55
|
+
self.model.fit(
|
|
56
|
+
x_train,
|
|
57
|
+
y_train,
|
|
58
|
+
cat_features=cate_features_index,
|
|
59
|
+
eval_set=(x_test, y_test),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Cross validating the model (5-fold)
|
|
63
|
+
cv_data = cv(
|
|
64
|
+
Pool(x, y, cat_features=cate_features_index),
|
|
65
|
+
self.model.get_params(),
|
|
66
|
+
fold_count=5,
|
|
67
|
+
)
|
|
68
|
+
print(
|
|
69
|
+
"the best cross validation accuracy is :{}".format(
|
|
70
|
+
np.max(cv_data["test-Accuracy-mean"])
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
qwak.log_metric({"val_accuracy": np.max(cv_data["test-Accuracy-mean"])})
|
|
74
|
+
|
|
75
|
+
def schema(self):
|
|
76
|
+
return ModelSchema(
|
|
77
|
+
inputs=[
|
|
78
|
+
ExplicitFeature(name="PassengerId", type=int),
|
|
79
|
+
ExplicitFeature(name="Pclass", type=int),
|
|
80
|
+
ExplicitFeature(name="Name", type=str),
|
|
81
|
+
ExplicitFeature(name="Sex", type=str),
|
|
82
|
+
ExplicitFeature(name="Age", type=int),
|
|
83
|
+
ExplicitFeature(name="SibSp", type=int),
|
|
84
|
+
ExplicitFeature(name="Parch", type=int),
|
|
85
|
+
ExplicitFeature(name="Ticket", type=str),
|
|
86
|
+
ExplicitFeature(name="Fare", type=float),
|
|
87
|
+
ExplicitFeature(name="Cabin", type=str),
|
|
88
|
+
ExplicitFeature(name="Embarked", type=str),
|
|
89
|
+
],
|
|
90
|
+
outputs=[InferenceOutput(name="Survived_Probability", type=float)],
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
@qwak.api()
|
|
94
|
+
def predict(self, df: pd.DataFrame) -> pd.DataFrame:
|
|
95
|
+
df = df.drop(["PassengerId"], axis=1)
|
|
96
|
+
return pd.DataFrame(
|
|
97
|
+
self.model.predict_proba(df)[:, 1], columns=["Survived_Probability"]
|
|
98
|
+
)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from qwak.testing.fixtures import real_time_client
|
|
3
|
+
from qwak_inference.realtime_client.client import InferenceOutputFormat
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_realtime_api(real_time_client):
|
|
7
|
+
feature_vector = [
|
|
8
|
+
{
|
|
9
|
+
"PassengerId": 762,
|
|
10
|
+
"Pclass": 3,
|
|
11
|
+
"Name": "Nirva, Mr. Iisakki Antino Aijo ",
|
|
12
|
+
"Sex": "female",
|
|
13
|
+
"Age": 34,
|
|
14
|
+
"SibSp": 4,
|
|
15
|
+
"Parch": 3,
|
|
16
|
+
"Ticket": "a",
|
|
17
|
+
"Fare": 1.0,
|
|
18
|
+
"Cabin": "A",
|
|
19
|
+
"Embarked": "A",
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
survived_probability: pd.DataFrame = real_time_client.predict(feature_vector, output_format=InferenceOutputFormat.PANDAS)
|
|
24
|
+
assert survived_probability["Survived_Probability"].values[0] > 0
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import qwak
|
|
6
|
+
from catboost import CatBoostClassifier, Pool, cv
|
|
7
|
+
from catboost.datasets import titanic
|
|
8
|
+
from qwak.model.base import QwakModel
|
|
9
|
+
from qwak.model.schema import ExplicitFeature, InferenceOutput, ModelSchema
|
|
10
|
+
from sklearn.model_selection import train_test_split
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TitanicSurvivalPrediction(QwakModel):
|
|
14
|
+
def __init__(self):
|
|
15
|
+
loss_function = os.getenv("loss_fn", "Logloss")
|
|
16
|
+
learning_rate = os.getenv("learning_rate", None)
|
|
17
|
+
if learning_rate:
|
|
18
|
+
learning_rate = int(learning_rate)
|
|
19
|
+
iterations = int(os.getenv("iterations", 1000))
|
|
20
|
+
|
|
21
|
+
custom_loss = "Accuracy"
|
|
22
|
+
self.model = CatBoostClassifier(
|
|
23
|
+
iterations=iterations,
|
|
24
|
+
custom_loss=[custom_loss],
|
|
25
|
+
loss_function=loss_function,
|
|
26
|
+
learning_rate=learning_rate,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
qwak.log_param(
|
|
30
|
+
{
|
|
31
|
+
"loss_function": loss_function,
|
|
32
|
+
"learning_rate": learning_rate,
|
|
33
|
+
"iterations": iterations,
|
|
34
|
+
"custom_loss": custom_loss,
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def build(self):
|
|
39
|
+
titanic_train, _ = titanic()
|
|
40
|
+
|
|
41
|
+
# for the train data ,the age ,fare and embarked has null value,so just make it -999 for it
|
|
42
|
+
# and the catboost will distinguish it
|
|
43
|
+
titanic_train.fillna(-999, inplace=True)
|
|
44
|
+
|
|
45
|
+
x = titanic_train.drop(["Survived", "PassengerId"], axis=1)
|
|
46
|
+
y = titanic_train.Survived
|
|
47
|
+
|
|
48
|
+
x_train, x_test, y_train, y_test = train_test_split(
|
|
49
|
+
x, y, train_size=0.85, random_state=42
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# mark categorical features
|
|
53
|
+
cate_features_index = np.where(x_train.dtypes != float)[0]
|
|
54
|
+
|
|
55
|
+
self.model.fit(
|
|
56
|
+
x_train,
|
|
57
|
+
y_train,
|
|
58
|
+
cat_features=cate_features_index,
|
|
59
|
+
eval_set=(x_test, y_test),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Cross validating the model (5-fold)
|
|
63
|
+
cv_data = cv(
|
|
64
|
+
Pool(x, y, cat_features=cate_features_index),
|
|
65
|
+
self.model.get_params(),
|
|
66
|
+
fold_count=5,
|
|
67
|
+
)
|
|
68
|
+
print(
|
|
69
|
+
"the best cross validation accuracy is :{}".format(
|
|
70
|
+
np.max(cv_data["test-Accuracy-mean"])
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
qwak.log_metric({"val_accuracy": np.max(cv_data["test-Accuracy-mean"])})
|
|
74
|
+
|
|
75
|
+
def schema(self):
|
|
76
|
+
return ModelSchema(
|
|
77
|
+
inputs=[
|
|
78
|
+
ExplicitFeature(name="PassengerId", type=int),
|
|
79
|
+
ExplicitFeature(name="Pclass", type=int),
|
|
80
|
+
ExplicitFeature(name="Name", type=str),
|
|
81
|
+
ExplicitFeature(name="Sex", type=str),
|
|
82
|
+
ExplicitFeature(name="Age", type=int),
|
|
83
|
+
ExplicitFeature(name="SibSp", type=int),
|
|
84
|
+
ExplicitFeature(name="Parch", type=int),
|
|
85
|
+
ExplicitFeature(name="Ticket", type=str),
|
|
86
|
+
ExplicitFeature(name="Fare", type=float),
|
|
87
|
+
ExplicitFeature(name="Cabin", type=str),
|
|
88
|
+
ExplicitFeature(name="Embarked", type=str),
|
|
89
|
+
],
|
|
90
|
+
outputs=[InferenceOutput(name="Survived_Probability", type=float)],
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
@qwak.api()
|
|
94
|
+
def predict(self, df: pd.DataFrame) -> pd.DataFrame:
|
|
95
|
+
df = df.drop(["PassengerId"], axis=1)
|
|
96
|
+
return pd.DataFrame(
|
|
97
|
+
self.model.predict_proba(df)[:, 1], columns=["Survived_Probability"]
|
|
98
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "titanic-poetry-survival-classification"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A model to perdict whether a person survived the titanic crash or not."
|
|
5
|
+
authors = ["Qwak AI <info@qwak.ai>"]
|
|
6
|
+
|
|
7
|
+
[tool.poetry.dependencies]
|
|
8
|
+
python = "^3.9"
|
|
9
|
+
|
|
10
|
+
[tool.poetry.dev-dependencies]
|
|
11
|
+
pip = "22.2.2"
|
|
12
|
+
pandas = "1.1.5"
|
|
13
|
+
scikit-learn = "0.24.1"
|
|
14
|
+
catboost = "0.26.1"
|
|
15
|
+
numpy = "1.23.5"
|
|
16
|
+
setuptools = "70.0.0"
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["poetry-core>=1.0.0"]
|
|
20
|
+
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from qwak.testing.fixtures import real_time_client
|
|
3
|
+
from qwak_inference.realtime_client.client import InferenceOutputFormat
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_realtime_api(real_time_client):
|
|
7
|
+
feature_vector = [
|
|
8
|
+
{
|
|
9
|
+
"PassengerId": 762,
|
|
10
|
+
"Pclass": 3,
|
|
11
|
+
"Name": "Nirva, Mr. Iisakki Antino Aijo ",
|
|
12
|
+
"Sex": "female",
|
|
13
|
+
"Age": 34,
|
|
14
|
+
"SibSp": 4,
|
|
15
|
+
"Parch": 3,
|
|
16
|
+
"Ticket": "a",
|
|
17
|
+
"Fare": 1.0,
|
|
18
|
+
"Cabin": "A",
|
|
19
|
+
"Embarked": "A",
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
survived_probability: pd.DataFrame = real_time_client.predict(feature_vector, output_format=InferenceOutputFormat.PANDAS)
|
|
24
|
+
|
|
25
|
+
assert survived_probability["Survived_Probability"].values[0] > 0
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from qwak.tools.logger.logger import get_qwak_logger
|
|
3
|
+
|
|
4
|
+
from qwak_sdk.commands.models.init._logic.initialize_model_structure import (
|
|
5
|
+
initialize_model_structure,
|
|
6
|
+
)
|
|
7
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
8
|
+
|
|
9
|
+
logger = get_qwak_logger()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@click.command("init", cls=QwakCommand)
|
|
13
|
+
@click.option(
|
|
14
|
+
"--model-directory", metavar="NAME", required=False, help="folder for model content"
|
|
15
|
+
)
|
|
16
|
+
@click.option(
|
|
17
|
+
"--model-class-name",
|
|
18
|
+
metavar="NAME",
|
|
19
|
+
required=False,
|
|
20
|
+
help="class name of created model",
|
|
21
|
+
)
|
|
22
|
+
@click.option(
|
|
23
|
+
"--example",
|
|
24
|
+
metavar="NAME",
|
|
25
|
+
required=False,
|
|
26
|
+
type=click.Choice(
|
|
27
|
+
["titanic", "credit_risk", "churn", "titanic_poetry"], case_sensitive=True
|
|
28
|
+
),
|
|
29
|
+
help="""Generate a fully functioning example of a Qwak based model. Options: titanic / credit_risk / churn""",
|
|
30
|
+
)
|
|
31
|
+
@click.argument("uri", metavar="URI", required=True)
|
|
32
|
+
def model_init(
|
|
33
|
+
uri: str, model_directory: str, model_class_name: str, example: str, **kwargs
|
|
34
|
+
):
|
|
35
|
+
if example:
|
|
36
|
+
if model_directory or model_class_name:
|
|
37
|
+
logger.warning("--example flag detected. Other options will be overridden.")
|
|
38
|
+
|
|
39
|
+
template = example
|
|
40
|
+
template_args = {}
|
|
41
|
+
|
|
42
|
+
else:
|
|
43
|
+
if model_directory is None:
|
|
44
|
+
model_directory = click.prompt(
|
|
45
|
+
"Please enter the model directory name", type=str
|
|
46
|
+
)
|
|
47
|
+
if model_class_name is None:
|
|
48
|
+
model_class_name = click.prompt(
|
|
49
|
+
"Please enter the model class name", type=str
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
template = "general"
|
|
53
|
+
template_args = {
|
|
54
|
+
"model_class_name": model_class_name,
|
|
55
|
+
"model_directory": model_directory,
|
|
56
|
+
}
|
|
57
|
+
try:
|
|
58
|
+
initialize_model_structure(uri, template, logger, **template_args)
|
|
59
|
+
except Exception as e:
|
|
60
|
+
logger.error(f"Failed to initialize a Qwak model structure. Error reason:\n{e}")
|
|
61
|
+
exit(1)
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.models.list._logic import execute_models_list
|
|
6
|
+
from qwak_sdk.commands.ui_tools import output_as_json, output_as_table
|
|
7
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def parse_model(model):
|
|
11
|
+
return [
|
|
12
|
+
model.model_id,
|
|
13
|
+
model.display_name,
|
|
14
|
+
datetime.fromtimestamp(
|
|
15
|
+
model.created_at.seconds + model.created_at.nanos / 1e9
|
|
16
|
+
).strftime("%A, %B %d, %Y %I:%M:%S"),
|
|
17
|
+
datetime.fromtimestamp(
|
|
18
|
+
model.last_modified_at.seconds + model.last_modified_at.nanos / 1e9
|
|
19
|
+
).strftime("%A, %B %d, %Y %I:%M:%S"),
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@click.command("list", cls=QwakCommand)
|
|
24
|
+
@click.option("--project-id", metavar="NAME", required=True, help="Project id")
|
|
25
|
+
@click.option(
|
|
26
|
+
"--format",
|
|
27
|
+
default="text",
|
|
28
|
+
show_default=True,
|
|
29
|
+
type=click.Choice(["text", "json"], case_sensitive=True),
|
|
30
|
+
metavar="FORMAT",
|
|
31
|
+
required=False,
|
|
32
|
+
help="The formatting style for commands output (choose from text, json)",
|
|
33
|
+
)
|
|
34
|
+
def model_list(project_id, format, **kwargs):
|
|
35
|
+
model_list_result = execute_models_list(project_id)
|
|
36
|
+
columns = ["Model id", "Display name", "Creation date", "Last updated"]
|
|
37
|
+
if format == "json":
|
|
38
|
+
output_as_json(model_list_result)
|
|
39
|
+
elif format == "text":
|
|
40
|
+
output_as_table(model_list_result.project.models, parse_model, headers=columns)
|
|
File without changes
|