rhayes777 / PyAutoFit

PyAutoFit: Classy Probabilistic Programming
https://pyautofit.readthedocs.io/
MIT License
59 stars 11 forks source link

Sensitivity result output formatting #1033

Open Jammy2211 opened 1 month ago

Jammy2211 commented 1 month ago

The sensitivity result produced by this script:

https://github.com/Jammy2211/autofit_workspace/blob/release/scripts/features/sensitivity_mapping.py

Looks like this:

index,normalization,log_evidence_increase,log_likelihood_increase
     0,25.0075,5436.927362178276,5434.422459868222

Could you make it so there is white space in the formatting so its more readable?

Note that the output of grid searches uses the method write_table:

        def write_results():
            self.logger.debug("Writing results")

            os.makedirs(self.paths.output_path, exist_ok=True)

            is_evidence = any(row[-1] is not None for row in results_list)

            headers = [
                "index",
                *map(model.name_for_prior, grid_priors),
                "log_likelihood_increase",
            ]
            rows = results_list

            if is_evidence:
                headers.append("log_evidence")
            else:
                rows = [row[:-1] for row in rows]

            write_table(
                headers,
                rows,
                self.paths.output_path / "results.csv",
            )

Which produces well formatted output, so I think we just need to update the sensitivity mapping output to use this funciton.