parameters: (symbol_data, train_iterator, valid_iterator, data_column_names, target_names)
docstring: Train cnn model
  
      Parameters
      ----------
      symbol_data: symbol
      train_iterator: DataIter
                      Train DataIter
      valid_iterator: DataIter
                      Valid DataIter
      data_column_names: list of str
                         Defaults to ('data') for a typical model used in image classification
      target_names: list of str
                    Defaults to ('softmax_label') for a typical model used in image classification
docstring_summary: Train cnn model
docstring_tokens: Train cnn model
function: def train(symbol_data, train_iterator, valid_iterator, data_column_names, target_names):
      """Train cnn model
  
      Parameters
      ----------
      symbol_data: symbol
      train_iterator: DataIter
                      Train DataIter
      valid_iterator: DataIter
                      Valid DataIter
      data_column_names: list of str
                         Defaults to ('data') for a typical model used in image classification
      target_names: list of str
                    Defaults to ('softmax_label') for a typical model used in image classification
      """
      devs = mx.cpu()  # default setting
      if args.gpus is not None:
          for i in args.gpus.split(','):
              mx.gpu(int(i))
          devs = mx.gpu()
      module = mx.mod.Module(symbol_data, data_names=data_column_names, label_names=target_names, context=devs)
      module.fit(train_data=train_iterator,
                 eval_data=valid_iterator,
                 eval_metric='acc',
                 kvstore=args.kv_store,
                 optimizer=args.optimizer,
                 optimizer_params={'learning_rate': args.lr},
                 initializer=mx.initializer.Uniform(0.1),
                 num_epoch=args.num_epochs,
                 batch_end_callback=mx.callback.Speedometer(args.batch_size, args.disp_batches),
                 epoch_end_callback=save_model())
function_tokens: def train ( symbol_data , train_iterator , valid_iterator , data_column_names , target_names ) : devs = mx . cpu ( ) # default setting if args . gpus is not None : for i in args . gpus . split ( ',' ) : mx . gpu ( int ( i ) ) devs = mx . gpu ( ) module = mx . mod . Module ( symbol_data , data_names = data_column_names , label_names = target_names , context = devs ) module . fit ( train_data = train_iterator , eval_data = valid_iterator , eval_metric = 'acc' , kvstore = args . kv_store , optimizer = args . optimizer , optimizer_params = { 'learning_rate' : args . lr } , initializer = mx . initializer . Uniform ( 0.1 ) , num_epoch = args . num_epochs , batch_end_callback = mx . callback . Speedometer ( args . batch_size , args . disp_batches ) , epoch_end_callback = save_model ( ) )