Skip to content

BUG HTML Display not showing output features for CountVectorizer #33772

Closed

Description

@DeaMariaLeon

Describe the bug and give evidence about its user-facing impact

CountVectorizer doesn't show number of output features:

Image

Steps/Code to Reproduce

from sklearn.feature_extraction.text import CountVectorizer
corpus = [
    'This is the first document.',
    'This document is the second document.',
    'And this is the third one.',
    'Is this the first document?',
]
vectorizer = CountVectorizer()
vectorizer.fit_transform(corpus)
vectorizer

Expected Results

It should show "9 features"

Image

Actual Results

Image

Versions

System:
    python: 3.13.9 | packaged by conda-forge | (main, Oct 22 2025, 23:38:18) [Clang 19.1.7 ]
executable: /Users/dealeon/mambaforge/envs/sklearn-dev/bin/python
   machine: macOS-26.3.1-arm64-arm-64bit-Mach-O

Python dependencies:
      sklearn: 1.9.dev0
          pip: 25.3
   setuptools: 80.9.0
        numpy: 2.3.4
        scipy: 1.16.3
       Cython: 3.2.0
       pandas: 2.3.3
   matplotlib: 3.10.7
       joblib: 1.5.2
threadpoolctl: 3.6.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: /Users/dealeon/mambaforge/envs/sklearn-dev/lib/libopenblas.0.dylib
        version: 0.3.30
threading_layer: openmp
   architecture: VORTEX

       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: libomp
       filepath: /Users/dealeon/mambaforge/envs/sklearn-dev/lib/libomp.dylib
        version: None

Interest in fixing the bug

We are checking for "n_features_in_" in estimator.py, but CountVectorizer doesn't have it.

I'll work on this.

Activity

  1. added
    Needs Triage
    on Apr 16, 2026
  2. removed
    Needs Triage
    on Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions