none
Python Script n_jobs Machine Learning Studio RRS feed

  • Question

  • I am trying to implement a GridSearchCV using a custom python script module in Azure Machine Learning Studio using more than 1 job for the "n_jobs" parameter. The "-1" parameter usually uses all available cores but I get an error saying "Permission Denied"

    C_range = [1.0, .1, .01]
    param_grid = dict(C=C_range)
    grid = GridSearchCV(LinearSVC(penalty='l2'), param_grid=param_grid, cv=2, n_jobs=-1, scoring='f1')
    grid.fit(x, y)

    Wednesday, August 21, 2019 1:43 AM

All replies

  • Hello,

    We have tried to replicate the issue by using the same method and parameters but the python module ran with no issues. Could you please let us know the exact error details displayed? The following was used in the module we ran.

    # The script MUST contain a function named azureml_main
    # which is the entry point for this module.
    
    # imports up here can be used to 
    import pandas as pd
    import sklearn as sk
    from sklearn import svm, datasets
    from sklearn.svm import LinearSVC
    
    from sklearn.grid_search import GridSearchCV
    #from sklearn.model_selection import GridSearchCV
    
    
    # The entry point function can contain up to two input arguments:
    #   Param<dataframe1>: a pandas.DataFrame
    #   Param<dataframe2>: a pandas.DataFrame
    def azureml_main(dataframe1 = None, dataframe2 = None):
    
        # Execution logic goes here
        print('Input pandas.DataFrame #1:\r\n\r\n{0}'.format(dataframe1))
    
        C_range = [1.0,.1, .01]
    
        param_grid = dict(C=C_range)
    
        grid = GridSearchCV(LinearSVC(penalty='l2'), param_grid=param_grid, cv=2, n_jobs=-1, scoring='f1')
    
        #grid.fit(x, y)
        # If a zip file is connected to the third input port is connected,
        # it is unzipped under ".\Script Bundle". This directory is added
        # to sys.path. Therefore, if your zip file contains a Python file
        # mymodule.py you can import it using:
        # import mymodule
        
        # Return value must be of a sequence of pandas.DataFrame
        return dataframe1,
    

    Anaconda 4/python 2.7.11 was used in this run.

    -Rohit

    Wednesday, August 21, 2019 11:07 AM
    Moderator