Skip to content

various fixes#235

Merged
PascalIversen merged 7 commits intodevelopmentfrom
various
Jun 22, 2025
Merged

various fixes#235
PascalIversen merged 7 commits intodevelopmentfrom
various

Conversation

@PascalIversen
Copy link
Collaborator

@PascalIversen PascalIversen commented Jun 19, 2025

closes #233 (final model path is created twice)
closes #231 (drug features are not copied for final model path)
closes #232 (add metainfo in load and save csv)
closes #236 (hard-coded pubchem_id, cell_line_name in visualization)
closes #237 (bugs with response_transform)

also changing run_suite test to be with response transformation

@PascalIversen PascalIversen requested a review from Copilot June 19, 2025 10:03
@github-actions github-actions bot added the bug Something isn't working label Jun 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issues with final model path handling, ensures drug features are properly copied, and adds meta information support to CSV import/export in the FeatureDataset.

  • Rename result_path to final_model_path to avoid creating the final model directory twice and update calls accordingly.
  • Introduce extract_meta_info in FeatureDataset.from_csv and update to_csv to preserve original column names or generate fallback feature names.
  • Expand tests in test_dataset.py to cover CSV meta_info extraction, saving, and fallback behavior.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/test_dataset.py Extended CSV-related tests to validate meta_info extraction, saving with/without meta_info.
drevalpy/experiment.py Renamed result_path parameter to final_model_path and ensured input data is copied.
drevalpy/datasets/dataset.py Added extract_meta_info parameter in from_csv and updated to_csv to use meta_info.

Comment on lines +849 to +851
meta_info = None
if extract_meta_info:
meta_info = {view_name: list(data_features.columns)}
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If extract_meta_info is False, meta_info remains None and to_csv will error on self.meta_info.get. Consider initializing meta_info to an empty dict instead of None.

Suggested change
meta_info = None
if extract_meta_info:
meta_info = {view_name: list(data_features.columns)}
meta_info = {}
if extract_meta_info:
meta_info[view_name] = list(data_features.columns)

Copilot uses AI. Check for mistakes.
Comment on lines +639 to +641
dataset._meta_info = {} # simulate no meta info
csv_out_no_meta = temp_dir / "saved_no_meta.csv"
dataset.to_csv(csv_out_no_meta, id_column="id", view_name=view_name)
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Accessing _meta_info directly is brittle. Use the public from_csv(..., extract_meta_info=False) API to simulate absence of meta_info instead of touching a private attribute.

Suggested change
dataset._meta_info = {} # simulate no meta info
csv_out_no_meta = temp_dir / "saved_no_meta.csv"
dataset.to_csv(csv_out_no_meta, id_column="id", view_name=view_name)
csv_out_no_meta = temp_dir / "saved_no_meta.csv"
dataset.to_csv(csv_out_no_meta, id_column="id", view_name=view_name)
dataset = FeatureDataset.from_csv(csv_out_no_meta, extract_meta_info=False)

Copilot uses AI. Check for mistakes.
PascalIversen and others added 4 commits June 19, 2025 12:06
train_final_model is no pipeline function. Added inverse transform in train_and_predict, fixed wrong response transformation in cross-study, added response_transformation+inverse transform in train_final_model
@PascalIversen PascalIversen marked this pull request as ready for review June 22, 2025 13:45
@PascalIversen PascalIversen merged commit 3e1a794 into development Jun 22, 2025
26 checks passed
@PascalIversen PascalIversen deleted the various branch June 22, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

3 participants