fix: downgrade sientia_do version and update CSV saving logic
- Downgraded `sientia_do` version to 1.11.0 in `requirements.txt` to address compatibility issues. - Updated `data_manager_repository.py` to save training and test data CSVs using float-cast versions of the data, ensuring consistency in the saved outputs. - Enhanced test coverage in `test_data_manager_repository.py` to verify the presence of the target alias in the generated CSV files.
This commit is contained in:
@@ -597,13 +597,14 @@ class DataManagerRepository(SientiaMonitoring):
|
||||
data.report_path = path.join(data.run_dir, 'report.html')
|
||||
report.save_all_sections_html(data.report_path)
|
||||
|
||||
# Save training data CSV
|
||||
# Save training / validation CSVs using the same frames as the report (includes
|
||||
# literal `target` alias for Evidently, plus predictions and float-cast features).
|
||||
data.train_data_path = path.join(data.run_dir, 'train_data.csv')
|
||||
reference_data.to_csv(data.train_data_path, index=False)
|
||||
reference_data_float.to_csv(data.train_data_path, index=False)
|
||||
|
||||
# Save test data CSV
|
||||
data.test_data_path = path.join(data.run_dir, 'test_data.csv')
|
||||
current_data.to_csv(data.test_data_path, index=False)
|
||||
current_data_float.to_csv(data.test_data_path, index=False)
|
||||
|
||||
# Save equation as JSON
|
||||
if data.equation is not None and data.params.model_type == 'linear_regression':
|
||||
|
||||
@@ -3,7 +3,7 @@ psycopg2-binary==2.9.11
|
||||
sqlalchemy==2.0.49
|
||||
boto3==1.42.70
|
||||
botocore==1.42.70
|
||||
sientia_do==1.12.0
|
||||
sientia_do==1.11.0
|
||||
sientia_model==0.8.1
|
||||
prometheus-client==0.23.1
|
||||
beautifulsoup4==4.12.3
|
||||
|
||||
@@ -494,7 +494,7 @@ def test_generate_report_adds_target_alias_for_reports(tmp_path):
|
||||
):
|
||||
instance = mrep.return_value
|
||||
instance.save_all_sections_html = Mock()
|
||||
repo.generate_report(tmr, {})
|
||||
out = repo.generate_report(tmr, {})
|
||||
|
||||
kwargs = mrep.call_args.kwargs
|
||||
reference_data = kwargs['reference_data']
|
||||
@@ -504,6 +504,15 @@ def test_generate_report_adds_target_alias_for_reports(tmp_path):
|
||||
assert reference_data['target'].equals(reference_data['t'])
|
||||
assert current_data['target'].equals(current_data['t'])
|
||||
|
||||
assert out.train_data_path is not None
|
||||
assert out.test_data_path is not None
|
||||
train_csv = pd.read_csv(out.train_data_path)
|
||||
test_csv = pd.read_csv(out.test_data_path)
|
||||
assert 'target' in train_csv.columns
|
||||
assert 'target' in test_csv.columns
|
||||
assert train_csv['target'].equals(train_csv['t'])
|
||||
assert test_csv['target'].equals(test_csv['t'])
|
||||
|
||||
|
||||
def test_generate_report_skips_equation_file_when_not_linear(tmp_path):
|
||||
repo = dmr.DataManagerRepository(MagicMock())
|
||||
|
||||
Reference in New Issue
Block a user