aai-institute / aai-institute/pyDVL

Refactor `lc_solve_problem`

Đang mở
#584 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
146
Fork
10
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

We should refactor `pydvl.valuation.methods._solve_least_core_problems.lc_solve_problem`

In the discussion of PR #580, @schroedk wrote:

> This function is mixing two levels of abstraction, on the one hand it is doing a lot of low level stuff to construct the conditions for the optimization problem and on the other hand, it calls other more low-level functions (solve...). This mixing of levels of abstractions makes it harder to read. Even if a user would not call this function directly, for the developers it is a more difficult task to grasp what is happening (actually the comment helps a lot and in combination with the log messages it seems to me that the related code should be encapsulated in other low-level functions with only one purpose).

Another problem is that all low level functions that are called inside `lc_solve_problem` have many similar argument (e.g. `A_eq`, `b_eq`, `A_lb`, `b_lb`). We should bundle those arguments in a simple Object. That way we can pass them around more easily and do some simple compatibility checks during initialization.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Xem hàm `lc_solve_problem` trong `pydvl/valuation/methods/_solve_least_core_problems.py`. Kiểm tra các đối số low-level như `A_eq`, `b_eq`, `A_lb`, `b_lb` và cân nhắc gom chúng vào một object đơn giản. Xác định các phần trộn lẫn các mức trừu tượng và đóng gói chúng vào các hàm low-level riêng biệt. Xem lại thảo luận PR #580 để có ngữ cảnh. Chạy các test hiện có để đảm bảo việc refactoring không làm hỏng chức năng.

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

Đánh giá

Lĩnh vực
backend-api-design
Loại issue
Tái cấu trúc
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

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.