Esempio n. 1
0
               auth=svc_pr)

# ### Enable SynapseML predict
# Set the spark conf spark.synapse.ml.predict.enabled as true to enable the library.

# In[5]:

spark.conf.set("spark.synapse.ml.predict.enabled", "true")

# ### Bind Model

# In[6]:

model = pcontext.bind_model(RETURN_TYPES,
                            "mlflow",
                            "ONNX_linear_regression",
                            AML_MODEL_URI_ONNX,
                            aml_workspace=ws).register()

# ### Load Data

# In[7]:

df = spark.read.format("csv").option("header", "true").csv(DATA_FILE,
                                                           inferSchema=True)
df = df.select(df.columns[:9])
df.createOrReplaceTempView('data')
df.show(10)
df

# In[8]:
RETURN_TYPES = "INT"

# ### Enable SynapseML predict
# Set the spark conf spark.synapse.ml.predict.enabled as true to enable the library.

# In[6]:

spark.conf.set("spark.synapse.ml.predict.enabled", "true")

# ### Bind Model

# In[7]:

model = pcontext.bind_model(RETURN_TYPES,
                            "mlflow",
                            "sklearn_linear_regression",
                            AML_MODEL_URI_SKLEARN,
                            aml_workspace=ws).register()

# ### Load Data

# In[8]:

df = spark.read.format("csv").option("header", "true").csv(DATA_FILE,
                                                           inferSchema=True)
df = df.select(df.columns[:9])
df.createOrReplaceTempView('data')
df.show(10)
df

# In[9]:
# ### Enable SynapseML predict
# Set the spark conf spark.synapse.ml.predict.enabled as true to enable the library.

# In[5]:

spark.conf.set("spark.synapse.ml.predict.enabled", "true")

# ### Bind Model

# In[6]:

model = pcontext.bind_model(return_types=RETURN_TYPES,
                            runtime="mlflow",
                            model_alias="tensorflow_linear_regression",
                            model_uri=AML_MODEL_URI_TENSORFLOW,
                            meta_data={
                                'meta_graph': ['serve'],
                                'signature_def_key': 'serving_default'
                            },
                            aml_workspace=ws).register()

# ### Load Data

# In[7]:

df = spark.read.format("csv").option("header", "true").csv(DATA_FILE,
                                                           inferSchema=True)
df = df.select(df.columns[:4])
df.createOrReplaceTempView('data')
df.show(10)
df
Esempio n. 4
0
ADLS_MODEL_URI_XGBOOST = "abfss://[email protected]/predict/models/mlflow/xgboost/model_nf10/"
RETURN_TYPES = "float"

# ### Enable SynapseML predict
# Set the spark conf spark.synapse.ml.predict.enabled as true to enable the library.

# In[3]:

spark.conf.set("spark.synapse.ml.predict.enabled", "true")

# ### Bind Model

# In[4]:

model = pcontext.bind_model(return_types=RETURN_TYPES,
                            runtime="mlflow",
                            model_alias="xgboost_model",
                            model_uri=ADLS_MODEL_URI_XGBOOST).register()

# ### Load Data

# In[5]:

data = np.random.rand(5, 10)
df = spark.createDataFrame(pd.DataFrame(data))
df.createOrReplaceTempView("data")
df.show()

# ### Model Prediction using SPARK_SQL

# In[6]:
# ### Enable SynapseML predict
# Set the spark conf spark.synapse.ml.predict.enabled as true to enable the library.

# In[7]:


spark.conf.set("spark.synapse.ml.predict.enabled","true")


# ### Bind Model

# In[8]:


model = pcontext.bind_model(RETURN_TYPES, "mlflow","ONNX_linear_regression", ADLS_MODEL_URI_SKLEARN).register()


# ### Load Data

# In[9]:


df = spark.read     .format("csv")     .option("header", "true")     .csv(DATA_FILE,
        inferSchema=True)
df = df.select(df.columns[:9])
df.createOrReplaceTempView('data')
df.show(10)
df

Esempio n. 6
0
    loader_module='mlflow.spark')


# In[9]:


MODEL_URI = './sparkml_pyfunc_model_path'
RETURN_TYPES = 'float'


# In[10]:


model = pcontext.bind_model(
  return_types = RETURN_TYPES,
  runtime = 'mlflow',
  model_alias = 'sparkml_model',
  model_uri = MODEL_URI,).register()


# In[11]:


type(model)


# In[12]:


data = pd.DataFrame([(Vectors.dense(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),)], columns=["features"])
model.predict(data)
Esempio n. 7
0
ADLS_MODEL_URI_PYTORCH = "abfss://[email protected]/predict/models/mlflow/pytorch/linear_regression/"
RETURN_TYPES = "INT"

# ### Enable SynapseML predict
# Set the spark conf spark.synapse.ml.predict.enabled as true to enable the library.

# In[3]:

spark.conf.set("spark.synapse.ml.predict.enabled", "true")

# ### Bind Model

# In[4]:

model = pcontext.bind_model(RETURN_TYPES, "mlflow",
                            "pytorch_linear_regression",
                            ADLS_MODEL_URI_PYTORCH).register()

# ### Load Data

# In[5]:

df = spark.read.format("csv").option("header", "true").csv(DATA_FILE,
                                                           inferSchema=True)
df = df.select(df.columns[:9])
df.createOrReplaceTempView('data')
df.show(10)
df

# In[6]:
Esempio n. 8
0
               auth=svc_pr)

# ### Enable SynapseML predict
# Set the spark conf spark.synapse.ml.predict.enabled as true to enable the library.

# In[11]:

spark.conf.set("spark.synapse.ml.predict.enabled", "true")

# ### Bind Model

# In[12]:

model = pcontext.bind_model(RETURN_TYPES,
                            "mlflow",
                            "pytorch_linear_regression",
                            AML_MODEL_URI_PYTORCH,
                            aml_workspace=ws).register()

# ### Load Data

# In[13]:

df = spark.read.format("csv").option("header", "true").csv(DATA_FILE,
                                                           inferSchema=True)
df = df.select(df.columns[:9])
df.createOrReplaceTempView('data')
df.show(10)
df

# In[14]: