0

Is there a way to programmatically tune neural network's (NN) parameters (e.g. Gridsearch in scikitlearn) or I have to tune them experimentally (changing one at a time) in Lasagne? I know there are different rules of thumb to select NN's parameters e.g.the size of hidden layer to be somewhere between the input layer size and the output layer size etc.

Also, how to perform cross-validation in Lasagne to measure NN's performance? Any link to any resource would be helpful.

Below is my Lasagne implementation of NN (Number of inputs=6, Number of outputs = 1);

X=pd.read_csv('....\Full_Data.csv')
Y = X.pop("Eeg")
X, Y = shuffle(X, Y, random_state=13)
X = X.round(2)
Y = Y.round(2)
X_min= np.min(X)
X_max = np.max(X)
Y_min = np.min(Y)
Y_max = np.max(Y)
X = (X - X_min) / (X_max - X_min)
Y = (Y - Y_min) / (Y_max - Y_min)
X_train, X_test, y_train, y_test = train_test_split(X,Y,test_size=0.3,random_state=10)
X_train = np.array(X_train)
y_train = np.array(y_train)
X_test = np.array(X_test)
y_test = np.array(y_test)
import lasagne
net1= NeuralNet(
    layers=[
        ('input',layers.InputLayer),
        ('hidden',layers.DenseLayer),
        #('hidden2',layers.DenseLayer),
        ('output',layers.DenseLayer),],
        input_shape=(None,6),
        hidden_num_units=17,
        #hidden2_num_units=100,
        output_nonlinearity=lasagne.nonlinearities.tanh,
        output_num_units = 1,
        update=nesterov_momentum,
        update_learning_rate=0.01,
        update_momentum=0.9,
        regression=True,
        max_epochs=1000,
        verbose=1,)
net1.fit(X_train, y_train)
Muhammad
  • 305
  • 2
  • 6
  • 20
  • Hi, There's really nice course for Machine Learning in Coursera - https://www.coursera.org/learn/machine-learning. It is free and it explains all the basics and much more. I believe you can find the answer to your question there. At least, when I was studying it, there were a lot of tips and tricks for tuning neural networks. – Boyan Apr 11 '16 at 12:07
  • Hi Boyan: Thanks for your reply. I am looking for answers so that this (cross-validation and parameter tuning) can be done using Lasagne (python). – Muhammad Apr 11 '16 at 12:23
  • Yes, I got this. Measurement of the performance of a NN is a general topic and it shouldn't matter what language you are using. You are right there might be something implemented in python, but if there isn't, you can see how to do it yourself from the course I recommended. – Boyan Apr 11 '16 at 12:34
  • OK, thanks. Any idea about Cross-Validation in Lasagne? – Muhammad Apr 11 '16 at 16:33

0 Answers0