class_docstr: Binary Relevance multi-label classifier based on k-Nearest Neighbors method.
  
  This version of the classifier assigns the labels that are assigned
  to at least half of the neighbors.
  
  Parameters
  ----------
  k : int
      number of neighbours
  
  
  Attributes
  ----------
  knn_ : an instance of sklearn.NearestNeighbors
      the nearest neighbors single-label classifier used underneath
  neighbors_ : array of arrays of int, shape = (n_samples, k)
      k neighbors of each sample
  
  confidences_ : matrix of int, shape = (n_samples, n_labels)
      label assignment confidences
  
  
  References
  ----------
  
  If you use this method please cite the relevant paper:
  
  .. code :: bibtex
  
       @inproceedings{EleftheriosSpyromitros2008,
          author = {Eleftherios Spyromitros, Grigorios Tsoumakas, Ioannis Vlahavas},
          booktitle = {Proc. 5th Hellenic Conference on Artificial Intelligence (SETN 2008)},
          title = {An Empirical Study of Lazy Multilabel Classification Algorithms},
          year = {2008},
          location = {Syros, Greece}
       }
  
  Examples
  --------
  
  Here's a very simple example of using BRkNNaClassifier with a fixed number of neighbors:
  
  .. code :: python
  
      from skmultilearn.adapt import BRkNNaClassifier
  
      classifier = BRkNNaClassifier(k=3)
  
      # train
      classifier.fit(X_train, y_train)
  
      # predict
      predictions = classifier.predict(X_test)
  
  
  You can also use :class:`~sklearn.model_selection.GridSearchCV` to find an optimal set of parameters:
  
  .. code :: python
  
      from skmultilearn.adapt import BRkNNaClassifier
      from sklearn.model_selection import GridSearchCV
  
      parameters = {'k': range(1,3)}
      score = 'f1_macro'
  
      clf = GridSearchCV(BRkNNaClassifier(), parameters, scoring=score)
      clf.fit(X, y)
class_docstr_tok: ["Binary","Relevance","multi-label","classifier","based","on","k-Nearest","Neighbors","method",".","This","version","of","the","classifier","assigns","the","labels","that","are","assigned","to","at","least","half","of","the","neighbors",".","Parameters","--","--","--","--","--","k",":","int","number","of","neighbours","Attributes","--","--","--","--","--","knn_",":","an","instance","of","sklearn.NearestNeighbors","the","nearest","neighbors","single-label","classifier","used","underneath","neighbors_",":","array","of","arrays","of","int",",","shape","=","(","n_samples",",","k",")","k","neighbors","of","each","sample","confidences_",":","matrix","of","int",",","shape","=","(","n_samples",",","n_labels",")","label","assignment","confidences","References","--","--","--","--","--","If","you","use","this","method","please","cite","the","relevant","paper",":","..","code",":",":","bibtex","@","inproceedings","{","EleftheriosSpyromitros2008",",","author","=","{","Eleftherios","Spyromitros",",","Grigorios","Tsoumakas",",","Ioannis","Vlahavas","}",",","booktitle","=","{","Proc",".","5th","Hellenic","Conference","on","Artificial","Intelligence","(","SETN","2008",")","}",",","title","=","{","An","Empirical","Study","of","Lazy","Multilabel","Classification","Algorithms","}",",","year","=","{","2008","}",",","location","=","{","Syros",",","Greece","}","}","Examples","--","--","--","--","Here","'s","a","very","simple","example","of","using","BRkNNaClassifier","with","a","fixed","number","of","neighbors",":","..","code",":",":","python","from","skmultilearn.adapt","import","BRkNNaClassifier","classifier","=","BRkNNaClassifier","(","k=3",")","#","train","classifier.fit","(","X_train",",","y_train",")","#","predict","predictions","=","classifier.predict","(","X_test",")","You","can","also","use",":","class",":","`","~sklearn.model_selection.GridSearchCV","`","to","find","an","optimal","set","of","parameters",":","..","code",":",":","python","from","skmultilearn.adapt","import","BRkNNaClassifier","from","sklearn.model_selection","import","GridSearchCV","parameters","=","{","'","k","'",":","range","(","1,3",")","}","score","=","'f1_macro'","clf","=","GridSearchCV","(","BRkNNaClassifier","(",")",",","parameters",",","scoring=score",")","clf.fit","(","X",",","y",")"]
code: def _predict_variant(self, X):
      # TODO: find out if moving the sparsity to compute confidences_ boots speed
      return sparse.csr_matrix(np.rint(self.confidences_), dtype="i8")
  
file_path: scikit-multilearn/skmultilearn/adapt/brknn.py
imports: from builtins import range
  from ..base import MLClassifierBase
  from ..utils import get_matrix_in_format
  from sklearn.neighbors import NearestNeighbors
  import scipy.sparse
  import numpy
label_desc: Use image node_id 1 for calling the BRkNNaClassifier obj's underlying member method code with example usage: obj._predict_variant(X) and returns: sparse