parameters: (self, filters, lstm_dims, learning_rate=0.01,
                       regularization_rate=0.01)
return_statement: return model
docstring: Generate a model with convolution and LSTM layers.
  
          See Ordonez et al., 2016, http://dx.doi.org/10.3390/s16010115
  
          Parameters
          ----------
          filters : list of ints
              number of filters for each convolutional layer
          lstm_dims : list of ints
              number of hidden nodes for each LSTM layer
          learning_rate : float
              learning rate
          regularization_rate : float
              regularization rate
          metrics : list
              Metrics to calculate on the validation set.
              See https://keras.io/metrics/ for possible values.
  
          Returns
          -------
          model : Keras model
              The compiled Keras model
docstring_summary: Generate a model with convolution and LSTM layers.
docstring_tokens: Generate a model with convolution and LSTM layers .
function: def create_model(self, filters, lstm_dims, learning_rate=0.01,
                       regularization_rate=0.01):
          """Generate a model with convolution and LSTM layers.
  
          See Ordonez et al., 2016, http://dx.doi.org/10.3390/s16010115
  
          Parameters
          ----------
          filters : list of ints
              number of filters for each convolutional layer
          lstm_dims : list of ints
              number of hidden nodes for each LSTM layer
          learning_rate : float
              learning rate
          regularization_rate : float
              regularization rate
          metrics : list
              Metrics to calculate on the validation set.
              See https://keras.io/metrics/ for possible values.
  
          Returns
          -------
          model : Keras model
              The compiled Keras model
          """
          dim_length = self.x_shape[1]  # number of samples in a time series
          dim_channels = self.x_shape[2]  # number of channels
          dim_output = self.number_of_classes
          weightinit = 'lecun_uniform'  # weight initialization
          model = Sequential()  # initialize model
          model.add(BatchNormalization(input_shape=(dim_length, dim_channels)))
          # reshape a 2 dimensional array per file/person/object into a
          # 3 dimensional array
          model.add(
              Reshape(target_shape=(dim_length, dim_channels, 1)))
          for filt in filters:
              # filt: number of filters used in a layer
              model.add(
                  Convolution2D(filt, kernel_size=(3, 1), padding='same',
                                kernel_regularizer=l2(regularization_rate),
                                kernel_initializer=weightinit))
              model.add(BatchNormalization())
              model.add(Activation('relu'))
          # reshape 3 dimensional array back into a 2 dimensional array,
          # but now with more dept as we have the the filters for each channel
          model.add(Reshape(target_shape=(dim_length, filters[-1] * dim_channels)))
  
          for lstm_dim in lstm_dims:
              model.add(LSTM(units=lstm_dim, return_sequences=True,
                             activation='tanh'))
  
          model.add(Dropout(0.5))  # dropout before the dense layer
          # set up final dense layer such that every timestamp is given one
          # classification
          model.add(
              TimeDistributed(
                  Dense(units=dim_output, kernel_regularizer=l2(regularization_rate))))
          model.add(Activation("softmax"))
          # Final classification layer - per timestep
          model.add(Lambda(lambda x: x[:, -1, :], output_shape=[dim_output]))
  
          model.compile(loss='categorical_crossentropy',
                        optimizer=Adam(lr=learning_rate),
                        metrics=self.metrics)
  
          return model
function_tokens: def create_model ( self , filters , lstm_dims , learning_rate = 0.01 , regularization_rate = 0.01 ) : dim_length = self . x_shape [ 1 ] # number of samples in a time series dim_channels = self . x_shape [ 2 ] # number of channels dim_output = self . number_of_classes weightinit = 'lecun_uniform' # weight initialization model = Sequential ( ) # initialize model model . add ( BatchNormalization ( input_shape = ( dim_length , dim_channels ) ) ) # reshape a 2 dimensional array per file/person/object into a # 3 dimensional array model . add ( Reshape ( target_shape = ( dim_length , dim_channels , 1 ) ) ) for filt in filters : # filt: number of filters used in a layer model . add ( Convolution2D ( filt , kernel_size = ( 3 , 1 ) , padding = 'same' , kernel_regularizer = l2 ( regularization_rate ) , kernel_initializer = weightinit ) ) model . add ( BatchNormalization ( ) ) model . add ( Activation ( 'relu' ) ) # reshape 3 dimensional array back into a 2 dimensional array, # but now with more dept as we have the the filters for each channel model . add ( Reshape ( target_shape = ( dim_length , filters [ - 1 ] * dim_channels ) ) ) for lstm_dim in lstm_dims : model . add ( LSTM ( units = lstm_dim , return_sequences = True , activation = 'tanh' ) ) model . add ( Dropout ( 0.5 ) ) # dropout before the dense layer # set up final dense layer such that every timestamp is given one # classification model . add ( TimeDistributed ( Dense ( units = dim_output , kernel_regularizer = l2 ( regularization_rate ) ) ) ) model . add ( Activation ( "softmax" ) ) # Final classification layer - per timestep model . add ( Lambda ( lambda x : x [ : , - 1 , : ] , output_shape = [ dim_output ] ) ) model . compile ( loss = 'categorical_crossentropy' , optimizer = Adam ( lr = learning_rate ) , metrics = self . metrics ) return model