# sf.apps.similarity.feature_vector_sampling¶

feature_vector_sampling(samples, event_photon_numbers, max_count_per_mode=2)[source]

Calculates feature vector with respect to input samples.

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 by measuring the occurrence of events in the input samples.

Example usage:

>>> from strawberryfields.apps import data
>>> samples = data.Mutag0()
>>> feature_vector_sampling(samples, [2, 4, 6])
[0.19035, 0.2047, 0.1539]

Parameters
• samples (list[list[int]]) – a list of samples

• 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

Returns

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

Return type

list[float]