class_docstr: An LSTM architecture for named entity recognition.
  Uses a character embedding layer followed by an LSTM to generate vector 
  representation from characters for each token.
  Then the character vector is concatenated with token embedding vector, 
  which is input to another LSTM  followed by a CRF layer.
docstr: Define training procedure
docstr_tok: ["Define","training","procedure"]
code: def define_training_procedure(self, parameters):
      """
      Define training procedure
      """
      self.global_step = tf.Variable(
          0, name="global_step", trainable=False
      )
  
      if parameters["optimizer"] == "adam":
          self.optimizer = tf.train.AdamOptimizer(
              parameters["learning_rate"]
          )
      elif parameters["optimizer"] == "sgd":
          self.optimizer = tf.train.GradientDescentOptimizer(
              parameters["learning_rate"]
          )
      elif parameters["optimizer"] == "adadelta":
          self.optimizer = tf.train.AdadeltaOptimizer(
              parameters["learning_rate"]
          )
      else:
          raise ValueError(
              "The lr_method parameter must be either adadelta, adam or sgd."
          )
  
      grads_and_vars = self.optimizer.compute_gradients(self.loss)
  
      if parameters["gradient_clipping_value"]:
          grads_and_vars = [
              (
                  tf.clip_by_value(
                      grad,
                      -parameters["gradient_clipping_value"],
                      parameters["gradient_clipping_value"],
                  ),
                  var,
              )
              for grad, var in grads_and_vars
          ]
  
      # By defining a global_step variable and passing it to the optimizer
      # we allow TensorFlow handle the counting of training steps for us.
      # The global step will be automatically incremented by one every time
      # you execute train_op.
      self.train_op = self.optimizer.apply_gradients(
          grads_and_vars, global_step=self.global_step
      )
  
file_path: NeuroNER/neuroner/entity_lstm.py
imports: import os
  import pickle
  import re
  import time
  import tensorflow
  from neuroner import utils
  from neuroner import utils_tf
  from neuroner import utils_nlp
label_desc: Use image node_id 2 for calling the EntityLSTM obj's underlying member method code with example usage: obj.define_training_procedure(parameters) without return types