Skip to content

Commit e9e5474

Browse files
author
Ziqun Ye
committed
ODSC-36246: fix the import order
1 parent 3b2d2df commit e9e5474

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

docs/source/user_guide/model_registration/quick_start.rst

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ Sklearn
99
.. code-block:: python3
1010
1111
import tempfile
12+
13+
import ads
1214
from ads.model.framework.sklearn_model import SklearnModel
1315
from sklearn.datasets import load_iris
1416
from sklearn.linear_model import LogisticRegression
1517
from sklearn.model_selection import train_test_split
16-
import ads
18+
1719
1820
ads.set_auth(auth="resource_principal")
1921
@@ -53,12 +55,14 @@ Create a model, prepare it, verify that it works, save it to the model catalog,
5355
.. code-block:: python3
5456
5557
import tempfile
58+
59+
import ads
5660
import xgboost as xgb
5761
from ads.model.framework.xgboost_model import XGBoostModel
5862
from sklearn.datasets import load_iris
5963
from sklearn.datasets import make_classification
6064
from sklearn.model_selection import train_test_split
61-
import ads
65+
6266
6367
ads.set_auth(auth="resource_principal")
6468
@@ -94,13 +98,15 @@ Create a model, prepare it, verify that it works, save it to the model catalog,
9498

9599
.. code-block:: python3
96100
97-
import lightgbm as lgb
101+
98102
import tempfile
103+
104+
import ads
105+
import lightgbm as lgb
99106
from ads.model.framework.lightgbm_model import LightGBMModel
100107
from sklearn.datasets import load_iris
101108
from sklearn.model_selection import train_test_split
102-
import ads
103-
109+
104110
ads.set_auth(auth="resource_principal")
105111
106112
# Load dataset and Prepare train and test split
@@ -141,10 +147,11 @@ Create a model, prepare it, verify that it works, save it to the model catalog,
141147
142148
143149
import tempfile
150+
151+
import ads
144152
import torch
145153
import torchvision
146154
from ads.model.framework.pytorch_model import PyTorchModel
147-
import ads
148155
149156
ads.set_auth(auth="resource_principal")
150157
@@ -177,14 +184,15 @@ Create a model, prepare it, verify that it works, save it to the model catalog,
177184

178185
.. code-block:: python3
179186
180-
import tempfile
181187
import os
182-
from pyspark.sql import SparkSession
188+
import tempfile
189+
190+
import ads
191+
from ads.model.framework.spark_model import SparkPipelineModel
183192
from pyspark.ml import Pipeline
184193
from pyspark.ml.classification import LogisticRegression
185194
from pyspark.ml.feature import HashingTF, Tokenizer
186-
from ads.model.framework.spark_model import SparkPipelineModel
187-
import ads
195+
from pyspark.sql import SparkSession
188196
189197
ads.set_auth(auth="resource_principal")
190198
@@ -240,10 +248,12 @@ Create a model, prepare it, verify that it works, save it to the model catalog,
240248

241249
.. code-block:: python3
242250
243-
from ads.model.framework.tensorflow_model import TensorFlowModel
244251
import tempfile
245-
import tensorflow as tf
252+
246253
import ads
254+
import tensorflow as tf
255+
from ads.model.framework.tensorflow_model import TensorFlowModel
256+
247257
248258
ads.set_auth(auth="resource_principal")
249259
@@ -280,11 +290,12 @@ Other Frameworks
280290

281291
.. code-block:: python3
282292
293+
import tempfile
294+
295+
import ads
283296
from ads.model.generic_model import GenericModel
284297
from catboost import CatBoostRegressor
285298
286-
import tempfile
287-
import ads
288299
289300
ads.set_auth(auth="resource_principal")
290301
@@ -298,16 +309,17 @@ Other Frameworks
298309
[1, 4, 50, 60]]
299310
300311
y_train = [10, 20, 30]
312+
301313
# Initialize CatBoostRegressor
302314
catboost_estimator = CatBoostRegressor(iterations=2,
303315
learning_rate=1,
304316
depth=2)
305-
# Train a CatBoost Classifier model
317+
# Train a CatBoostRegressor model
306318
catboost_estimator.fit(X_train, y_train)
319+
307320
# Get predictions
308321
preds = catboost_estimator.predict(X_test)
309322
310-
311323
# Instantite ads.model.generic_model.GenericModel using the trained Custom Model using the trained CatBoost Classifier model
312324
catboost_model = GenericModel(estimator=catboost_estimator, artifact_dir=tempfile.mkdtemp())
313325

0 commit comments

Comments
 (0)