locked
Pickle.dump error when used with python 3.5 RRS feed

  • Question

  • Hi,

    I'm trying to execute this python script inside azure ml studio 

           

    def azureml_main(dataframe1 = None, dataframe2 = None):
        import numpy as np
        import pandas as pd        
        import pickle    
        from sklearn.ensemble import RandomForestClassifier        

        clf = RandomForestClassifier(n_estimators=25)
        X_train = np.array(dataframe1.ix[:,1:])
        y_train = np.array(dataframe1.ix[:,0])
        clf.fit(X_train, y_train)    
        state = pickle.dumps(clf)
        ret = pd.DataFrame(data = [state], columns=["Serialized Model"])    
        return ret,

    The script works with python 2... but when I change to Python 3.5 I have this error:

    NotImplementedError: Python Bridge conversion table not implemented for type [<class 'bytes'>]

    Friday, September 2, 2016 7:31 PM

Answers

  • Hi, could you please try converting to a base64 encoded string before emitting the model?

    Ted Way [MSFT], Program Manager, Microsoft Azure Machine Learning

    Wednesday, September 14, 2016 5:17 PM