Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend: export chain csvs #68

Merged
merged 6 commits into from
Jun 14, 2024
Merged

frontend: export chain csvs #68

merged 6 commits into from
Jun 14, 2024

Conversation

magland
Copy link
Collaborator

@magland magland commented Jun 14, 2024

New button to export Zip file of multiple csv files for the draws of individual chains.

This includes the changes of #48 enabling convenient comparison of SP ess with stansummary. (Unfortunately these still don't quite match)

@WardBrian I couldn't remember how to name these... I have it as chain_1.csv chain_2.csv etc

image

@magland magland changed the base branch from main to ess-stats June 14, 2024 11:05
@magland magland changed the title [WIP] Export chain csvs [WIP] frontend: export chain csvs Jun 14, 2024
@WardBrian
Copy link
Collaborator

I couldn't remember how to name these... I have it as chain_1.csv chain_2.csv etc

Any name is fine as long as it generally follows the _1.csv, _2.csv, ... setup. Stan uses output by default instead of chain, but I think chain is arguably clearer

@magland
Copy link
Collaborator Author

magland commented Jun 14, 2024

Okay I changed "chain-1.csv" to "chain_1.csv"

@magland magland changed the base branch from ess-stats to main June 14, 2024 21:14
@magland
Copy link
Collaborator Author

magland commented Jun 14, 2024

@WardBrian shall I merge this now that ess PR is in?

@magland magland changed the title [WIP] frontend: export chain csvs frontend: export chain csvs Jun 14, 2024
Copy link
Collaborator

@WardBrian WardBrian left a comment

Choose a reason for hiding this comment

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

A few smaller comments but then I think this can be merged yes

@@ -161,6 +161,7 @@ const computeEss = (x: number[], chainIds: number[]) => {
draws[chainIndex].push(x[i]);
}
const ess = compute_effective_sample_size(draws);
// const ess = compute_split_effective_sample_size(draws);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is from a merge gone awry or something

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

const createZipBlobForMultipleCsvs = async (csvTexts: string[], uniqueChainIds: number[]) => {
const zip = new JSZip();
// put them all in a folder called 'draws'
const folder = zip.folder('draws');
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is really a separate feature request, but it would be nice if we included samplerOpts.json in this download as well, for reference. Not necessary in V1 on this, since I think that would make it depend on some other PRs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

created new issue.

@@ -197,6 +218,29 @@ const prepareCsvText = (draws: number[][], paramNames: string[], drawChainIds: n
return [['Chain', 'Draw', ...paramNames].join(','), ...lines].join('\n')
}

const prepareMultipleCsvsText = (draws: number[][], paramNames: string[], drawChainIds: number[], uniqueChainIds: number[]) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you mind adding some comments to this function? I’m having a hard time telling the difference between the drawChainIds and the unique ones (or even what size that they would be expected to be)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added comments.

@magland magland merged commit ef33eab into main Jun 14, 2024
1 check passed
@WardBrian WardBrian deleted the export-chain-csvs branch June 15, 2024 17:14
@WardBrian WardBrian mentioned this pull request Jun 15, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants