class_docstr: This class implements underlying routines about creating computational graph.
  
  Its required `n_features` to be set at graph building time.
  
  
  Parameters
  ----------
  order : int, default: 2
      Order of corresponding polynomial model.
      All interaction from bias and linear to order will be included.
  
  rank : int, default: 5
      Number of factors in low-rank appoximation.
      This value is shared across different orders of interaction.
  
  input_type : str, 'dense' or 'sparse', default: 'dense'
      Type of input data. Only numpy.array allowed for 'dense' and
      scipy.sparse.csr_matrix for 'sparse'. This affects construction of
      computational graph and cannot be changed during training/testing.
  
  loss_function : function: (tf.Op, tf.Op) -> tf.Op, default: None
      Loss function.
      Take 2 tf.Ops: outputs and targets and should return tf.Op of loss
      See examples: .utils.loss_mse, .utils.loss_logistic
  
  optimizer : tf.train.Optimizer, default: Adam(learning_rate=0.01)
      Optimization method used for training
  
  reg : float, default: 0
      Strength of L2 regularization
  
  use_diag : bool, default: False
      Use diagonal elements of weights matrix or not.
      In the other words, should terms like x^2 be included.
      Ofter reffered as a "Polynomial Network".
      Default value (False) corresponds to FM.
  
  reweight_reg : bool, default: False
      Use frequency of features as weights for regularization or not.
      Should be usefull for very sparse data and/or small batches
  
  init_std : float, default: 0.01
      Amplitude of random initialization
  
  seed : int or None, default: None
      Random seed used at graph creating time
  
  
  Attributes
  ----------
  graph : tf.Graph or None
      Initialized computational graph or None
  
  trainer : tf.Op
      TensorFlow operation node to perform learning on single batch
  
  n_features : int
      Number of features used in this dataset.
      Inferred during the first call of fit() method.
  
  saver : tf.Op
      tf.train.Saver instance, connected to graph
  
  summary_op : tf.Op
      tf.merge_all_summaries instance for export logging
  
  b : tf.Variable, shape: [1]
      Bias term.
  
  w : array of tf.Variable, shape: [order]
      Array of underlying representations.
      First element will have shape [n_features, 1],
      all the others -- [n_features, rank].
  
  Notes
  -----
  Parameter `rank` is shared across all orders of interactions (except bias and
  linear parts).
  tf.sparse_reorder doesn't requied since COO format is lexigraphical ordered.
  This implementation uses a generalized approach from referenced paper along
  with caching.
  
  References
  ----------
  Steffen Rendle, Factorization Machines
      http://www.csie.ntu.edu.tw/~b97053/paper/Rendle2010FM.pdf
class_docstr_tok: ["This","class","implements","underlying","routines","about","creating","computational","graph",".","Its","required","`","n_features","`","to","be","set","at","graph","building","time",".","Parameters","--","--","--","--","--","order",":","int",",","default",":","2","Order","of","corresponding","polynomial","model",".","All","interaction","from","bias","and","linear","to","order","will","be","included",".","rank",":","int",",","default",":","5","Number","of","factors","in","low-rank","appoximation",".","This","value","is","shared","across","different","orders","of","interaction",".","input_type",":","str",",","'dense","'","or","'sparse","'",",","default",":","'dense'","Type","of","input","data",".","Only","numpy.array","allowed","for","'dense","'","and","scipy.sparse.csr_matrix","for","'sparse","'",".","This","affects","construction","of","computational","graph","and","can","not","be","changed","during","training\/testing",".","loss_function",":","function",":","(","tf.Op",",","tf.Op",")","-",">","tf.Op",",","default",":","None","Loss","function",".","Take","2","tf.Ops",":","outputs","and","targets","and","should","return","tf.Op","of","loss","See","examples",":",".utils.loss_mse",",",".utils.loss_logistic","optimizer",":","tf.train.Optimizer",",","default",":","Adam","(","learning_rate=0.01",")","Optimization","method","used","for","training","reg",":","float",",","default",":","0","Strength","of","L2","regularization","use_diag",":","bool",",","default",":","False","Use","diagonal","elements","of","weights","matrix","or","not",".","In","the","other","words",",","should","terms","like","x^2","be","included",".","Ofter","reffered","as","a","``","Polynomial","Network","''",".","Default","value","(","False",")","corresponds","to","FM",".","reweight_reg",":","bool",",","default",":","False","Use","frequency","of","features","as","weights","for","regularization","or","not",".","Should","be","usefull","for","very","sparse","data","and\/or","small","batches","init_std",":","float",",","default",":","0.01","Amplitude","of","random","initialization","seed",":","int","or","None",",","default",":","None","Random","seed","used","at","graph","creating","time","Attributes","--","--","--","--","--","graph",":","tf.Graph","or","None","Initialized","computational","graph","or","None","trainer",":","tf.Op","TensorFlow","operation","node","to","perform","learning","on","single","batch","n_features",":","int","Number","of","features","used","in","this","dataset",".","Inferred","during","the","first","call","of","fit","(",")","method",".","saver",":","tf.Op","tf.train.Saver","instance",",","connected","to","graph","summary_op",":","tf.Op","tf.merge_all_summaries","instance","for","export","logging","b",":","tf.Variable",",","shape",":","[","1","]","Bias","term",".","w",":","array","of","tf.Variable",",","shape",":","[","order","]","Array","of","underlying","representations",".","First","element","will","have","shape","[","n_features",",","1","]",",","all","the","others","--","[","n_features",",","rank","]",".","Notes","--","--","-","Parameter","`","rank","`","is","shared","across","all","orders","of","interactions","(","except","bias","and","linear","parts",")",".","tf.sparse_reorder","does","n't","requied","since","COO","format","is","lexigraphical","ordered",".","This","implementation","uses","a","generalized","approach","from","referenced","paper","along","with","caching",".","References","--","--","--","--","--","Steffen","Rendle",",","Factorization","Machines","http",":","\/\/www.csie.ntu.edu.tw\/~b97053\/paper\/Rendle2010FM.pdf"]
code: def __init__(
      self,
      order=2,
      rank=2,
      input_type="dense",
      loss_function=None,
      optimizer=tf.train.Adam(learning_rate=0.01),
      reg=0,
      init_std=0.01,
      use_diag=False,
      reweight_reg=False,
      seed=None,
  ):
      self.order = order
      self.rank = rank
      self.use_diag = use_diag
      self.input_type = input_type
      self.optimizer = optimizer
      self.reg = reg
      self.reweight_reg = reweight_reg
      self.init_std = init_std
      self.seed = seed
      self.n_features = None
      self.graph = None
      self.loss_function = loss_function
  
file_path: tffm/tffm/core.py
imports: import tensorflow
  from .None import utils
  import math
label_desc: Use image node_id 1 to create a new TFFMCore object  with example: obj = TFFMCore(order, rank, input_type, loss_function, optimizer, reg, init_std, use_diag, reweight_reg, seed)