ibm-watson-openscale-cli-tool


Nameibm-watson-openscale-cli-tool JSON
Version 3.5.58 PyPI version JSON
download
home_pagehttps://www.ibm.com/cloud/watson-openscale
SummaryCLI library to automate the onboarding process to IBM Watson OpenScale
upload_time2024-10-29 04:42:39
maintainerNone
docs_urlNone
authorIBM Corp
requires_python>=3.10
licenseApache-2.0
keywords ai-openscale ibm-watson
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ibm-watson-openscale-cli
![Status](https://img.shields.io/badge/status-beta-yellow.svg)
[![Latest Stable Version](https://img.shields.io/pypi/v/ibm-watson-openscale-cli.svg)](https://pypi.python.org/pypi/ibm-watson-openscale-cli-tool)

IBM Watson Openscale "express path" configuration tool. This tool allows the user to get started quickly with Watson OpenScale.
* If needed, automatically provision a Lite plan instance for IBM Watson OpenScale.
* If needed, automatically provision a Lite plan instance for IBM Watson Machine Learning.
* Drop and re-create the IBM Watson OpenScale datamart instance and datamart database schema.
* Optionally, deploy a sample machine learning model to the WML instance.
* Configure the sample model instance to OpenScale, including payload logging, fairness checking, feedback, quality checking, drift checking, and explainability.
* Optionally, store up to 7 days of historical payload, fairness, quality and drift for the sample model.
* Upload new feedback data, generate 100 new live scoring predictions, run fairness, quality, drift, and correlation checks, and generate one explanation.

## What's new in this release
* Support for WML v4 python client, using the new `--v4` option. Note that this requires some manual intervention:
1. manually uninstall the regular watson-machine-learning-client python package (if installed),
2. manually install the watson-machine-learning-client-V4 python package,
3. and only then install or upgrade ibm-watson-openscale-cli-tool.
* Other bug fixes and stability improvements.

## Before you begin
* You need an [IBM Cloud][ibm_cloud] account.
* Create an [IBM Cloud API key](https://console.bluemix.net/docs/iam/userid_keys.html#userapikey).
* If you already have a Watson Machine Learning (WML) instance, ensure it's RC-enabled, learn more about this in the [migration instructions](https://console.bluemix.net/docs/resources/instance_migration.html#migrate).

## Installation

To install, use `pip` or `easy_install`:

```bash
pip install -U ibm-watson-openscale-cli-tool
```

or

```bash
easy_install -U ibm-watson-openscale-cli-tool
```

## Usage

```
ibm-watson-openscale-cli --help

usage: ibm-watson-openscale-cli [-h] (-a APIKEY | -i IAM_TOKEN)
                            [--env {ypprod,ypqa,ypcr,ys1dev,icp}]
                            [--resource-group RESOURCE_GROUP]
                            [--postgres POSTGRES] [--icd ICD] [--db2 DB2]
                            [--deployment-name DEPLOYMENT_NAME]
                            [--keep-schema] [--username USERNAME]
                            [--password PASSWORD] [--url URL]
                            [--datamart-name DATAMART_NAME]
                            [--datamart-id DATAMART_ID]
                            [--history HISTORY] [--history-only]
                            [--history-first-day HISTORY_FIRST_DAY]
                            [--model MODEL] [--list-models]
                            [--custom-model CUSTOM_MODEL]
                            [--custom-model-directory CUSTOM_MODEL_DIRECTORY]
                            [--extend] [--protect-datamart]
                            [--iam-integration] [--bedrock-url]
                            [--reset {metrics,monitors,datamart,model,all}]
                            [--verbose] [--version] [--v4]
                            [--wml-plan {lite,standard,professional}]
                            [--openscale-plan {lite,essentials}]
                            [--generate-drift-history]

IBM Watson Openscale "express path" configuration tool. This tool allows the
user to get started quickly with Watson OpenScale: 1) If needed, provision a
Lite plan instance for IBM Watson OpenScale 2) If needed, provision a Lite
plan instance for IBM Watson Machine Learning 3) Drop and re-create the IBM
Watson OpenScale datamart instance and datamart database schema 4) Optionally,
deploy a sample machine learning model to the WML instance 5) Configure the
sample model instance to OpenScale, including payload logging, fairness
checking, feedback, quality checking, drift, and explainability
6) Optionally, store up to 7 days of historical payload, fairness, quality and drift for the sample model. 7) Upload new feedback data,
generate 100 new live scoring predictions, run fairness, quality and drift checks, and generate one explanation.

optional arguments:
  -h, --help            show this help message and exit
  --env {ypprod,ypqa,ypcr,ys1dev,icp}
                        Environment. Default "ypprod"
  --resource-group RESOURCE_GROUP
                        Resource Group to use. If not specified, then
                        "default" group is used
  --postgres POSTGRES   Path to postgres credentials file for the datamart
                        database. If --postgres, --icd, and --db2 all are not
                        specified, then the internal Watson OpenScale database
                        is used
  --icd ICD             Path to IBM Cloud Database credentials file for the
                        datamart database
  --db2 DB2             Path to IBM DB2 credentials file for the datamart
                        database
  --deployment-name DEPLOYMENT_NAME
                        Name of the existing deployment to use. Required for
                        Azure ML Studio, SPSS Engine and Custom ML Engine, but
                        optional for Watson Machine Learning. Required for
                        custom models
  --keep-schema         Use pre-existing datamart schema, only dropping all
                        tables. If not specified, datamart schema is dropped
                        and re-created
  --username USERNAME   ICP username. Required if "icp" environment is chosen,
                        not required if --iam-token is specified
  --password PASSWORD   ICP password. Required if "icp" environment is chosen,
                        not required if --iam-token is specified
  --url URL             ICP url. Required if "icp" environment is chosen
  --datamart-id         DATAMART_ID
                        Specify data mart id. For icp environment, default is
                        "00000000-0000-0000-0000-000000000000"
  --datamart-name DATAMART_NAME
                        Specify data mart name and database schema, default is
                        the datamart database connection username. For
                        internal database, the default is "wosfastpath"
  --history HISTORY     Days of history to preload. Default is 7
  --history-only        Store history only for existing deployment and
                        datamart. Requires --extend and --deployment-name also
                        be specified
  --history-first-day HISTORY_FIRST_DAY
                        Starting day for history. Default is 0
  --model MODEL         Sample model to set up with Watson OpenScale (default
                        "GermanCreditRiskModel")
  --list-models         Lists all available models. If a ML engine is
                        specified, then modesl specific to that engine are
                        listed
  --custom-model CUSTOM_MODEL
                        Name of custom model to set up with Watson OpenScale.
                        If specified, overrides the value set by --model. Also
                        requires that --custom-model-directory
  --custom-model-directory CUSTOM_MODEL_DIRECTORY
                        Directory with model configuration and metadata files.
                        Also requires that --custom-model be specified
  --extend              Extend existing datamart, instead of deleting and
                        recreating it
  --protect-datamart    If specified, the setup will exit if an existing
                        datamart setup is found
  --iam-integration     Must be specified when running in a Cloud Pak for Data environment with iam_integration enabled.
  --bedrock-url         Must be specified when running in a Cloud Pak for Data environment with iam_integration enabled.
  --reset {metrics,monitors,datamart,model,all}
                        Reset existing datamart and/or sample models then exit
  --verbose             verbose flag
  --wml-plan {lite,standard,professional}
                        If no WML instance exists, then provision one with the
                        specified plan. Default is "lite", other plans are
                        paid plans
  --openscale-plan {lite,essentials}
                        If no OpenScale instance exists, then provision one
                        with the specified plan. Default is "lite", other
                        plans are paid plans
  --version             show program's version number and exit
  --v4                  Enable support for WML v4 python client
  --generate-drift-history
                        Generate drift history with live execution instead of
                        loading from pre-generated history. Only needed for
                        backward compatiblity for GermanCreditRiskModel in
                        CP4D v2.1.0.2 (August 2019 GA)

required arguments (only one needed):
  -a APIKEY, --apikey APIKEY
                        IBM Cloud platform user APIKey. If "--env icp" is also
                        specified, APIKey value is not used.
  -i IAM_TOKEN, --iam-token IAM_TOKEN
                        IBM Cloud authentication IAM token, or IBM Cloud
                        private authentication IAM token. Format can be
                        (--iam-token "Bearer <token>") or (--iam-token
                        <token>)

```

## Examples

In this example, if a WML instance already exists it is used, but if not a new Lite plan instance is provisioned and used.
If an OpenScale instance exists, its datamart is dropped and recreated along with its datamart internal database schema.
Otherwise, a Lite plan OpenScale instance is provisioned.
The GermanCreditRiskModel is stored and deployed in WML, configured to OpenScale, and 7 days' historical data stored.
Then new feedback data is uploaded, 100 new live scoring predictions are made, followed by fairness, quality, drift, and one explanation.


```sh
export APIKEY=<IBM_CLOUD_API_KEY>
ibm-watson-openscale-cli --apikey $APIKEY
```

In this example, assume the user already has provisioned instances of WML, OpenScale, IBM Cloud Database for Postgres (ICD), and has selected a schema for the OpenScale datamart database.
The OpenScale datamart is dropped and recreated, and the datamart's database schema is dropped and recreated.
An already-deployed instance of the DrugSelectionModel is configured to OpenScale, and 7 days' historical data stored,
followed by new feedback data upload, 100 new scores, fairness, quality, drift and one explanation.

```sh
export APIKEY=<IBM_CLOUD_API_KEY>
export WML=<path to WML instance credentials JSON file>
export ICD=<path to ICD instance credentials JSON file>
export SCHEMA=<ICD database schema name>
ibm-watson-openscale-cli --apikey $APIKEY --wml $WML --model DrugSelectionModel --deployment-name DrugSelectionModelDeployment --icd $ICD --datamart-name $SCHEMA
```

In this example, assume the user already has provisioned an Entry plan instance of IBM DB2 Warehouse on Cloud.
The OpenScale datamart's tables within the user's existing DB2 schema are dropped and recreated.
The GermanCreditRiskModel is stored and deployed in WML, configured to OpenScale, and 7 days' historical data stored,
followed by new feedback data upload, 100 new scores, fairness, quality, drift and one explanation.

```sh
export APIKEY=<IBM_CLOUD_API_KEY>
export DB2=<path to DB2 instance credentials JSON file>
export SCHEMA=<user's DB2 database schema>
ibm-watson-openscale-cli --apikey $APIKEY --db2 $DB2 --datamart-name $SCHEMA --keep-schema
```

In this example, assume the user has their own custom model named MyBusinessModel stored in WML and deployed as MyBusinessModelDeployment.
Also assume they already have a provisioned instance of OpenScale which has not yet been configured.
In the custom model directory, the user has provided a `configuration.json` file with the required model configuration details.
The OpenScale datamart and datamart database schema are created, and the MyBusinessModelDeployment is configured to OpenScale.
Then new feedback data is uploaded (if provided), 100 new scoring requests are made to the model, followed by fairness and quality checks (if configured), and one explanation.
```sh
export APIKEY=<IBM_CLOUD_API_KEY>
export WML=<path to WML instance credentials JSON file>
export MODELPATH=<path to custom model directory>
ibm-watson-openscale-cli --apikey $APIKEY --wml $WML --custom-model MyBusinessModel --deployment-name MyBusinessModelDeployment --custom-model-directory $MODELPATH
```

## FAQ

### Q: What is the GermanCreditRiskModel sample model?

A. The GermanCreditRiskModel sample model is taken from the "Watson Studio, Watson Machine Learning and Watson OpenScale samples"
[GitHub repo](https://github.com/IBM/watson-openscale-samples), specifically the IBM Watson OpenScale [tutorials](https://github.com/IBM/watson-openscale-samples).
When you run ibm-watson-openscale-cli to deploy and configure the GermanCreditRiskModel, the result will be as if you had run the tutorial notebook appropriate
for your machine learning engine.

### Q: What are the formats for the credentials files?

A: Each credential file has its own format:

Postgres
```
{
  "uri": "postgres://<USERNAME>:<PASSWORD>@<HOSTNAME>:<PORT>/<DB>"
}
```

IBM Cloud Database for Postgres(ICD)
* Copy the Service Credentials from your ICD service instance in IBM Cloud

DB2
```
{
    "username": "<USERNAME>",
    "password": "<PASSWORD>",
    "hostname": "<HOSTNAME>",
    "port": "<PORT>",
    "db": "<DB>"
}
```

### Q: How do the reset options work?

A: The reset options each affect a different level of data in the datamart:

* `--reset metrics` : Clean up the payload logging table, monitoring history tables etc, so that it restores the system to a fresh state with datamart configured, model deployments added, all monitors configured, but no actual metrics in the system yet. The system is ready to go. Not supported for Watson OpenScale internal databases.
* `--reset monitors` : Remove all configured monitors and corresponding metrics and history, but leave the actual model deployments (if any) in the datamart. User can proceed to configure the monitors via user interface, API, or ibm-watson-openscale-cli.
* `--reset datamart` : "Factory reset" the datamart to a fresh state as if there was not any configuration.
* `--reset model` : Delete the sample models and deployments from WML. Not yet supported for non-WML engines. Does not affect the datamart.
* `--reset all` : Reset both the datamart and sample models.

### Q: Can I use SSL for connecting to the datamart DB2 database?

A: Yes. The below options can be used for connecting to a DB2 with SSL:
1. DB2 Warehouse on Cloud databases automatically support SSL, using the VCAP json file generated on the "Service Credentials" page.
2. For on-prem or ICP4D DB2 databases:
    1. You can specify the path on the local client machine to a copy of the DB2 server's SSL certificate "arm" file,
using an "ssldsn" connection string in the VCAP json file:
    ```
    {
      "hostname": "<ipaddr>",
      "username": "<uid>",
      "password": "<pw>",
      "port": 50000,
      "db": "<dbname>",
      "ssldsn": "DATABASE=<dbname>;HOSTNAME=<ipaddr>;PORT=50001;PROTOCOL=TCPIP;UID=<uid>;PWD=<pw>;Security=ssl;SSLServerCertificate=/path_on_local_client_machine_to/db2server_instance.arm;"
    }
    ```
    2. You can specify the base64-encoded certificate as the `certificate_base64` attribute directly in the credentials along with a `ssl` attribute set to true, as below:
    ```
    {
      "hostname": "<ipaddr>",
      "username": "<uid>",
      "password": "<pw>",
      "port": 50000,
      "db": "<dbname>",
      "ssl": true,
      "certificate_base64":"Base64 encoded SSL certificate"
    }
    ```

If SSL connections are not needed, or not configured on the DB2 server, you can remove the "ssldsn" tag and ibm-watson-openscale-cli will use the non-SSL "dsn" tag instead.
If the VCAP has both dsn and ssldsn tags, ibm-watson-openscale-cli will use "ssldsn" tag to create an SSL connection.

### Q: What are the contents of a custom model directory?

A: These files are used to configure a custom model to IBM Watson OpenScale:

Required
*  `configuration.json`: the model configuration details

Optional
*  `model_content.gzip`: exported model file from WML, to be loaded and deployed into WML if `--deployment-name` is not specified
*  `model_meta.json`: exported model metadata from WML (required if model gzip is provided)
*  `pipeline_content.gzip`: exported model pipeline file from WML, to be loaded and deployed into WML if `--deployment-name` is not specified
*  `pipeline_meta.json`: exported model pipeline metadata from WML (required if pipeline gzip is provided)
*  `drift_model.gzip`: exported model file from WML for a trained Drift model (required if drift configuration provided in configuration.json)

#### Syntax of configuration.json

A JSON file that specifies the OpenScale configuration for the model. The key components are:
*  `asset_metadata` (required): top-level model specification elements
*  `training_data_reference` (required): reference to the model training data csv in COS
*  `training_data_type` (optional): required if there are any numeric-valued model features
*  `quality_configuration` (optional): if applicable for the model
*  `fairness_configuration` (optional): if applicable for the model
*  `drift_configuration` (optional): if applicable for the model

Valid values for parameters in `asset_metadata`:
*  `problem_type`: `REGRESSION`, `BINARY_CLASSIFICATION`, `MULTICLASS_CLASSIFICATION`
*  `input_data_type`: `STRUCTURED`

Here is an example:

```
{
    "asset_metadata": {
        "problem_type": "BINARY_CLASSIFICATION",
        "input_data_type": "STRUCTURED",
        "label_column": "Risk",
        "prediction_column": "Scored Labels",
        "probability_column": "Scored Probabilities",
        "categorical_columns": [ "CheckingStatus" ],
        "feature_columns": [ "CheckingStatus", "LoanDuration", "Age" ]
    },
    "training_data_reference": {
        "credentials" : {<IBM Cloud COS credentials>},
        "path" : "<path within COS to training data csv file (bucket name + / + filename)>",
        "firstlineheader": "True"
    },
    "training_data_type": { "LoanDuration": "int", "Age": "int" },
    "quality_configuration": { "threshold": 0.95, "min_records": 40 },
    "fairness_configuration": {
        "features": [
            {
                "feature": "Age",
                "majority": [[ 26, 75 ]],
                "minority": [[ 18, 25 ]],
                "threshold": 0.98
            }
        ],
        "favourable_classes": [ "No Risk" ],
        "unfavourable_classes": [ "Risk" ],
        "min_records": 100
    },
    "drift_configuration": {
        "threshold": 0.15,
        "min_records": 100
    }
}
```

#### Syntax of `training_data.csv`

A CSV file of the data used to train the model.
This data is also used by live scoring requests to the model using the range of actual values for each feature from the training data.
A header row is required, with column names that match the model's feature names.
Any column with numeric values must be included in the `training_data_type` specification in the `configuration.json`.
A typical example:
```
CheckingStatus,LoanDuration,Age,Risk
no_checking,28,30,Risk
0_to_200,28,27,No Risk
. . .
```

## Python version

Tested on Python 3.6, 3.7, 3.8, 3.9.

## Troubleshooting

In some platforms if you're facing problems with the installation of the CLI tool, please use the following commands to install packages:

```
python -m pip install setuptools==50.3.2
python -m pip install psycopg2-binary
```

## Contributing

See [CONTRIBUTING.md][CONTRIBUTING].

## License

This library is licensed under the [Apache 2.0 license][license].

[ibm_cloud]: https://cloud.ibm.com
[responses]: https://github.com/getsentry/responses
[requests]: http://docs.python-requests.org/en/latest/
[CONTRIBUTING]: ./CONTRIBUTING.md
[license]: http://www.apache.org/licenses/LICENSE-2.0

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.ibm.com/cloud/watson-openscale",
    "name": "ibm-watson-openscale-cli-tool",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "ai-openscale, ibm-watson",
    "author": "IBM Corp",
    "author_email": "wps@us.ibm.com",
    "download_url": "https://files.pythonhosted.org/packages/36/74/8a2d13d6e0381374dd870b3af862c42206c58eb88ab96edd223f0b2e20b4/ibm_watson_openscale_cli_tool-3.5.58.tar.gz",
    "platform": null,
    "description": "# ibm-watson-openscale-cli\n![Status](https://img.shields.io/badge/status-beta-yellow.svg)\n[![Latest Stable Version](https://img.shields.io/pypi/v/ibm-watson-openscale-cli.svg)](https://pypi.python.org/pypi/ibm-watson-openscale-cli-tool)\n\nIBM Watson Openscale \"express path\" configuration tool. This tool allows the user to get started quickly with Watson OpenScale.\n* If needed, automatically provision a Lite plan instance for IBM Watson OpenScale.\n* If needed, automatically provision a Lite plan instance for IBM Watson Machine Learning.\n* Drop and re-create the IBM Watson OpenScale datamart instance and datamart database schema.\n* Optionally, deploy a sample machine learning model to the WML instance.\n* Configure the sample model instance to OpenScale, including payload logging, fairness checking, feedback, quality checking, drift checking, and explainability.\n* Optionally, store up to 7 days of historical payload, fairness, quality and drift for the sample model.\n* Upload new feedback data, generate 100 new live scoring predictions, run fairness, quality, drift, and correlation checks, and generate one explanation.\n\n## What's new in this release\n* Support for WML v4 python client, using the new `--v4` option. Note that this requires some manual intervention:\n1. manually uninstall the regular watson-machine-learning-client python package (if installed),\n2. manually install the watson-machine-learning-client-V4 python package,\n3. and only then install or upgrade ibm-watson-openscale-cli-tool.\n* Other bug fixes and stability improvements.\n\n## Before you begin\n* You need an [IBM Cloud][ibm_cloud] account.\n* Create an [IBM Cloud API key](https://console.bluemix.net/docs/iam/userid_keys.html#userapikey).\n* If you already have a Watson Machine Learning (WML) instance, ensure it's RC-enabled, learn more about this in the [migration instructions](https://console.bluemix.net/docs/resources/instance_migration.html#migrate).\n\n## Installation\n\nTo install, use `pip` or `easy_install`:\n\n```bash\npip install -U ibm-watson-openscale-cli-tool\n```\n\nor\n\n```bash\neasy_install -U ibm-watson-openscale-cli-tool\n```\n\n## Usage\n\n```\nibm-watson-openscale-cli --help\n\nusage: ibm-watson-openscale-cli [-h] (-a APIKEY | -i IAM_TOKEN)\n                            [--env {ypprod,ypqa,ypcr,ys1dev,icp}]\n                            [--resource-group RESOURCE_GROUP]\n                            [--postgres POSTGRES] [--icd ICD] [--db2 DB2]\n                            [--deployment-name DEPLOYMENT_NAME]\n                            [--keep-schema] [--username USERNAME]\n                            [--password PASSWORD] [--url URL]\n                            [--datamart-name DATAMART_NAME]\n                            [--datamart-id DATAMART_ID]\n                            [--history HISTORY] [--history-only]\n                            [--history-first-day HISTORY_FIRST_DAY]\n                            [--model MODEL] [--list-models]\n                            [--custom-model CUSTOM_MODEL]\n                            [--custom-model-directory CUSTOM_MODEL_DIRECTORY]\n                            [--extend] [--protect-datamart]\n                            [--iam-integration] [--bedrock-url]\n                            [--reset {metrics,monitors,datamart,model,all}]\n                            [--verbose] [--version] [--v4]\n                            [--wml-plan {lite,standard,professional}]\n                            [--openscale-plan {lite,essentials}]\n                            [--generate-drift-history]\n\nIBM Watson Openscale \"express path\" configuration tool. This tool allows the\nuser to get started quickly with Watson OpenScale: 1) If needed, provision a\nLite plan instance for IBM Watson OpenScale 2) If needed, provision a Lite\nplan instance for IBM Watson Machine Learning 3) Drop and re-create the IBM\nWatson OpenScale datamart instance and datamart database schema 4) Optionally,\ndeploy a sample machine learning model to the WML instance 5) Configure the\nsample model instance to OpenScale, including payload logging, fairness\nchecking, feedback, quality checking, drift, and explainability\n6) Optionally, store up to 7 days of historical payload, fairness, quality and drift for the sample model. 7) Upload new feedback data,\ngenerate 100 new live scoring predictions, run fairness, quality and drift checks, and generate one explanation.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --env {ypprod,ypqa,ypcr,ys1dev,icp}\n                        Environment. Default \"ypprod\"\n  --resource-group RESOURCE_GROUP\n                        Resource Group to use. If not specified, then\n                        \"default\" group is used\n  --postgres POSTGRES   Path to postgres credentials file for the datamart\n                        database. If --postgres, --icd, and --db2 all are not\n                        specified, then the internal Watson OpenScale database\n                        is used\n  --icd ICD             Path to IBM Cloud Database credentials file for the\n                        datamart database\n  --db2 DB2             Path to IBM DB2 credentials file for the datamart\n                        database\n  --deployment-name DEPLOYMENT_NAME\n                        Name of the existing deployment to use. Required for\n                        Azure ML Studio, SPSS Engine and Custom ML Engine, but\n                        optional for Watson Machine Learning. Required for\n                        custom models\n  --keep-schema         Use pre-existing datamart schema, only dropping all\n                        tables. If not specified, datamart schema is dropped\n                        and re-created\n  --username USERNAME   ICP username. Required if \"icp\" environment is chosen,\n                        not required if --iam-token is specified\n  --password PASSWORD   ICP password. Required if \"icp\" environment is chosen,\n                        not required if --iam-token is specified\n  --url URL             ICP url. Required if \"icp\" environment is chosen\n  --datamart-id         DATAMART_ID\n                        Specify data mart id. For icp environment, default is\n                        \"00000000-0000-0000-0000-000000000000\"\n  --datamart-name DATAMART_NAME\n                        Specify data mart name and database schema, default is\n                        the datamart database connection username. For\n                        internal database, the default is \"wosfastpath\"\n  --history HISTORY     Days of history to preload. Default is 7\n  --history-only        Store history only for existing deployment and\n                        datamart. Requires --extend and --deployment-name also\n                        be specified\n  --history-first-day HISTORY_FIRST_DAY\n                        Starting day for history. Default is 0\n  --model MODEL         Sample model to set up with Watson OpenScale (default\n                        \"GermanCreditRiskModel\")\n  --list-models         Lists all available models. If a ML engine is\n                        specified, then modesl specific to that engine are\n                        listed\n  --custom-model CUSTOM_MODEL\n                        Name of custom model to set up with Watson OpenScale.\n                        If specified, overrides the value set by --model. Also\n                        requires that --custom-model-directory\n  --custom-model-directory CUSTOM_MODEL_DIRECTORY\n                        Directory with model configuration and metadata files.\n                        Also requires that --custom-model be specified\n  --extend              Extend existing datamart, instead of deleting and\n                        recreating it\n  --protect-datamart    If specified, the setup will exit if an existing\n                        datamart setup is found\n  --iam-integration     Must be specified when running in a Cloud Pak for Data environment with iam_integration enabled.\n  --bedrock-url         Must be specified when running in a Cloud Pak for Data environment with iam_integration enabled.\n  --reset {metrics,monitors,datamart,model,all}\n                        Reset existing datamart and/or sample models then exit\n  --verbose             verbose flag\n  --wml-plan {lite,standard,professional}\n                        If no WML instance exists, then provision one with the\n                        specified plan. Default is \"lite\", other plans are\n                        paid plans\n  --openscale-plan {lite,essentials}\n                        If no OpenScale instance exists, then provision one\n                        with the specified plan. Default is \"lite\", other\n                        plans are paid plans\n  --version             show program's version number and exit\n  --v4                  Enable support for WML v4 python client\n  --generate-drift-history\n                        Generate drift history with live execution instead of\n                        loading from pre-generated history. Only needed for\n                        backward compatiblity for GermanCreditRiskModel in\n                        CP4D v2.1.0.2 (August 2019 GA)\n\nrequired arguments (only one needed):\n  -a APIKEY, --apikey APIKEY\n                        IBM Cloud platform user APIKey. If \"--env icp\" is also\n                        specified, APIKey value is not used.\n  -i IAM_TOKEN, --iam-token IAM_TOKEN\n                        IBM Cloud authentication IAM token, or IBM Cloud\n                        private authentication IAM token. Format can be\n                        (--iam-token \"Bearer <token>\") or (--iam-token\n                        <token>)\n\n```\n\n## Examples\n\nIn this example, if a WML instance already exists it is used, but if not a new Lite plan instance is provisioned and used.\nIf an OpenScale instance exists, its datamart is dropped and recreated along with its datamart internal database schema.\nOtherwise, a Lite plan OpenScale instance is provisioned.\nThe GermanCreditRiskModel is stored and deployed in WML, configured to OpenScale, and 7 days' historical data stored.\nThen new feedback data is uploaded, 100 new live scoring predictions are made, followed by fairness, quality, drift, and one explanation.\n\n\n```sh\nexport APIKEY=<IBM_CLOUD_API_KEY>\nibm-watson-openscale-cli --apikey $APIKEY\n```\n\nIn this example, assume the user already has provisioned instances of WML, OpenScale, IBM Cloud Database for Postgres (ICD), and has selected a schema for the OpenScale datamart database.\nThe OpenScale datamart is dropped and recreated, and the datamart's database schema is dropped and recreated.\nAn already-deployed instance of the DrugSelectionModel is configured to OpenScale, and 7 days' historical data stored,\nfollowed by new feedback data upload, 100 new scores, fairness, quality, drift and one explanation.\n\n```sh\nexport APIKEY=<IBM_CLOUD_API_KEY>\nexport WML=<path to WML instance credentials JSON file>\nexport ICD=<path to ICD instance credentials JSON file>\nexport SCHEMA=<ICD database schema name>\nibm-watson-openscale-cli --apikey $APIKEY --wml $WML --model DrugSelectionModel --deployment-name DrugSelectionModelDeployment --icd $ICD --datamart-name $SCHEMA\n```\n\nIn this example, assume the user already has provisioned an Entry plan instance of IBM DB2 Warehouse on Cloud.\nThe OpenScale datamart's tables within the user's existing DB2 schema are dropped and recreated.\nThe GermanCreditRiskModel is stored and deployed in WML, configured to OpenScale, and 7 days' historical data stored,\nfollowed by new feedback data upload, 100 new scores, fairness, quality, drift and one explanation.\n\n```sh\nexport APIKEY=<IBM_CLOUD_API_KEY>\nexport DB2=<path to DB2 instance credentials JSON file>\nexport SCHEMA=<user's DB2 database schema>\nibm-watson-openscale-cli --apikey $APIKEY --db2 $DB2 --datamart-name $SCHEMA --keep-schema\n```\n\nIn this example, assume the user has their own custom model named MyBusinessModel stored in WML and deployed as MyBusinessModelDeployment.\nAlso assume they already have a provisioned instance of OpenScale which has not yet been configured.\nIn the custom model directory, the user has provided a `configuration.json` file with the required model configuration details.\nThe OpenScale datamart and datamart database schema are created, and the MyBusinessModelDeployment is configured to OpenScale.\nThen new feedback data is uploaded (if provided), 100 new scoring requests are made to the model, followed by fairness and quality checks (if configured), and one explanation.\n```sh\nexport APIKEY=<IBM_CLOUD_API_KEY>\nexport WML=<path to WML instance credentials JSON file>\nexport MODELPATH=<path to custom model directory>\nibm-watson-openscale-cli --apikey $APIKEY --wml $WML --custom-model MyBusinessModel --deployment-name MyBusinessModelDeployment --custom-model-directory $MODELPATH\n```\n\n## FAQ\n\n### Q: What is the GermanCreditRiskModel sample model?\n\nA. The GermanCreditRiskModel sample model is taken from the \"Watson Studio, Watson Machine Learning and Watson OpenScale samples\"\n[GitHub repo](https://github.com/IBM/watson-openscale-samples), specifically the IBM Watson OpenScale [tutorials](https://github.com/IBM/watson-openscale-samples).\nWhen you run ibm-watson-openscale-cli to deploy and configure the GermanCreditRiskModel, the result will be as if you had run the tutorial notebook appropriate\nfor your machine learning engine.\n\n### Q: What are the formats for the credentials files?\n\nA: Each credential file has its own format:\n\nPostgres\n```\n{\n  \"uri\": \"postgres://<USERNAME>:<PASSWORD>@<HOSTNAME>:<PORT>/<DB>\"\n}\n```\n\nIBM Cloud Database for Postgres(ICD)\n* Copy the Service Credentials from your ICD service instance in IBM Cloud\n\nDB2\n```\n{\n    \"username\": \"<USERNAME>\",\n    \"password\": \"<PASSWORD>\",\n    \"hostname\": \"<HOSTNAME>\",\n    \"port\": \"<PORT>\",\n    \"db\": \"<DB>\"\n}\n```\n\n### Q: How do the reset options work?\n\nA: The reset options each affect a different level of data in the datamart:\n\n* `--reset metrics` : Clean up the payload logging table, monitoring history tables etc, so that it restores the system to a fresh state with datamart configured, model deployments added, all monitors configured, but no actual metrics in the system yet. The system is ready to go. Not supported for Watson OpenScale internal databases.\n* `--reset monitors` : Remove all configured monitors and corresponding metrics and history, but leave the actual model deployments (if any) in the datamart. User can proceed to configure the monitors via user interface, API, or ibm-watson-openscale-cli.\n* `--reset datamart` : \"Factory reset\" the datamart to a fresh state as if there was not any configuration.\n* `--reset model` : Delete the sample models and deployments from WML. Not yet supported for non-WML engines. Does not affect the datamart.\n* `--reset all` : Reset both the datamart and sample models.\n\n### Q: Can I use SSL for connecting to the datamart DB2 database?\n\nA: Yes. The below options can be used for connecting to a DB2 with SSL:\n1. DB2 Warehouse on Cloud databases automatically support SSL, using the VCAP json file generated on the \"Service Credentials\" page.\n2. For on-prem or ICP4D DB2 databases:\n    1. You can specify the path on the local client machine to a copy of the DB2 server's SSL certificate \"arm\" file,\nusing an \"ssldsn\" connection string in the VCAP json file:\n    ```\n    {\n      \"hostname\": \"<ipaddr>\",\n      \"username\": \"<uid>\",\n      \"password\": \"<pw>\",\n      \"port\": 50000,\n      \"db\": \"<dbname>\",\n      \"ssldsn\": \"DATABASE=<dbname>;HOSTNAME=<ipaddr>;PORT=50001;PROTOCOL=TCPIP;UID=<uid>;PWD=<pw>;Security=ssl;SSLServerCertificate=/path_on_local_client_machine_to/db2server_instance.arm;\"\n    }\n    ```\n    2. You can specify the base64-encoded certificate as the `certificate_base64` attribute directly in the credentials along with a `ssl` attribute set to true, as below:\n    ```\n    {\n      \"hostname\": \"<ipaddr>\",\n      \"username\": \"<uid>\",\n      \"password\": \"<pw>\",\n      \"port\": 50000,\n      \"db\": \"<dbname>\",\n      \"ssl\": true,\n      \"certificate_base64\":\"Base64 encoded SSL certificate\"\n    }\n    ```\n\nIf SSL connections are not needed, or not configured on the DB2 server, you can remove the \"ssldsn\" tag and ibm-watson-openscale-cli will use the non-SSL \"dsn\" tag instead.\nIf the VCAP has both dsn and ssldsn tags, ibm-watson-openscale-cli will use \"ssldsn\" tag to create an SSL connection.\n\n### Q: What are the contents of a custom model directory?\n\nA: These files are used to configure a custom model to IBM Watson OpenScale:\n\nRequired\n*  `configuration.json`: the model configuration details\n\nOptional\n*  `model_content.gzip`: exported model file from WML, to be loaded and deployed into WML if `--deployment-name` is not specified\n*  `model_meta.json`: exported model metadata from WML (required if model gzip is provided)\n*  `pipeline_content.gzip`: exported model pipeline file from WML, to be loaded and deployed into WML if `--deployment-name` is not specified\n*  `pipeline_meta.json`: exported model pipeline metadata from WML (required if pipeline gzip is provided)\n*  `drift_model.gzip`: exported model file from WML for a trained Drift model (required if drift configuration provided in configuration.json)\n\n#### Syntax of configuration.json\n\nA JSON file that specifies the OpenScale configuration for the model. The key components are:\n*  `asset_metadata` (required): top-level model specification elements\n*  `training_data_reference` (required): reference to the model training data csv in COS\n*  `training_data_type` (optional): required if there are any numeric-valued model features\n*  `quality_configuration` (optional): if applicable for the model\n*  `fairness_configuration` (optional): if applicable for the model\n*  `drift_configuration` (optional): if applicable for the model\n\nValid values for parameters in `asset_metadata`:\n*  `problem_type`: `REGRESSION`, `BINARY_CLASSIFICATION`, `MULTICLASS_CLASSIFICATION`\n*  `input_data_type`: `STRUCTURED`\n\nHere is an example:\n\n```\n{\n    \"asset_metadata\": {\n        \"problem_type\": \"BINARY_CLASSIFICATION\",\n        \"input_data_type\": \"STRUCTURED\",\n        \"label_column\": \"Risk\",\n        \"prediction_column\": \"Scored Labels\",\n        \"probability_column\": \"Scored Probabilities\",\n        \"categorical_columns\": [ \"CheckingStatus\" ],\n        \"feature_columns\": [ \"CheckingStatus\", \"LoanDuration\", \"Age\" ]\n    },\n    \"training_data_reference\": {\n        \"credentials\" : {<IBM Cloud COS credentials>},\n        \"path\" : \"<path within COS to training data csv file (bucket name + / + filename)>\",\n        \"firstlineheader\": \"True\"\n    },\n    \"training_data_type\": { \"LoanDuration\": \"int\", \"Age\": \"int\" },\n    \"quality_configuration\": { \"threshold\": 0.95, \"min_records\": 40 },\n    \"fairness_configuration\": {\n        \"features\": [\n            {\n                \"feature\": \"Age\",\n                \"majority\": [[ 26, 75 ]],\n                \"minority\": [[ 18, 25 ]],\n                \"threshold\": 0.98\n            }\n        ],\n        \"favourable_classes\": [ \"No Risk\" ],\n        \"unfavourable_classes\": [ \"Risk\" ],\n        \"min_records\": 100\n    },\n    \"drift_configuration\": {\n        \"threshold\": 0.15,\n        \"min_records\": 100\n    }\n}\n```\n\n#### Syntax of `training_data.csv`\n\nA CSV file of the data used to train the model.\nThis data is also used by live scoring requests to the model using the range of actual values for each feature from the training data.\nA header row is required, with column names that match the model's feature names.\nAny column with numeric values must be included in the `training_data_type` specification in the `configuration.json`.\nA typical example:\n```\nCheckingStatus,LoanDuration,Age,Risk\nno_checking,28,30,Risk\n0_to_200,28,27,No Risk\n. . .\n```\n\n## Python version\n\nTested on Python 3.6, 3.7, 3.8, 3.9.\n\n## Troubleshooting\n\nIn some platforms if you're facing problems with the installation of the CLI tool, please use the following commands to install packages:\n\n```\npython -m pip install setuptools==50.3.2\npython -m pip install psycopg2-binary\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md][CONTRIBUTING].\n\n## License\n\nThis library is licensed under the [Apache 2.0 license][license].\n\n[ibm_cloud]: https://cloud.ibm.com\n[responses]: https://github.com/getsentry/responses\n[requests]: http://docs.python-requests.org/en/latest/\n[CONTRIBUTING]: ./CONTRIBUTING.md\n[license]: http://www.apache.org/licenses/LICENSE-2.0\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "CLI library to automate the onboarding process to IBM Watson OpenScale",
    "version": "3.5.58",
    "project_urls": {
        "Homepage": "https://www.ibm.com/cloud/watson-openscale"
    },
    "split_keywords": [
        "ai-openscale",
        " ibm-watson"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed7a4d15ea4abf5c0071fd0808c0c78833346b7bac3e27769855ca915e4029e2",
                "md5": "596819d057c1afad8feaa9ded0e95adf",
                "sha256": "eb9a6b08feb3666c331447cf449104fd2942bbc19f6e3efca33c28b4abb02041"
            },
            "downloads": -1,
            "filename": "ibm_watson_openscale_cli_tool-3.5.58-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "596819d057c1afad8feaa9ded0e95adf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10560849,
            "upload_time": "2024-10-29T04:42:09",
            "upload_time_iso_8601": "2024-10-29T04:42:09.876356Z",
            "url": "https://files.pythonhosted.org/packages/ed/7a/4d15ea4abf5c0071fd0808c0c78833346b7bac3e27769855ca915e4029e2/ibm_watson_openscale_cli_tool-3.5.58-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "36748a2d13d6e0381374dd870b3af862c42206c58eb88ab96edd223f0b2e20b4",
                "md5": "40e93cad395e3f33e54f5f8d50085ce8",
                "sha256": "c86a81c80f56ca6cb976d52c98882ab83650fa23b3ef33eddaf300aa5ff27935"
            },
            "downloads": -1,
            "filename": "ibm_watson_openscale_cli_tool-3.5.58.tar.gz",
            "has_sig": false,
            "md5_digest": "40e93cad395e3f33e54f5f8d50085ce8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 10220005,
            "upload_time": "2024-10-29T04:42:39",
            "upload_time_iso_8601": "2024-10-29T04:42:39.650734Z",
            "url": "https://files.pythonhosted.org/packages/36/74/8a2d13d6e0381374dd870b3af862c42206c58eb88ab96edd223f0b2e20b4/ibm_watson_openscale_cli_tool-3.5.58.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-29 04:42:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ibm-watson-openscale-cli-tool"
}
        
Elapsed time: 0.58428s