code: def _randomized_logistic(
      X,
      y,
      weights,
      mask,
      C=1.0,
      verbose=False,
      fit_intercept=True,
      tol=1e-3,
  ):
      X = X[safe_mask(X, mask)]
      y = y[mask]
      if issparse(X):
          size = len(weights)
          weight_dia = sparse.dia_matrix((1 - weights, 0), (size, size))
          X = X * weight_dia
      else:
          X *= 1 - weights
  
      C = np.atleast_1d(np.asarray(C, dtype=np.float64))
      scores = np.zeros((X.shape[1], len(C)), dtype=np.bool)
  
      for this_C, this_scores in zip(C, scores.T):
          # XXX : would be great to do it with a warm_start ...
          clf = LogisticRegression(
              C=this_C,
              tol=tol,
              penalty="l1",
              dual=False,
              fit_intercept=fit_intercept,
          )
          clf.fit(X, y)
          this_scores[:] = np.any(
              np.abs(clf.coef_) > 10 * np.finfo(np.float).eps, axis=0
          )
      return scores
  
imports: import itertools
  from abc import ABCMeta, abstractmethod
  import warnings
  import numpy
  from scipy.sparse import issparse
  from scipy import sparse
  from scipy.interpolate import interp1d
  from .base import _preprocess_data
  from ..base import BaseEstimator, TransformerMixin
  from ..externals import six
  from ..externals.joblib import Memory, Parallel, delayed
  from ..utils import as_float_array, check_random_state, check_X_y, check_array, safe_mask
  from ..utils.validation import check_is_fitted
  from .least_angle import lars_path, LassoLarsIC
  from .logistic import LogisticRegression
  from ..exceptions import ConvergenceWarning
label_desc: Use image node_id 3 for calling a global function with example usage: _randomized_logistic(X, y, weights, mask, C, verbose, fit_intercept, tol) and returns: scores