简体   繁体   中英

azure ml experiment return different results than webservice

same input is used in two cases, but different result is returned from python module

here is the python script that return the result to the webservice:

import pandas as pd
import sys


  def get_segments(dataframe):
     dataframe['segment']=dataframe['segment'].astype('str')
     segments = dataframe.loc[~dataframe['segment'].duplicated()]['segment']
     return segments


  def azureml_main(dataframe1 = None, dataframe2 = None):

   df = dataframe1
   segments = get_segments(df)
   segmentCount =segments.size

   if (segmentCount > 0) :
      res = pd.DataFrame(columns=['segmentId','recommendation'],index=[range(segmentCount)])
    i=0    
    for seg in segments:
        d= df.query('segment ==["{}"]'.format(seg)).sort(['count'],ascending=[0])

        res['segmentId'][i]=seg
        recommendation='['
        for index, x in d.iterrows():
            item=str(x['ItemId'])
            recommendation = recommendation + item + ','
        recommendation = recommendation[:-1] + ']'
        res['recommendation'][i]= recommendation
        i=i+1
   else:

      res = pd.DataFrame(columns=[seg,pdver],index=[range(segmentCount)])

return res,

when in experiment it returnd the actual itemIds, when in webservice it returns some numbers

the purpose of this code is to pivot some table by segment column for recommendation

After discussion with the product team from Microsoft. the issue was resolved. the product team rolled out an update to the web service first, and only later to the ML-Studio, which fixed an issue with categorical attributes in "Execute python script". the issue was in a earlier stage of the flow and has nothing to do with the python code above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM