ensure that all attributes with trailing underscore in fit are leared after the entire logic has succeded

Đang mở
#586 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python, scikit-learn
Lĩnh vực
machine-learning

Hướng nghiên cứu

Start with the test_encoders test the issue quotes, which shows the non-fitted-error pattern, and copy it for each unchecked module (encoding, outliers, scaling, datetime, text, selection, time series, preproc, wrappers). In each module's fit() method, move every assignment of a trailing-underscore attribute to after the last step that can raise. Done means the new parametrized test passes for every module and the existing tests still pass. Related PR #917 is referenced but not linked, so check it before starting.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

All attributes with trailing underscore must be set up at the end of the fit() functionality, when we are sure that all fit logic worked. At the moment, it is not like that for all transformers.

Add a test like the one in test_encoders:

@pytest.mark.parametrize("estimator", _estimators)
def test_raises_non_fitted_error_when_error_during_fit(estimator):
    X, y = test_df(categorical=True)
    X.loc[len(X) - 1] = nan
    transformer = clone(estimator)

    with pytest.raises(ValueError):
        transformer.fit(X, y)

    # Test when fit is not called prior to transform.
    with pytest.raises(NotFittedError):
        transformer.transform(X)

Modules encoding and preprocessing already have this functionality.

Modules to update:

  • imputation
  • encoding
  • discretisation
  • outliers
  • transformation
  • scaling
  • creation
  • datetime
  • text
  • selection
  • time series
  • preproc
  • wrappers

Related PRs:

  • #917
Ngôn ngữ chính
Python
Star
2.3k
Fork
391
Merge trung bình
11 giờ 34 phút
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của feature-engine/feature_engine

Tất cả issue của feature-engine/feature_engine

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.