class_docstr: A Stochastic Blockmodel fit to Label Graph
  
  This contains a stochastic block model instance constructed for a block model variant specified in parameters.
  It can be fit to an instance of a graph and set of weights. More information on how to select parameters can be
  found in `the extensive introduction into Stochastic Block Models
  <https://graph-tool.skewed.de/static/doc/demos/inference/inference.html>`_ in graphtool documentation.
  
  Parameters
  ----------
  nested: boolean
      whether to build a nested Stochastic Block Model or the regular variant,
      will be automatically put under :code:`self.nested`.
  use_degree_correlation: boolean
      whether to correct for degree correlation in modeling, will be automatically
      put under :code:`self.use_degree_correlation`.
  allow_overlap: boolean
      whether to allow overlapping clusters or not, will be automatically
      put under :code:`self.allow_overlap`.
  weight_model: string or None
      decide whether to generate a weighted or unweighted graph,
      will be automatically put under :code:`self.weight_model`.
  
  Attributes
  ----------
  model_: graph_tool.inference.BlockState or its subclass
      an instance of the fitted model obtained from graph-tool
docstr: Fits model to a given graph and weights list
  
  Sets :code:`self.model_` to the state of graphtool's Stochastic Block Model the after fitting.
  
  Attributes
  ----------
  graph: graphtool.Graph
      the graph to fit the model to
  weights: graphtool.EdgePropertyMap<double>
      the property map: edge -> weight (double) to fit the model to, if weighted variant
      is selected
  
  Returns
  -------
  numpy.ndarray
      partition of labels, each sublist contains label indices
      related to label positions in :code:`y`
docstr_tok: ["Fits","model","to","a","given","graph","and","weights","list","Sets",":","code",":","`","self.model_","`","to","the","state","of","graphtool","'s","Stochastic","Block","Model","the","after","fitting",".","Attributes","--","--","--","--","--","graph",":","graphtool.Graph","the","graph","to","fit","the","model","to","weights",":","graphtool.EdgePropertyMap","<","double",">","the","property","map",":","edge","-",">","weight","(","double",")","to","fit","the","model","to",",","if","weighted","variant","is","selected","Returns","--","--","--","-","numpy.ndarray","partition","of","labels",",","each","sublist","contains","label","indices","related","to","label","positions","in",":","code",":","`","y","`"]
code: def fit_predict(self, graph, weights):
      """Fits model to a given graph and weights list
  
      Sets :code:`self.model_` to the state of graphtool's Stochastic Block Model the after fitting.
  
      Attributes
      ----------
      graph: graphtool.Graph
          the graph to fit the model to
      weights: graphtool.EdgePropertyMap<double>
          the property map: edge -> weight (double) to fit the model to, if weighted variant
          is selected
  
      Returns
      -------
      numpy.ndarray
          partition of labels, each sublist contains label indices
          related to label positions in :code:`y`
      """
      if self.weight_model:
          self.model_ = self._model_fit_function()(
              graph,
              deg_corr=self.use_degree_correlation,
              overlap=self.allow_overlap,
              state_args=dict(
                  recs=[weights], rec_types=[self.weight_model]
              ),
          )
      else:
          self.model_ = self._model_fit_function()(
              graph,
              deg_corr=self.use_degree_correlation,
              overlap=self.allow_overlap,
          )
      return self._detect_communities()
  
file_path: scikit-multilearn/skmultilearn/cluster/graphtool.py
imports: from __future__ import absolute_import
  from __future__ import print_function
  import graph_tool.all
  import numpy
  from .base import LabelGraphClustererBase
  from .helpers import _membership_to_list_of_communities, _overlapping_membership_to_list_of_communities
label_desc: Use image node_id 2 for calling the StochasticBlockModel obj's underlying member method code with example usage: obj.fit_predict(graph, weights) and returns: self