Train the Model
/utility/train
In the request body, the contents of additional_data depend on the storage_type value:
- When storage_type is set to object_storage, the additional_data object must include the bucket and namespace fields.
- When storage_type is set to pvc, the additional_data object must include the path field set to the path of the metadata.json file.
Request
There are no request parameters for this operation.
- application/json
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
type
Specifies the input parameters for the request.
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
algorithm(required): array
algorithm
Specifies the list of algorithms to train.
-
sample(required): boolean
Allowed Values:
[ true, false ]Indicates whether to apply sample preprocessing. Set this to true to use the default preprocessing script. Set this to false to use the sample script specified in the trainUtilityProcessor.preprocessScript key of your values.yaml file. -
storage_details(required): array
storage_details
Provides the storage location and access details for the stored data.
array-
Array of:
object Discriminator: @type
Discriminator:
{ "propertyName":"@type", "mapping":{ "Algorithms":"#/components/schemas/Algorithms" } }
array-
Array of:
object Discriminator: @type
Discriminator:
{ "propertyName":"@type", "mapping":{ "StorageDetails":"#/components/schemas/StorageDetails" } }
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Defines an algorithm and its training configuration.
object-
algo(required): string
Allowed Values:
[ "knn", "dnn", "cosine", "dnn_mh", "xgboost" ]Specifies the algorithm name. -
hyper_parameters: object
hyper_parameters
Specifies hyperparameters to override the default values. Available parameters vary by algorithm.
-
model_dir(required): string
Specifies the path to store the model files. This field accepts only alphanumeric and underscore (_) characters.
-
model_name(required): string
Specifies the name under which the model is stored.
objectobjectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Specifies the storage location and connection details.
object-
output_file_type(required): string
Specifies the file type to use when storing the data: json, csv, or pickle.
-
path: string
Specifies the storage path where the data is saved.
-
storage_connection_details: array
storage_connection_details
Specifies the connection parameters for the storage location.
-
storage_type: string
Specifies the type of storage to use: pvc or object_storage.
arrayobjectResponse
200 Response
array-
Array of:
object Discriminator: @type
Discriminator:
{ "propertyName":"@type", "mapping":{ "TrainResponse":"#/components/schemas/TrainResponse" } }
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Specifies the output returned by the operation.
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
status(required): string
Indicates the current status of the service.
400 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
401 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
403 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
404 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
405 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
409 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
500 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
501 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
503 Response
objectDiscriminator Values
-
object
Extensible
Base extensible schema for use with TM Forum Open APIs. When used in a schema, the entity must be extended by specifying `@type`.
-
object
Discriminator: @type-allOf[1]
Indicates an error response from the API, usually accompanied by an HTTP status code (3xx, 4xx, or 5xx).
object-
@baseType: string
Specifies the superclass while subclassing.
-
@schemaLocation: string
Provides a URI to the JSON Schema file that defines additional attributes and relationships.
-
@type(required): string
When subclassing, specifies the extensible name of the subclass.
object-
code(required): string
Provides application-specific details, as defined by the API or a common list.
-
message: string
Provides additional error details and recommended corrective actions to display to the client user.
-
reason(required): string
Provides an explanation of the error to display to the client user.
-
referenceError: string
Provides a URI to documentation that describes the error.
-
status: string
Specifies the extended HTTP error code.
Examples
This example shows the cURL command for sending a Train Model request:
curl -X POST 'http://hostname:port/utility/train' -H 'Content-Type: application/json' -d @file.json
where:
-
hostname is the host name of the application server.
-
port is the port for the application server.
-
file.json is the JSON file that specifies the algorithms, training settings, and storage details.
Example of the Request Body
The following sample shows the contents of the file.json file sent as the request body.
{
"@type": "TrainRequest",
"algorithm": [
{
"@type": "Algorithms",
"algo": "knn",
"model_dir": "model/",
"model_name": "recommend_knn",
"hyper_parameters": {
"k_value": 5
}
},
{
"@type": "Algorithms",
"algo": "cosine",
"model_dir": "model/",
"model_name": "recommend_cosine",
"hyper_parameters": {
"k_value": 5
}
},
{
"@type": "Algorithms",
"algo": "dnn",
"model_dir": "model/",
"model_name": "dnn",
"hyper_parameters": {
"test_size": 0.2,
"epochs": 150,
"batch_size": 16,
"loss": "categorical_crossentropy",
"optimizer": "rmsprop",
"learning_rate": 0.001,
"final_activation": "softmax"
}
},
{
"@type": "Algorithms",
"algo": "dnn_mh",
"model_dir": "model/",
"model_name": "dnn_mh",
"hyper_parameters": {
"test_size": 0.2,
"epochs": 150,
"batch_size": 16,
"loss": "categorical_crossentropy",
"optimizer": "rmsprop",
"learning_rate": 0.001,
"final_activation": "softmax"
}
},
{
"@type": "Algorithms",
"algo": "xgboost",
"model_dir": "model/",
"model_name": "ece_outage",
"hyper_parameters": {
"test_size": 0.2,
"n_estimators": 300,
"max_depth": 4,
"learning_rate": 0.04,
"subsample": 0.9,
"colsample_bytree": 0.85,
"reg_alpha": 0.25,
"reg_lambda": 2.0,
"eval_metric": "mlogloss",
"tree_method": "hist"
}
}
],
"sample": true,
"storage_details": [
{
"@type": "StorageDetails",
"storage_type": "object_storage",
"required_data": [
"account_data",
"balance_group_data",
"service_data",
"purchased_product_data",
"product_data",
"deal_data",
"plan_data",
"rate_data",
"event_data",
"deal_data_2",
"over_usage_data",
"usage_details"
],
"additional_details": {
"bucket": "sample-for-dataflow",
"namespace": "adcdefghijk"
}
}
]
}
Example of the Response Body
If successful, the response code 200 is returned with the following response body.
{
"@type": "TrainResponse",
"status": "Training Complete / Exception Stack trace"
}