docs: def get_num_features(estimator):
      """ Return size of a feature vector estimator expects as an input. """
      if hasattr(estimator, 'coef_'):  # linear models
          if len(estimator.coef_.shape) == 0:
              return 1
          return estimator.coef_.shape[-1]
      elif hasattr(estimator, 'feature_importances_'):  # ensembles
          return estimator.feature_importances_.shape[-1]
      elif hasattr(estimator, 'feature_count_'):  # naive bayes
          return estimator.feature_count_.shape[-1]
      elif hasattr(estimator, 'theta_'):
          return estimator.theta_.shape[-1]
      elif hasattr(estimator, 'estimators_') and len(estimator.estimators_):
          # OvR
          return get_num_features(estimator.estimators_[0])
      else:
          raise ValueError("Can't figure out feature vector size for %s" %
                           estimator)