You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can call the ``.summary_status()`` method after a model serialization instance such as ``AutoMLModel``, ``GenericModel``, ``SklearnModel``, ``TensorFlowModel``, or ``PyTorchModel`` is created. The ``.summary_status()`` method returns a Pandas dataframe that guides you through the entire workflow. It shows which methods are available to call and which ones aren't. Plus it outlines what each method does. If extra actions are required, it also shows those actions.
1
+
You can call the ``.summary_status()`` method after a model serialization instance such as ``GenericModel``, ``SklearnModel``, ``TensorFlowModel``, or ``PyTorchModel`` is created. The ``.summary_status()`` method returns a Pandas dataframe that guides you through the entire workflow. It shows which methods are available to call and which ones aren't. Plus it outlines what each method does. If extra actions are required, it also shows those actions.
2
2
3
3
The following image displays an example summary status table created after a user initiates a model instance. The table's Step column displays a Status of Done for the initiate step. And the ``Details`` column explains what the initiate step did such as generating a ``score.py`` file. The Step column also displays the ``prepare()``, ``verify()``, ``save()``, ``deploy()``, and ``predict()`` methods for the model. The Status column displays which method is available next. After the initiate step, the ``prepare()`` method is available. The next step is to call the ``prepare()`` method.
See `API Documentation <../../../ads.model_framework.html#ads.model.framework.automl_model.AutoMLModel>`__
6
+
.. note::
7
7
8
-
Overview
9
-
========
8
+
The ``ads.model.framework.automl_model.AutoMLModel`` class is deprecated. See this :ref:link <_Oralce_AutoMlx>`` for more detailed information.
10
9
11
-
The ``ads.model.framework.automl_model.AutoMLModel`` class in ADS is designed to rapidly get your AutoML model into production. The ``.prepare()`` method creates the model artifacts needed to deploy the model without you having to configure it or write code. The ``.prepare()`` method serializes the model and generates a ``runtime.yaml`` and a ``score.py`` file that you can later customize.
10
+
To deploy an AutoMlx model, use `GenericModel <../../../ads.model.html#ads.model.generic_model.GenericModel>`__ class.
12
11
13
-
.. include:: ../_template/overview.rst
14
-
15
-
The following steps take your trained ``AutoML`` model and deploy it into production with a few lines of code.
16
-
17
-
18
-
**Creating an Oracle Labs AutoML Model**
19
-
20
-
Train a model using AutoMLx.
21
-
22
-
.. code-block:: python3
23
-
24
-
import pandas as pd
25
-
import numpy as np
26
-
import tempfile
27
-
from sklearn.metrics import roc_auc_score, confusion_matrix, make_scorer, f1_score
28
-
from sklearn.linear_model import LogisticRegression
29
-
from sklearn.compose import make_column_selector as selector
30
-
from sklearn.impute import SimpleImputer
31
-
from sklearn.preprocessing import StandardScaler, OneHotEncoder
32
-
from sklearn.compose import ColumnTransformer
33
-
from sklearn.pipeline import Pipeline
34
-
from sklearn.datasets import fetch_openml
35
-
from sklearn.model_selection import train_test_split
36
-
37
-
import ads
38
-
import automl
39
-
from automl import init
40
-
from ads.model import AutoMLModel
41
-
from ads.common.model_metadata import UseCaseType
42
-
from ads.model.framework.automl_model import AutoMLModel
Instantiate an ``AutoMLModel()`` object with an ``AutoML`` model. Each instance accepts the following parameters:
67
-
68
-
* ``artifact_dir: str``: Artifact directory to store the files needed for deployment.
69
-
* ``auth: (Dict, optional)``: Defaults to ``None``. The default authentication is set using the ``ads.set_auth`` API. To override the default, use ``ads.common.auth.api_keys()`` or ``ads.common.auth.resource_principal()`` and create the appropriate authentication signer and the ``**kwargs`` required to instantiate the ``IdentityClient`` object.
Returns data type information fetch from input_schema.json.
123
+
124
+
Parameters
125
+
----------
126
+
input_schema_path: path of input schema.
127
+
128
+
Returns
129
+
-------
130
+
data_type: data type fetch from input_schema.json.
131
+
132
+
"""
133
+
data_type = {}
134
+
if os.path.exists(input_schema_path):
135
+
schema = json.load(open(input_schema_path))
136
+
for col in schema['schema']:
137
+
data_type[col['name']] = col['dtype']
138
+
else:
139
+
print("input_schema has to be passed in in order to recover the same data type. pass `X_sample` in `ads.model.framework.automl_model.AutoMLModel.prepare` function to generate the input_schema. Otherwise, the data type might be changed after serialization/deserialization.")
logging.warning("Cannot autodetect the type of the input data. By default, convert input data to pd.DatetimeIndex and feed the model an empty pandas DataFrame with index as input data. If assumption is not correct, modify the score.py and check with .verify() before saving model with .save().")
Returns prediction given the model and data to predict
222
+
223
+
Parameters
224
+
----------
225
+
model: Model instance returned by load_model API
226
+
data: Data format as expected by the predict API of the core estimator. For eg. in case of sckit models it could be numpy array/List of list/Pandas DataFrame
227
+
input_schema_path: path of input schema.
228
+
229
+
Returns
230
+
-------
231
+
predictions: Output from scoring server
232
+
Format: {'prediction': output from model.predict method}
233
+
234
+
"""
235
+
task = model.task if hasattr(model, "task") else None
236
+
features = pre_inference(data, input_schema_path, task)
237
+
yhat = post_inference(
238
+
model.predict(features)
239
+
)
240
+
return {'prediction': yhat}
241
+
242
+
243
+
Verify score.py changes by running inference locally
0 commit comments