class_docstr: Topographical Factor Analysis (TFA)
  
  Given data from one subject, factorize it as a spatial factor F and
  a weight matrix W.
  
  Parameters
  ----------
  
  max_iter : int, default: 10
      Number of iterations to run the algorithm.
  
  threshold : float, default: 1.0
     Tolerance for terminating the parameter estimation
  
  K : int, default: 50
     Number of factors to compute
  
  nlss_method : {'trf', 'dogbox', 'lm'}, default: 'trf'
     Non-Linear Least Square (NLSS) algorithm used by scipy.least_suqares to
     perform minimization. More information at
     http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.least_squares.html
  
  nlss_loss: str or callable, default: 'linear'
     Loss function used by scipy.least_squares.
     More information at
     http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.least_squares.html
  
  jac : {'2-point', '3-point', 'cs', callable}, default: '2-point'
     Method of computing the Jacobian matrix.
     More information at
     http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.least_squares.html
  
  x_scale : float or array_like or 'jac', default: 1.0
     Characteristic scale of each variable for scipy.least_suqares.
     More information at
     http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.least_squares.html
  
  tr_solver: {None, 'exact', 'lsmr'}, default: None
     Method for solving trust-region subproblems, relevant only for 'trf'
     and 'dogbox' methods.
     More information at
     http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.least_squares.html
  
  weight_method : {'rr','ols'}, default: 'rr'
     Method for estimating weight matrix W given X and F.
     'rr' means ridge regression, 'ols' means ordinary least square.
  
  upper_ratio : float, default: 1.8
     The upper bound of the ratio between factor's width
     and maximum sigma of scanner coordinates.
  
  lower_ratio : float, default: 0.02
     The lower bound of the ratio between factor's width
     and maximum sigma of scanner coordinates.
  
  max_num_voxel : int, default: 5000
     The maximum number of voxels to subsample.
  
  max_num_tr : int, default: 500
     The maximum number of TRs to subsample.
  
  seed : int, default: 100
     Seed for subsampling voxels and trs.
  
  verbose : boolean, default: False
     Verbose mode flag.
  
  
  Attributes
  ----------
  local_posterior_ : 1D array
      Local posterior on subject's centers and widths
  
  F_ : 2D array, in shape [n_voxel, K]
      Latent factors of the subject
  
  W_ : 2D array, in shape [K, n_tr]
      Weight matrix of the subject
class_docstr_tok: ["Topographical","Factor","Analysis","(","TFA",")","Given","data","from","one","subject",",","factorize","it","as","a","spatial","factor","F","and","a","weight","matrix","W.","Parameters","--","--","--","--","--","max_iter",":","int",",","default",":","10","Number","of","iterations","to","run","the","algorithm",".","threshold",":","float",",","default",":","1.0","Tolerance","for","terminating","the","parameter","estimation","K",":","int",",","default",":","50","Number","of","factors","to","compute","nlss_method",":","{","'trf","'",",","'dogbox","'",",","'lm","'","}",",","default",":","'trf'","Non-Linear","Least","Square","(","NLSS",")","algorithm","used","by","scipy.least_suqares","to","perform","minimization",".","More","information","at","http",":","\/\/docs.scipy.org\/doc\/scipy-0.17.0\/reference\/generated\/scipy.optimize.least_squares.html","nlss_loss",":","str","or","callable",",","default",":","'linear'","Loss","function","used","by","scipy.least_squares",".","More","information","at","http",":","\/\/docs.scipy.org\/doc\/scipy-0.17.0\/reference\/generated\/scipy.optimize.least_squares.html","jac",":","{","'","2-point","'",",","'","3-point","'",",","'cs","'",",","callable","}",",","default",":","'","2-point'","Method","of","computing","the","Jacobian","matrix",".","More","information","at","http",":","\/\/docs.scipy.org\/doc\/scipy-0.17.0\/reference\/generated\/scipy.optimize.least_squares.html","x_scale",":","float","or","array_like","or","'jac","'",",","default",":","1.0","Characteristic","scale","of","each","variable","for","scipy.least_suqares",".","More","information","at","http",":","\/\/docs.scipy.org\/doc\/scipy-0.17.0\/reference\/generated\/scipy.optimize.least_squares.html","tr_solver",":","{","None",",","'exact","'",",","'lsmr","'","}",",","default",":","None","Method","for","solving","trust-region","subproblems",",","relevant","only","for","'trf'","and","'dogbox","'","methods",".","More","information","at","http",":","\/\/docs.scipy.org\/doc\/scipy-0.17.0\/reference\/generated\/scipy.optimize.least_squares.html","weight_method",":","{","'rr","'",",","'ols","'","}",",","default",":","'rr'","Method","for","estimating","weight","matrix","W","given","X","and","F.","'rr","'","means","ridge","regression",",","'ols","'","means","ordinary","least","square",".","upper_ratio",":","float",",","default",":","1.8","The","upper","bound","of","the","ratio","between","factor","'s","width","and","maximum","sigma","of","scanner","coordinates",".","lower_ratio",":","float",",","default",":","0.02","The","lower","bound","of","the","ratio","between","factor","'s","width","and","maximum","sigma","of","scanner","coordinates",".","max_num_voxel",":","int",",","default",":","5000","The","maximum","number","of","voxels","to","subsample",".","max_num_tr",":","int",",","default",":","500","The","maximum","number","of","TRs","to","subsample",".","seed",":","int",",","default",":","100","Seed","for","subsampling","voxels","and","trs",".","verbose",":","boolean",",","default",":","False","Verbose","mode","flag",".","Attributes","--","--","--","--","--","local_posterior_",":","1D","array","Local","posterior","on","subject","'s","centers","and","widths","F_",":","2D","array",",","in","shape","[","n_voxel",",","K","]","Latent","factors","of","the","subject","W_",":","2D","array",",","in","shape","[","K",",","n_tr","]","Weight","matrix","of","the","subject"]
docstr: Set estimation on centers
  
  Parameters
  ----------
  estimation : 1D arrary
      Either prior or posterior estimation
  
  centers : 2D array, in shape [K, n_dim]
      Estimation on centers
code: def set_centers(self, estimation, centers):
      """Set estimation on centers
  
      Parameters
      ----------
      estimation : 1D arrary
          Either prior or posterior estimation
  
      centers : 2D array, in shape [K, n_dim]
          Estimation on centers
  
      """
      estimation[0 : self.map_offset[1]] = centers.ravel()
  
imports: from sklearn.base import BaseEstimator
  from sklearn.metrics import mean_squared_error
  from sklearn.cluster import KMeans
  from scipy.optimize import least_squares
  from scipy.optimize import linear_sum_assignment
  from scipy.spatial import distance
  from ..utils.utils import from_tri_2_sym, from_sym_2_tri
  from .None import tfa_extension
  import numpy
  import math
  import gc
  import logging
label_desc: Use image node_id 12 for calling the TFA obj's underlying member method code with example usage: obj.set_centers(estimation, centers) without return types