ml function create
Create a function with the defined payload. A function is code that can be deployed as an online or batch deployment.
Syntax
cpd-cli ml function create \
[--context=<catalog-project-or-space-id>] \
[--cpd-config=<cpd-config-location>] \
[--cpd-scope=<cpd-scope>] \
[--custom=<map<key,value>>] \
[--description=<resource-description>] \
[--jmes-query=<jmespath-query>] \
[--model-references=<function-model-references>] \
[--name=<resource-name>] \
[--output=json|yaml|table] \
[--output-file=<output-file-location>] \
--profile=<cpd-profile-name> \
[--project-id=<cpd-project-id>] \
[--quiet] \
[--raw-output=true|false] \
[--sample-scoring-input=<sample-scoring-data>] \
[--schemas=<expected-data-schemas>] \
--software-spec=<software-specification> \
--space-id=<space-identifier> \
[--tags=<tag1,tag2,...>] \
[--type=<function-type>] \
[--verbose]
Arguments
The ml function create
command has
no arguments.
Options
Table 1: Command options
Option | Description |
---|---|
--context |
Specify the configuration context
name.
|
--cpd-config |
The Cloud Pak for Data
configuration location. For example,
$HOME/.cpd-cli/config.
|
--cpd-scope |
The Cloud Pak for Data space, project, or catalog scope. For example, cpd://default-context/spaces/7bccdda4-9752-4f37-868e-891de6c48135.
|
--custom |
Specify user-defined properties as
key-value pairs.
|
--description |
Specify a
resource
description.
|
|
Display command
help.
|
--jmes-query |
Provide a JMESPath query to
customize the output.
|
--model-references |
Specify a list of model references
(if any) that are used by the function. The specified references are provided by the function owner
and are used only for tracking usage.
|
--name |
Specify a
resource name.
|
--output |
Specify an output
format.
|
--output-file |
Specify a file path where all
output is redirected.
|
--profile |
The name of the profile that you
created to store information about an instance of Cloud Pak for Data and your credentials for the
instance.
|
--project-id |
Specify a Cloud Pak
for Data project instance that contains the resource.
|
--quiet |
Suppress verbose
messages.
|
--raw-output |
When set to true, single values
are not surrounded by quotation marks in
JSON output
mode.
|
--sample-scoring-input |
Specify the sample scoring
data.
|
--schemas |
Specify the expected data
schemas. Schemas that are defined here take precedence over any schemas that are provided in the
data references.
|
--software-spec |
Specify a software specification
(SoftwareSpecRel object).
|
--space-id |
Specify a space
identifier.
|
--tags |
Specify tags that can be used
when searching for resources.
|
--type |
Specify a function
type to create. Only the 'python' type is currently supported. Functions expect a *.gzip file that
contains a python file that defines the function. The Python functions specify what must be run when
the function is deployed and what must be run when the scoring function is called. You can customize
what preparation Watson Machine Learning does in the environment when you deploy the function, as
well as what steps Watson Machine Learning takes to generate the output when you later call the API.
The function consists of the outer function (any place that is not within the score function) and
the inner score function. The code that sits in the outer function runs when the function is
deployed. The environment is then frozen and ready to be used whenever the online scoring or batch
inline job processing API is called. The code that sits in the inner score function runs when the
online scoring or batch inline job processing API is called (in the environment customized by the
outer function). The following Python
example illustrates the
behavior:
For more information, see Deploying Python functions in Watson Machine Learning.
|
--verbose |
Logs include more detailed
messages.
|