cli库自动化ibm watson openscale的入职流程

ibm-ai-openscale-cli的Python项目详细描述


ibm ai openscale cli

status最新稳定版本

IBM Watson OpenScale"快速路径"配置工具。此工具允许用户快速开始使用Watson OpenScale。

  • 如果需要,自动为ibm watson openscale提供lite计划实例
  • 如果需要,自动为IBM Watson机器学习提供Lite计划实例
  • 删除并重新创建ibm watson openscale datamart实例和datamart数据库模式
  • (可选)将示例机器学习模型部署到wml实例
  • 将示例模型实例配置为openscale,包括有效负载日志记录、公平性检查、反馈、质量检查和可解释性
  • 可选地,为样本模型存储长达7天的历史有效负载、公平性和质量数据
  • 上载新的反馈数据,生成100个新的实时评分预测,运行公平性和质量检查,并生成一个解释

此版本的新增功能

  • 支持添加到内置示例GermanCreditisk模型中的漂移监测,包括7天的漂移监测历史记录
  • 支持自定义模型配置中的漂移监测
  • 其他错误修复和稳定性改进

开始之前

  • 您需要一个IBM Cloud帐户。
  • 创建IBM Cloud API密钥
  • 如果您已经有了一个Watson机器学习(WML)实例,请确保它启用了RC,请在迁移说明中详细了解此操作。

安装

要安装,请使用pipeasy_install

pip install -U ibm-ai-openscale-cli

easy_install -U ibm-ai-openscale-cli

用法

ibm-ai-openscale-cli --help

usage: ibm-ai-openscale-cli [-h] (-a APIKEY | -i IAM_TOKEN)
                            [--env {ypprod,ypqa,ys1dev,icp}]
                            [--resource-group RESOURCE_GROUP]
                            [--postgres POSTGRES] [--icd ICD] [--db2 DB2]
                            [--wml WML] [--azure-studio AZURE_STUDIO]
                            [--azure-service AZURE_SERVICE] [--spss SPSS]
                            [--custom CUSTOM] [--aws AWS]
                            [--deployment-name DEPLOYMENT_NAME]
                            [--keep-schema] [--username USERNAME]
                            [--password PASSWORD] [--url URL]
                            [--datamart-name DATAMART_NAME]
                            [--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]
                            [--reset {metrics,monitors,datamart,model,all}]
                            [--verbose] [--version]
                            [--wml-plan {lite,standard,professional}]
                            [--openscale-plan {lite,standard}]

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, and explainability 6) Optionally, store
up to 7 days of historical payload, fairness, and quality data for the sample
model 7) Upload new feedback data, generate 100 new live scoring predictions,
run fairness and quality checks, and generate one explanation

optional arguments:
  -h, --help            show this help message and exit
  --env {ypprod,ypqa,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
  --wml WML             Path to IBM WML credentials file
  --azure-studio AZURE_STUDIO
                        Path to Microsoft Azure credentials file for Microsoft
                        Azure ML Studio
  --azure-service AZURE_SERVICE
                        Path to Microsoft Azure credentials file for Microsoft
                        Azure ML Service
  --spss SPSS           Path to SPSS credentials file
  --custom CUSTOM       Path to Custom Engine credentials file
  --aws AWS             Path to Amazon Web Services credentials file
  --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-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
  --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,standard}
                        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

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>)

示例

在本例中,如果wml实例已经存在,则使用该实例,但如果不存在,则提供并使用新的lite计划实例。 如果存在openscale实例,则会删除其datamart并与其内部数据库架构一起重新创建。 否则,将设置lite plan openscale实例。 germancreditiskmodel存储并部署在wml中,配置为openscale,并存储7天的历史数据。 然后上传新的反馈数据,做出100个新的实时评分预测,随后进行公平性和质量检查,并给出一个解释。

exportAPIKEY=<IBM_CLOUD_API_KEY>
ibm-ai-openscale-cli --apikey $APIKEY

在本例中,假设用户已经设置了wml、openscale、ibmclouddatabaseforpostgres(icd)的实例,并为openscale datamart数据库选择了模式。 删除并重新创建openscale数据集市,删除并重新创建数据集市的数据库架构。 已部署的DrugSelectionModel实例配置为OpenScale,并存储7天的历史数据, 之后是新的反馈数据上传、100个新分数、公平性和质量检查以及一个解释。

exportAPIKEY=<IBM_CLOUD_API_KEY>
exportWML=<path to WML instance credentials JSON file>
exportICD=<path to ICD instance credentials JSON file>
exportSCHEMA=<ICD database schema name>
ibm-ai-openscale-cli --apikey $APIKEY --wml $WML --model DrugSelectionModel --deployment-name DrugSelectionModelDeployment --icd $ICD --datamart-name $SCHEMA

在本例中,假设用户已经在云上提供了ibm db2 warehouse的入口计划实例。 用户现有的db2模式中的openscale datamart表将被删除并重新创建。 germancreditiskmodel存储并部署在wml中,配置为openscale,并存储7天的历史数据, 接下来是新的反馈数据上传,100个新分数,公平性和质量检查,以及一个expl反应性:

exportAPIKEY=<IBM_CLOUD_API_KEY>
exportDB2=<path to DB2 instance credentials JSON file>
exportSCHEMA=<user's DB2 database schema>
ibm-ai-openscale-cli --apikey $APIKEY --db2 $DB2 --datamart-name $SCHEMA --keep-schema

在本例中,假设用户在wml中存储了自己的自定义模型mybusinessmodel,并将其部署为mybusinessmodeldeployment。 还假设它们已经有一个openscale的已配置实例,但该实例尚未配置。 在自定义模型目录中,用户提供了一个configuration.json文件,其中包含所需的模型配置详细信息。 创建了openscale datamart和datamart数据库模式,并将mybusinessmodeldeployment配置为openscale。 然后上载新的反馈数据(如果提供),向模型发出100个新的评分请求,然后进行公平性和质量检查(如果配置),并给出一个解释。

exportAPIKEY=<IBM_CLOUD_API_KEY>
exportWML=<path to WML instance credentials JSON file>
exportMODELPATH=<path to custom model directory>
ibm-ai-openscale-cli --apikey $APIKEY --wml $WML --custom-model MyBusinessModel --deployment-name MyBusinessModelDeployment --custom-model-directory $MODELPATH

FAQ

问:德国雷氏模型的样本模型是什么?

a.GermanCreditiskmodel示例模型取自"Watson Studio、Watson机器学习和Watson OpenScale示例" github repo,特别是ibm watson openscale教程。 当您运行ibm ai openscale cli来部署和配置germancreditiskmodel时,结果将如同您运行了适当的教程笔记本 为您的机器学习引擎。

问:凭证文件的格式是什么?

A:每个凭证文件都有自己的格式:

博士后

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

IBM Postgres云数据库(ICD)

  • 从IBM云中的ICD服务实例复制服务凭据

DB2

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

IBM Watson机器学习(WML)

  • 从IBM云中的WML服务实例复制服务凭据

微软azure

pip install -U ibm-ai-openscale-cli
0
pip install -U ibm-ai-openscale-cli
1

自定义引擎

pip install -U ibm-ai-openscale-cli
2

亚马逊网络服务Sagemaker(AWS)

pip install -U ibm-ai-openscale-cli
3

问:重置选项是如何工作的?

A:重置选项会影响数据集市中不同级别的数据:

  • --reset metrics:清除有效负载日志记录表、监视历史记录表等,以便在配置了datamart、添加了模型部署、配置了所有监控器但系统中尚未实际度量的情况下将系统还原到新状态。系统准备就绪。Watson OpenScale内部数据库不支持。
  • --reset monitors:删除所有配置的监控器以及相应的度量和历史记录,但将实际的模型部署(如果有的话)保留在datamart中。用户可以通过用户界面、api或ibma ai openscale cli继续配置监视器。
  • --重置数据集市:"factory reset"将数据集市设置为新状态,就像没有任何配置一样。
  • --重置模型:从wml中删除示例模型和部署。尚未支持非WML引擎。不影响数据集市。
  • --全部重置:重置数据集市和示例模型。

