Skip to content

Preprocessor displaying bug #168

Description

@patrickleonardy

Bug Report

Bug: When displaying the preprocessor one gets:
AttributeError: 'PreProcessor' object has no attribute 'categorical_data_processor'

Description

This is caused due to the fact that the PreProcessor object inherits form scikit-learn's BaseEstimator.
In the BaseEstimator docstring is written:

"""Base class for all estimators in scikit-learn.

Notes
-----
All estimators should specify all the parameters that can be set
at the class level in their ``__init__`` as explicit keyword
arguments (no ``*args`` or ``**kwargs``).
"""

In your implementation we have different names in __init__ and for the class attributes.
categorical_data_processor in __init__ and _categorical_data_processor as attribute.

Steps to Reproduce

  1. Import PreProcessor
    from cobra.preprocessing import PreProcessor
  2. Create PreProcessor object
    preprocessor = PreProcessor.from_params(model_type="regression")
  3. Try to show it (in a notebook)
    preprocessor

Expected Result

I was expecting:
image

Actual Results

I actually got an AttributeError: 'PreProcessor' object has no attribute 'categorical_data_processor'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions