sf.apps.similarity.feature_vector_mc

feature_vector_mc(graph, event_photon_numbers, max_count_per_mode=2, n_mean=5, samples=1000, loss=0.0)[source]

Calculates feature vector using Monte Carlo estimation of event probabilities according to the input graph.

The feature vector is composed of event probabilities with a fixed maximum photon count in each mode but a range of total photon numbers specified by event_photon_numbers.

Probabilities are reconstructed using Monte Carlo estimation.

Example usage:

>>> graph = nx.complete_graph(8)
>>> feature_vector_mc(graph, [2, 4, 6], 2)
[0.2115, 0.1457, 0.09085]
Parameters
  • graph (nx.Graph) – input graph

  • event_photon_numbers (list[int]) – a list of events described by their total photon number

  • max_count_per_mode (int) – maximum number of photons per mode for all events

  • n_mean (float) – total mean photon number of the GBS device

  • samples (int) – number of samples used in the Monte Carlo estimation

  • loss (float) – fraction of photons lost in GBS

Returns

a feature vector of event probabilities in the same order as event_photon_numbers

Return type

list[float]