# Choosing number of photons in the GBS sampling

**URL:** <https://discuss.pennylane.ai/t/choosing-number-of-photons-in-the-gbs-sampling/860>\
**Category:** Strawberry Fields\
**Created:** [February 19, 2021, 4:04pm UTC](https://discuss.pennylane.ai/t/choosing-number-of-photons-in-the-gbs-sampling/860 "2021-02-19T16:04:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@andrew](https://discuss.pennylane.ai/u/andrew)\
**Post date:** [February 19, 2021, 4:04pm UTC](https://discuss.pennylane.ai/t/choosing-number-of-photons-in-the-gbs-sampling/860/1 "2021-02-19T16:04:40Z")

</div>

Hello, I’m using SF’s GBS sampling function to sample a series of small graphs I have and then using sf.apps.similarity.feature\_vector\_events\_sampling to create vectors from the samples.

On page five of “Measuring the similarity of graphs with a Gaussian Boson Sampler” [https://arxiv.org/pdf/1905.12646.pdf](https://arxiv.org/pdf/1905.12646.pdf) there is a guide on choosing the number of samples you want to find. This is going to hugely affect runtime.

It says the sample number is not affected by the size of graphs, just your choice of k. Is there any guidance on choosing k though? Is there a good rule-of-thumb to have in this scenario?

---

<div class="post-metadata">

**Author:** ![Maria\_Schuld](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/maria_schuld/32/166_2.png) [@Maria\_Schuld](https://discuss.pennylane.ai/u/Maria_Schuld)\
**Post date:** [February 19, 2021, 4:59pm UTC](https://discuss.pennylane.ai/t/choosing-number-of-photons-in-the-gbs-sampling/860/2 "2021-02-19T16:59:39Z")

</div>

Hey @andrew,

Unfortunately, as with any hyperparameter this is very problem dependent. But one can get inspiration from classical graph kernels like graphlet sampling kernels, where k is between 3 and 5. I remember that the dependency on k was actually not that large in the end, small values were good enough…

---

<div class="post-metadata">

**Author:** ![andrew](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@andrew](https://discuss.pennylane.ai/u/andrew)\
**Post date:** [February 19, 2021, 5:25pm UTC](https://discuss.pennylane.ai/t/choosing-number-of-photons-in-the-gbs-sampling/860/3 "2021-02-19T17:25:00Z")

</div>

thanks @Maria_Schuld for the response. I’ll try out using the sampler with n\_mean=3,4,5,etc and the corresponding sample number and see how it runs
