Azure machine learning RRS feed

  • Question

  • This question is regarding azure machine learning pipeline.

    I am trying to create a step "create python model" in azure ml pipeline for time series analysis using sarima but not getting how the parameters are getting passed. Any help is really appreciated in case someone is aware of this. Thanks in advance.

    Below is the default code that comes up while using  "create python model" pipeline step.

    import pandas as pd
    from sklearn.linear_model import LogisticRegression
    class AzureMLModel:
        # The __init__ method is only invoked in module "Create Python Model",
        # and will not be invoked again in the following modules "Train Model" and "Score Model".
        # The attributes defined in the __init__ method are preserved and usable in the train and predict method.
        def __init__(self):
            # self.model must be assigned
            self.model = LogisticRegression()
            self.feature_column_names = list()
        # Train model
        #   Param<df_train>: a pandas.DataFrame
        #   Param<df_label>: a pandas.Series
        def train(self, df_train, df_label):
            # self.feature_column_names records the column names used for training.
            # It is recommended to set this attribute before training so that the
            # feature columns used in predict and train methods have the same names.
            self.feature_column_names = df_train.columns.tolist()
            self.model.fit(df_train, df_label)
        # Predict results
        #   Param<df>: a pandas.DataFrame
        #   Must return a pandas.DataFrame
        def predict(self, df):
            # The feature columns used for prediction MUST have the same names as the ones for training.
            # The name of score column ("Scored Labels" in this case) MUST be different from any other
            # columns in input data.
            return pd.DataFrame({'Scored Labels'self.model.predict(df[self.feature_column_names])})

    • Moved by litdev Thursday, September 3, 2020 6:55 AM
    Saturday, August 29, 2020 2:33 PM


All replies

  • This forum is about the Small Basic programming language.

    Try ab AZURE forum.

    Jan [ WhTurner ] The Netherlands

    Saturday, August 29, 2020 3:08 PM
  • I'd try asking for help over here.




    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    • Proposed as answer by Dave PatrickMVP Saturday, September 5, 2020 1:42 PM
    • Marked as answer by Guido Franzke Thursday, September 10, 2020 12:37 PM
    Thursday, September 3, 2020 2:53 PM