问:我可以使用ssl连接到datamart db2数据库吗?

是的。以下选项可用于连接到带有ssl的db2:

  1. 云数据库上的DB2 Warehouse自动支持SSL,使用"服务凭据"页上生成的VCAP JSON文件。
  2. 对于on prem或icp4d db2数据库:
    1. 您可以在本地客户机上指定指向DB2服务器的SSL证书"ARM"文件副本的路径, 在vcap json文件中使用"ssldsn"连接字符串:
    2. < > >
      pip install -U ibm-ai-openscale-cli
      
      4
      1. 您可以直接在凭证中将base64编码的凭证指定为certificate\u base64属性,并将ssl属性设置为true,如下所示:
      2. < > >
        pip install -U ibm-ai-openscale-cli
        
        5 < > >

        如果不需要ssl连接,或者没有在db2服务器上配置ssl连接,则可以删除"ssl dsn"标记,而ibm ai openscale cli将使用非ssl"dsn"标记。 如果vcap同时具有dsn和ssldsn标记,那么ibm ai openscale cli w我将使用"ssldsn"标记创建ssl连接。

        问:自定义模型目录的内容是什么?

        A:这些文件用于将自定义模型配置为IBM Watson OpenScale:

        必需的

        • configuration.json:模型配置详细信息

        可选

        • model-content.gzip:从wml导出模型文件,如果未指定部署名称,则将其加载并部署到wml中
        • model_meta.json:从wml导出的模型元数据(如果提供了模型gzip,则为必需)
        • pipeline_content.gzip:从wml导出的模型管道文件,如果未指定部署名称,则将加载并部署到wml中
        • pipeline_meta.json:从wml导出模型管道元数据(如果提供了管道gzip,则为必需)
        • drift_model.gzip:从wml导出经过训练的漂移模型的模型文件(如果在configuration.json中提供了漂移配置,则需要此文件)

        configuration.json的语法

        一个json文件,指定模型的openscale配置。关键部件是:

        • 资产元数据(必需):顶级模型规范元素
        • 培训数据参考(必需):参考cos中的模型培训数据csv
        • 培训数据类型(可选):如果有任何数值模型功能,则必须输入
        • 质量配置(可选):如果适用于型号
        • 公平配置(可选):如果适用于型号
        • 漂移配置(可选):如果适用于型号

        资产元数据中参数的有效值

        • 问题类型回归二进制分类多类分类
        • 输入数据类型结构化

        下面是一个示例:

        pip install -U ibm-ai-openscale-cli
        
        6

        training_data.csv的语法

        用于训练模型的数据的csv文件。 该数据还可用于使用训练数据中每个特征的实际值范围对模型的实时评分请求。 标题行是必需的,其列名与模型的要素名称匹配。 带有数值的任何列都必须包含在configuration.json中的training_data_type规范中。 典型示例:

        pip install -U ibm-ai-openscale-cli
        
        7

        python版本

        在Python3.5、3.6和3.7上测试。

        贡献

        请参见contribution.md

        许可证

        此库的许可证是在apache 2.0许可证下获得的。

        欢迎加入QQ群-->: 979659372 Python中文网_新手群

        推荐PyPI第三方库


热门话题
java编辑并重新运行spring引导单元测试,无需重新加载上下文即可加快测试速度   为什么我不能做演员?   java为什么是线程。join通常用于停止安卓中的线程   java从weblogic服务器调用JSON POST REST服务时收到400:错误请求   java在DeviceAdmin模式禁用时设置身份验证?   java SortedMap的keySet()能否始终安全地强制转换到SortedSet?   安卓 java。lang.NoSuchMethodException可包裹类   java JOGL库安装   javatomcat内存管理   java使用getString()中的变量   java将最小星号设置为评级栏   Java中字符串相等的println()方法。。。它到底是如何工作的?   java如何从文本中输出的数组中放入随机图像