Train multiple neural networks in one Analysis?

Thomas_K
Thomas_K Registered Posts: 15 ✭✭✭✭

The title basically says it all. I want to try different hyperparameters for my Neural Network (or algorithms in general). For some, like random forest, I can specify a list - e.g., max_depth. What I need is a queue of Neural Networks with different hyperparameters, so that I can start them in the evening and come back to the results in the morning.

How to do this?

Best Answer

  • Alex_Combessie
    Alex_Combessie Alpha Tester, Dataiker Alumni Posts: 539 ✭✭✭✭✭✭✭✭✭
    edited July 2024 Answer ✓

    Hello,

    It is not possible at the moment on the visual interface.

    Instead, for hyperparameter optimization on neural networks, we invite you to code your own custom Python model (in the Analysis > Design > Algorithms section). For instance, for a neural network from scikit-learn (MLP), you can use this:


     

    from sklearn.neural_network import MLPClassifier
    from sklearn.model_selection import GridSearchCV

    parameters={
    'alpha': [1,10,0.1],
    'activation': ["logistic", "relu"]
    }

    mlp = MLPClassifier()

    clf = GridSearchCV(
    estimator=mlp,
    param_grid=parameters,
    n_jobs=-1,
    verbose=2,
    cv=5
    )

    Note that we are looking to integrate neural networks more deeply ;) into our product. We will keep you posted!

    Cheers,

    Alex

Answers

  • Thomas_K
    Thomas_K Registered Posts: 15 ✭✭✭✭
    Thanks! I will try the custom version as soon as the current NN classifier is finished.
  • Thomas_K
    Thomas_K Registered Posts: 15 ✭✭✭✭
    Unfortunately, I get the following error:
    NameError: name 'gridSearchCV' is not defined
    --> Fixed by using GridSearchCV instead.

    After fixing this, I now get:
    get_params() must be called with MLPClassifier instance as first argument.
    and I'm not really sure what to do about that.
  • Alex_Combessie
    Alex_Combessie Alpha Tester, Dataiker Alumni Posts: 539 ✭✭✭✭✭✭✭✭✭
    Yes, you first need to declare an instance of MLPClassifier: `mlp=MLPClassifier()` before it can be passed to GridSearchCV.
Setup Info
    Tags
      Help me…