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

random_samples are not uniform #177

Open
bdpedigo opened this issue Jan 29, 2025 · 1 comment
Open

random_samples are not uniform #177

bdpedigo opened this issue Jan 29, 2025 · 1 comment

Comments

@bdpedigo
Copy link

Trying to use the random_sample feature from client.materialize.query_table, but the result is definitely not a uniform random sample:

from caveclient import CAVEclient

client = CAVEclient("minnie65_phase3_v1")

sample_table = client.materialize.query_table(
    "synapse_target_predictions_ssa", random_sample=1000, desired_resolution=[1, 1, 1]
)
sample_table["post_pt_root_id"].value_counts()

gives

post_pt_root_id
864691135349000663    136
864691135404446702    136
864691135748978729    136
864691135992231361    136
864691136100920437    136
864691136390915199    136
864691136619155853    136
Name: count, dtype: int64
@bdpedigo
Copy link
Author

bdpedigo commented Jan 29, 2025

@fcollman suggested merge_reference=False to see if this had to do with joins, that at least did not fix

from caveclient import CAVEclient

client = CAVEclient("minnie65_phase3_v1")

sample_table = client.materialize.query_table(
    "synapse_target_predictions_ssa",
    random_sample=1000,
    desired_resolution=[1, 1, 1],
    merge_reference=False,
).set_index("target_id")

full_table = client.materialize.query_table(
    "synapses_pni_2", filter_in_dict={"id": sample_table.index}
).set_index("id")

sample_table = sample_table.join(full_table, rsuffix="_right")
sample_table["post_pt_root_id"].value_counts()

gives

post_pt_root_id
864691135335308777    136
864691135355257807    136
864691135404851182    136
864691135463896894    136
864691135539391090    136
Name: count, dtype: int64

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

No branches or pull requests

1 participant