class_docstr: Train data loader for NAML model.
  The model require a special type of data format, where each instance contains a label, impresion id, user id,
  the candidate news articles and user's clicked news article. Articles are represented by title words,
  body words, verts and subverts.
  
  Iterator will not load the whole data into memory. Instead, it loads data into memory
  per mini-batch, so that large files can be used as input data.
  
  Attributes:
      col_spliter (str): column spliter in one line.
      ID_spliter (str): ID spliter in one line.
      batch_size (int): the samples num in one batch.
      title_size (int): max word num in news title.
      his_size (int): max clicked news num in user click history.
      npratio (int): negaive and positive ratio used in negative sampling. -1 means no need of negtive sampling.
class_docstr_tok: ["Train","data","loader","for","NAML","model",".","The","model","require","a","special","type","of","data","format",",","where","each","instance","contains","a","label",",","impresion","id",",","user","id",",","the","candidate","news","articles","and","user","'s","clicked","news","article",".","Articles","are","represented","by","title","words",",","body","words",",","verts","and","subverts",".","Iterator","will","not","load","the","whole","data","into","memory",".","Instead",",","it","loads","data","into","memory","per","mini-batch",",","so","that","large","files","can","be","used","as","input","data",".","Attributes",":","col_spliter","(","str",")",":","column","spliter","in","one","line",".","ID_spliter","(","str",")",":","ID","spliter","in","one","line",".","batch_size","(","int",")",":","the","samples","num","in","one","batch",".","title_size","(","int",")",":","max","word","num","in","news","title",".","his_size","(","int",")",":","max","clicked","news","num","in","user","click","history",".","npratio","(","int",")",":","negaive","and","positive","ratio","used","in","negative","sampling",".","-1","means","no","need","of","negtive","sampling","."]
docstr: Initialize an iterator. Create necessary placeholders for the model.
  
  Args:
      hparams (object): Global hyper-parameters. Some key setttings such as head_num and head_dim are there.
      npratio (int): negaive and positive ratio used in negative sampling. -1 means no need of negtive sampling.
      col_spliter (str): column spliter in one line.
      ID_spliter (str): ID spliter in one line.
docstr_tok: ["Initialize","an","iterator",".","Create","necessary","placeholders","for","the","model",".","Args",":","hparams","(","object",")",":","Global","hyper-parameters",".","Some","key","setttings","such","as","head_num","and","head_dim","are","there",".","npratio","(","int",")",":","negaive","and","positive","ratio","used","in","negative","sampling",".","-1","means","no","need","of","negtive","sampling",".","col_spliter","(","str",")",":","column","spliter","in","one","line",".","ID_spliter","(","str",")",":","ID","spliter","in","one","line","."]
code: def __init__(
      self,
      hparams,
      npratio=-1,
      col_spliter="\t",
      ID_spliter="%",
  ):
      """Initialize an iterator. Create necessary placeholders for the model.
  
      Args:
          hparams (object): Global hyper-parameters. Some key setttings such as head_num and head_dim are there.
          npratio (int): negaive and positive ratio used in negative sampling. -1 means no need of negtive sampling.
          col_spliter (str): column spliter in one line.
          ID_spliter (str): ID spliter in one line.
      """
      self.col_spliter = col_spliter
      self.ID_spliter = ID_spliter
      self.batch_size = hparams.batch_size
      self.title_size = hparams.title_size
      self.his_size = hparams.his_size
      self.npratio = npratio
  
      self.word_dict = self.load_dict(hparams.wordDict_file)
      self.uid2index = self.load_dict(hparams.userDict_file)
  
file_path: recommenders/recommenders/models/newsrec/io/mind_iterator.py
imports: import tensorflow
  import numpy
  import pickle
  from recommenders.models.deeprec.io.iterator import BaseIterator
  from recommenders.models.newsrec.newsrec_utils import word_tokenize, newsample
label_desc: Use image node_id 1 to create a new MINDIterator object from inherited base classes: BaseIterator with example: obj = MINDIterator(hparams, npratio, col_spliter, ID_spliter)