|
132 | 132 | "cell_type": "markdown", |
133 | 133 | "metadata": {}, |
134 | 134 | "source": [ |
135 | | - "###### <span style=\"color:#ff5f27;\"> 🤖 Transformation Functions </span>\n", |
| 135 | + "### <span style=\"color:#ff5f27;\"> 🤖 Transformation Functions </span>\n", |
136 | 136 | "\n", |
137 | 137 | "Transformation functions are a mathematical mapping of input data that may be stateful - requiring statistics from the partent feature view (such as number of instances of a category, or mean value of a numerical feature)\n", |
138 | 138 | "\n", |
|
438 | 438 | "}" |
439 | 439 | ] |
440 | 440 | }, |
441 | | - { |
442 | | - "cell_type": "markdown", |
443 | | - "metadata": {}, |
444 | | - "source": [ |
445 | | - "### <span style=\"color:#ff5f27;\">⚙️ Model Schema</span>\n", |
446 | | - "\n", |
447 | | - "The model needs to be set up with a [Model Schema](https://docs.hopsworks.ai/3.0/user_guides/mlops/registry/model_schema/), which describes the inputs and outputs for a model.\n", |
448 | | - "\n", |
449 | | - "A Model Schema can be automatically generated from training examples, as shown below." |
450 | | - ] |
451 | | - }, |
452 | | - { |
453 | | - "cell_type": "code", |
454 | | - "execution_count": null, |
455 | | - "metadata": {}, |
456 | | - "outputs": [], |
457 | | - "source": [ |
458 | | - "from hsml.schema import Schema\n", |
459 | | - "from hsml.model_schema import ModelSchema\n", |
460 | | - "\n", |
461 | | - "# Define the input schema using the values of X_train\n", |
462 | | - "input_schema = Schema(X_train)\n", |
463 | | - "\n", |
464 | | - "# Define the output schema using y_train\n", |
465 | | - "output_schema = Schema(y_train)\n", |
466 | | - "\n", |
467 | | - "# Create a ModelSchema object specifying the input and output schemas\n", |
468 | | - "model_schema = ModelSchema(\n", |
469 | | - " input_schema=input_schema, \n", |
470 | | - " output_schema=output_schema,\n", |
471 | | - ")\n", |
472 | | - "\n", |
473 | | - "# Convert the model schema to a dictionary for further inspection or serialization\n", |
474 | | - "model_schema.to_dict()" |
475 | | - ] |
476 | | - }, |
477 | 441 | { |
478 | 442 | "cell_type": "markdown", |
479 | 443 | "metadata": {}, |
|
511 | 475 | "mr_model = mr.tensorflow.create_model(\n", |
512 | 476 | " name=\"aml_model\", # Specify the model name\n", |
513 | 477 | " metrics=metrics, # Include model metrics\n", |
514 | | - " model_schema=model_schema, # Include model schema\n", |
515 | 478 | " description=\"Adversarial anomaly detection model.\", # Model description\n", |
516 | 479 | " input_example=[\"70408aef\"], # Input example\n", |
| 480 | + " feature_view=feature_view,\n", |
517 | 481 | ")\n", |
518 | 482 | "\n", |
519 | 483 | "# Save the registered model to the model registry\n", |
|
0 commit comments