Skip to content
Advertisement

Tensor Flow Conv1D for binary classification CNN

I’m creating a Conv1D layer in a CNN for binary classification, and I’m quite new to Machine Learning and I need some help to figure out the correct values for Conv1D:

tf.keras.layers.Conv1D(
    filters, kernel_size, strides=1, padding='valid', data_format='channels_last',
    dilation_rate=1, groups=1, activation=None, use_bias=True,
    kernel_initializer='glorot_uniform', bias_initializer='zeros',
    kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None,
    kernel_constraint=None, bias_constraint=None, **kwargs
)

I would like to know if there is a way to determine the “Right” hyper-parameters that will fit my dataset best.

Advertisement

Answer

For the completion, here is the documentation of tf.keras.layers.Conv1D that explain what each parameter is for.

There is no such flow! This is one of the issues in deep learning, there is no “magic” way of selecting the best hyper-parameters to fit your problem. Once you are more experienced you might be able to make an educational guess which will work fairly good.

A way to address it, is just setting multiple possible valid options for each of the hyper-parameter you wish to tune and iterate them efficently.

One way you can do it in keras is using the GridSearchCV here is a couple of good starting links:

https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html

https://machinelearningmastery.com/grid-search-hyperparameters-deep-learning-models-python-keras/

https://www.kaggle.com/shujunge/gridsearchcv-with-keras

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement