{'fraction_non_alphanumeric': 0.033858580031009985, 'fraction_numerical': 0.008617892041971659, 'mean_word_length': 4.631269035532995, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Characterizing Entanglement Sources

We discuss how to characterize entanglement sources with finite sets of measurements. The measurements do not have to be tomographically complete, and may consist of POVMs rather than von Neumann measurements. Our method yields a probability that the source generates an entangled state as well as estimates of any desired calculable entanglement measures, including their error bars. We apply two criteria, namely Akaike's information criterion and the Bayesian information criterion, to compare and assess different models (with different numbers of parameters) describing entanglement-generating devices. We discuss differences between standard entanglement-verificaton methods and our present method of characterizing an entanglement source.


I. INTRODUCTION
Entanglement is useful, but hard to generate, and even harder to detect. The most measurement-intense approach to the problem of experimentally detecting the presence of entanglement is to perform complete quantum-state tomography [1]. Even for just two qubits this implies a reconstruction of all 15 independent elements of the corresponding density matrix. Subsequently applying the positive partial transpose (PPT) criterion to the reconstructed matrix gives a conclusive answer about entanglement or separability of the state [2,3].
From the practical point of view it is desirable to have an entanglement detection tool that is more economical than full state tomography but nevertheless is decisive. Already in the original work on PPT [2] it was noticed that one can always construct an observable W with non-negative expectation values for all separable states ρ s and a negative expectation value for at least one entangled state ρ e . In this way an experimentally detected violation of the inequality W ≥ 0 is a sufficient condition for entanglement. The observable W is called an entanglement witness (EW). There always exists an optimal choice of local orthogonal observables such that a given EW can be expressed as a sum of their direct products [4], so that a witness can always be measured locally. The advantage of using EWs for entanglement detection will be appreciated better for multi-partite systems with more than two qubits, because the number of tomographic measurements would grow exponentially with the number of qubits. On the other hand, a given witness does not detect all entangled states and therefore a variety of different EWs should be tested in order to rule out false negative results.
EWs assume the validity of quantum mechanics, and also assume one knows what measurements one is actually performing. A valuable alternative to EW can be sought in using a violation of Bell-CHSH inequalities [5,6] as a sufficient condition for entanglement (although a Bell-inequality test can be formulated as a witness, too [7]). Because Bell inequalities are derived from classical probability theory without any reference to quantum mechanics, no assumption about what is being measured is necessary. This method is, therefore, safe in the sense of avoiding many pitfalls arising from unwarranted (hidden) assumptions about one's experiment [8].
Here we propose a different method for characterizing an entanglement source that automatically takes into account finite data as well as imperfect measurements. Our method consist of two parts. The first part, "Bayesian updating," produces an estimate of the relative probabilities that entangled and separable states are consistent with a given finite set of data. This estimate depends on what a priori probability distribution (the prior) one chooses over all possible states (the more data one has, the less it depends on the prior). That is, there is an a priori probability of entanglement, and each single measurement updates this probability to an a posteriori probability of entanglement. The latter then has to be compared to the former, in order to reach the conclusion that one is now either more certain or less certain about having produced an entangled state. In fact, every experiment can only make such probabilistic statements about entanglement, although this is almost never explicitly stated in these terms. Thus our method differs from those in Refs [9,10,11] which assume expectation values of EWs are known [corresponding effectively to an infinite data set] and try to find the minimally-entangled state consistent with those expectation values. We use a numerical Bayesian updating method for a probability distribution over density matrices, which is similar to that recently discussed in Ref. [12] in the context of quantum-state tomography. In particular, whereas the reconstruction of a density matrix from experimental data is usually based on the maximum likelihood estimation (MLE), Ref. [12] discusses its drawbacks and proposes Bayesian updating in its stead as a superior method. Our aim, though, is not to give an estimate of the density matrix, but of entanglement. In fact, any quantity that can be calculated from a density matrix, such as the purity of one's state, can be estimated this way.
The second part of our method introduces two information criteria [13] to judge how different models of a given entanglement generation process can be compared to each other quantitatively. It is probably best to explain this part by giving an example. For simplicity, we consider the case of two-qubit states. Suppose an experimentalist has a model for her entanglement generating source that contains, say, two parameters describing two physically different sources of noise in the fi-nal two-qubit state produced. She may try to fit her data to her two-parameter model, but obviously there are always states in the full 15-dimensional set of all physical states that will fit the data better. There are a number of criteria, standard in the literature on statistical models, that compare quantitatively how different models fit the data. Here we will use Akaike's Information Criterion (AIC) and the Bayesian Information Criterion (BIC) [13]. These information criteria aim to find the most informative model, not the best-fitting model. The idea is that a two-parameter model fitting the data almost as well as the full quantum-mechanical description would provide more physical insight and a more economical (think Occam's razor) and transparent description. Each of the two information criteria, AIC and BIC, produces a number Ω. One term in Ω is the logarithm of the maximum likelihood possible within each model, and the second term subtracts a penalty for each parameter used in the model. The model with the larger value of Ω is then deemed to be the more informative. We propose here to combine information criteria with the Bayesian updating methods for entanglement estimation. Namely, we propose to use the more informative model to generate a "substitute prior." In the case that the simpler model is the more informative, the numerical efforts required for our Bayesian updating method are much smaller, and yet should lead to correct descriptions of the entanglement generated by one's source. This paper is organized as follows. In Section II we give a general formulation of our method of Bayesian updating applicable to any quantum system. We also formulate precisely the two information criteria for model selection. In Section III we discuss numerical examples, which illustrate the Bayesian methods and the information criteria. For concreteness we consider measurements of Bell-CHSH correlations (although any sort of measurements would do). The examples show that our method detects entangled two-qubit states that escape detection by any of the Bell-CHSH inequalities and even by violations of the stronger version of these bounds, which we call Roy-Uffink-Seevinck bounds [14,15,16]. In the Discussion and Conclusions Section we discuss the essential difference between our method of characterizing an entanglement source and the standard methods of entanglement verification [8,17].

II. QUANTIFYING ENTANGLEMENT VIA BAYESIAN UPDATING
Here we present a numerical Bayesian updating method for one's probability distribution over density matrices. A related Bayesian method was recently advocated in Ref. [12] in the context of quantum-state tomography and quantum-state estimation. We note our aim is not to give an estimate of the density matrix, but, more modestly, to give estimates of entanglement, purity, and in principle any quantity that can be efficiently calculated from the density matrix. We first discuss the method in general, and subsequently we propose a new method to choose a prior probability distribution over density matrices.

A. Method
The method itself can be formulated as a five-step procedure: 1. For a system of M qubits we first choose a finite test set of density matrices. We calculate the amount of entanglement (in fact, the negativity) for each state in the set [23]. The a priori probability that our unknown experimentally generated state, which we denote by ρ ? , equals a state ρ in the set is chosen as p prior (ρ) = 1/N s , where N s is the number of states in the set.
2. We assume some set of POVMs with elements {Π i } is measured. These POVMs can describe any (noisy) set of measurements one performs on the qubits.
3. For the acquired measurement record d = {d 1 , · · · , d i } consisting of the number of times outcome i was obtained [24], we calculate the quantum-mechanical probability p(d|ρ) that a given state ρ from the test set generates the measurements outcome d (which follows directly from TrρΠ i ). Having at hand probabilities p(d|ρ) for all states ρ in the test set we are now able to calculate the a priori probability p(d) = ρ p(d|ρ)/N s for the measurement record d to occur.
4. We calculate -using Bayes' rule -the probability p(ρ|d) of having the state ρ given the measurement outcomes d: 5. We obtain the posterior probability distribution over density matrices in our test set: p posterior (ρ) := p(ρ|d) for all states ρ.
We can then repeat steps 2-5 for a new set of measurements d, if needed. This procedure gives us, in step 5, a numerical estimate of the a posteriori probability that the unknown state ρ ? equals the state ρ from the test set. From p(ρ|d) we can estimate the probability p e for the state ρ ? to be entangled. We just sum the probabilities p(ρ|d) for all entangled states ρ ent in the set i.e.
Furthermore, we can calculate probability distributions for any function of the density matrix, such as the negativity and purity. We thus infer expectation values such as and as well as standard deviations σ N = N 2 −N 2 etc.
The meaning of our final probability distribution p(ρ|d) and of the above expectation values is as follows. If we were forced to give a single density matrix that best describes all data and that includes error bars, we would give the mixed stateρ = dρp(ρ|d)(ρ)ρ, as explained in [12]. The purity and negativity of the stateρ are not equal to (in fact, smaller than) the estimatesN andP that we use here. The difference is this: if one were to perform more measurements that are tomographically complete,N is the expected negativity of the final estimated density matrix. N (ρ), on the other hand, would be the useful entanglement of a single copy available without performing more measurements. For most quantum information processing purposes (such as teleportation) one indeed needs more precise knowledge about the density matrix than just its entanglement. See Ref. [8] for more discussions on this issue.

B. Model testing and information criteria
The only problem standing in the way of a straightforward application of the above Bayesian updating procedure is that a sufficiently dense test set (used in step 1) is in general too hard to handle numerically, since even for two-qubit density matrices the parameter space is 15-dimensional. Although there are certainly ways out of this problem (in particular, sampling directly from the posterior probability distribution can be efficiently done with the Metropolis-Hastings algorithm, see e.g. [18]), here we stick to the idea of a set of test states by simplifying that set, as follows.
As an illustrative example (which we will again consider in great detail in the next Section), consider an experimentalist trying to produce a maximally entangled Bell state of 2 qubits, say, (|00 + |11 )/ √ 2. She wants to test her entanglementgenerating device by measuring some set of Bell correlations. In particular, suppose she measures 2 < K < 15 independent observables.
From her previous experience with the same device, she models the generation process by assuming there is both Gaussian phase noise and white noise (mixing with the maximally mixed state ∝ 1 1). That is, she assumes her device generates states of the form with p ∈ [0, 1] and with the normalization factor N σ given by So there are just two parameters the experimentalist has to determine from her measurement results, p and σ.
As a measure to judge how well her data d fit the model (4)-(6), she considers the best likelihood for that model, She would like to compare this to the maximum likelihood over all physical two-qubit states ρ, There are several ways to compare these two quantities [13]. One criterion is called Akaike's Information Criterion, and it defines the quantity for each model, where k is the number of parameters in the model, and L is the maximum likelihood for the model. The quantity Ω rewards a high value of the best likelihood (indicating a good fit), but penalizes a large number of parameters (to guard against overfitting). Now when measuring 2 < K < 15 observables, the best complete model contains just K, not 15, independent parameters. Thus the experimentalist would calculate two numbers If Ω p,σ > Ω a then the Akaike Information Criterion judges the simple 2-parameter model to be more informative than the complete K-parameter model. There is a Bayesian version of this criterion [13], and it is defined in terms of similar quantities where L and k have the same meaning as before, and N m is the number of data taken. Again, if Ω ′ p,σ > Ω ′ m , the 2parameter model is considered more informative than the Kparameter description. For N s > 8 the BIC puts a larger penalty on the number of parameters than does the AIC.
In the case that the simple model turns out to be more informative, according to at least one of the two criteria [this depends on the data], we propose that the experimentalist may well use the simple model to construct a test set of states. For example, she could assume as prior probability distributions for p and σ that p is uniformly distributed on the interval [0, 1], and that σ is uniform on, say, the interval [0, π] (this is somewhat arbitrary, of course, as every prior is). Then, the test set of states could be sampled by simply choosing N p uniformly spaced points in the interval [0, 1] for p and N σ uniformly spaced points in the interval [0, π] for σ, thus creating a test set of N s = N p · N σ states.
The above model leads to states that are diagonal in the Bell basis, In the next Section we thus consider not only the above twoparameter model, but also its obvious extension to a threeparameter model by allowing all Bell-diagonal states.

A. Orthogonal spin measurements
In the following we consider, as an example, two-qubit states with spin measurements performed on each qubit (considered as a spin-1/2 system) in two arbitrary spatial directions that are orthogonal, and we denote the corresponding spin operators by A 1 and A 2 for the first qubit, and B 1 and B 2 for the second qubit. This consitutes a measurement of 8 independent quantities, four single-qubit expectation values and four correlations.
We note that in this case we can construct four Bell-CHSH operators from the four measured correlations: We then test two-qubit states that may be entangled but that do not violate any of the four Bell inequalities that can be constructed from these four operators. In fact, we will not even optimize the choice of spatial directions, given an initial guess of what state should be produced, for violating a Bell inequality.
Finally, we will add one more correlation to be measured, namely that involving the third dimension: A 3 B 3 . That is, whenever A 3 is measured on the first qubit, B 3 is measured on the second qubit. This addition makes the measurements on each qubit separately tomographically complete, but it does not lead to additional Bell-CHSH operators. The total number of independent observables measured in this case is 11 (four are missing). Thus, the parameter K to be used for evaluating Ω a of Eq. (11) is K = 11.

B. Analytical results
Determining the AIC and BIC criteria can be done analytically in most cases that we will consider here. First of all, we can bound the maximum likelihood over all states, given the sort of measurements from the preceding subsection. There are 20 observed frequencies, as follows: for each of the five correlation measurement A i B j , where i, j take on the values (i, j) = (1, 1), (1, 2), (2, 1), (2, 2), (3,3) there are four different outcomes, which we can denote by (+, +), (+, −), (−, +), (−, −). If we denote these frequencies by f ijk , for k = 1 . . . 4, then the (log of the) maximum likelihood is bounded by where N ij is the number of times the A i B j correlation was measured. If we assume all five correlations are measured equally often, then we have The bound is achieved when there is a physical state predicting the frequencies exactly as they were observed. Let us choose directions of our spin measurements as A 1 = B 1 = X, A 2 = B 2 = Y and A 3 = B 3 = Z. Then, there are two obvious models an experimentalist could choose from: the first is the Bell-diagonal model, containing three parameters, in which states are of the form The observed frequencies f ijk for the five correlations cannot be all predicted to arbitrary accuracy by Bell-diagonal states.
The best-fitting Bell-diagonal state can only predict the correct correlations between XX, Y Y , and ZZ measurements. For example, there is a Bell-diagonal state predicting the correct value for the sumf 111 +f 114 , but its prediction for the difference will always be zero. Thus, the Bell-diagonal state fitting the data best will have the following values for {p i }: provided the observed frequencies are such that the {p i } including p 4 = 1−p 1 −p 2 −p 3 are all nonnegative. In that case, the (log of the) maximum likelihood over all Bell-diagonal states is For the Bell-diagonal model we can construct a prior distribution over Bell-diagonal states by choosing the numbers {p i } uniformly over the simplex, as explained in [20].
The two-parameter model is similar in its predictions the the Bell-diagonal model. The only difference is that the parameters p 3 and p 4 are equal. Thus this model can predict only two correlations correctly, namely ZZ and XX − Y Y . The maximum likelihood for this model, then, is given by provided all inferred frequencies are nonnegative.
The three parameters to be used for selecting the most informative model are then, in the case of AIC: and similar expressions for the BIC.

C. Numerics
Let us first discuss the two-parameter substitute prior with p and σ drawn uniformly from [0, 1] and [0, π], respectively. As our favorite entanglement monotone we use the negativity [19,20]. The prior probability distribution for negativity is displayed in Figures 1 (the graph for concurrence is the same for his special case). The plot shows that states exist in the full range of separable to maximally entangled, with the prior probability of entanglement being P ent = 50.3%.
Using this prior, we consider the measurement of five different Bell correlations. Sample results are displayed and discussed in Figures 2-4. Figure 2 shows measurement results generated from an entangled state ρ ? = ρ 0.4,0.4 , as defined in Eq. (4). There is no need to test either AIC or BIC for this case, since the state is chosen from the two-parameter set of states, so the two-parameter model is trivially more informative. The Bayesian posterior probability for entanglement distribution is consistent with the actual entanglement properties of ρ ? , as discussed in the Figure caption. We then also test a state that is just separable, the state ρ 1/3,1/3 . The results can be summarized as "inconclusive" about the question whether the data inform the experimentalist that the underlying state is entangled or not. This is not surprising given how close the actual state is to the separable/entangled boundary. The plot for purity is not shown, as it is very similar to Figure 3 (the estimate of the purity is, Next we consider the following family of states with k ≤ 1 and For k = 1 this state is in the two-parameter set, but for k < 1 it is not. Obviously, the smaller k < 1 is, the less well it is approximated by a state ρ p,σ . We investigate how well the two-parameter model does by calculating and tabulating the values for several values of k < 1 in Table  I. We moreover give the estimated negativities and purities, plus their error bars, as compared to the actual values of those quantities for the states ρ k . What the table shows is that the two-parameter model ceases to be more informative when k < 1 decreases. At that point, the estimate of negativity is still perfectly fine, but the estimate of the purity starts to fail. In the last entry, for k = 0.5, the two-parameter's model's estimate of purity is definitely off by a large amount. In order to consider the three-parameter Bell-diagonal model, we first display the prior distribution for negativity of that model in Fig. 5. Next we us discuss a state that is not close to any state in the two-parameter set of states, but that is still reasonably well described by the three-parameter model, size 600 × 600 were sufficient in all cases. This illustrates that choosing a good physical model with as few parameters as possible pays large dividends.) For this state we calculate the AIC and BIC and compare the two-and three-parameter (Bell-diagonal) models to the full-state model, for the AIC, and for the BIC. That is, the three-parameter model is considered more informative than the model containing all physical states. On the other hand, the two-parameter model is much Thus, both purity and negativity are estimated correctly within the three-parameter model; and this is what one would expect given the AIC and BIC criteria. The posterior probability distribution for the negativity is plotted in Fig. 6.  Lest one starts to think that the two-parameter model in fact somehow always estimates the negativity correctly, even if the estimated purity is wrong, here is a counter example to that idea: when the N m = 5 × 1000 data are generated by the mixture with |ψ 2 = (|00 + 0.5|11 )/ √ 1.25, whose negativity is N = 0.039, the two-parameter model concludes the state is separable with high probability, P ent = 3.1%, andN = 3.5×10 −4 ±0.0025 (and the estimated purity is incorrect as well:P = 0.319 ± 0.008 instead of the correct value P = 0.502). Here, ∆Ω = −203.

IV. DISCUSSION AND CONCLUSIONS
We have demonstrated a method to characterize entanglement sources from finite sets of data, using Bayesian updating for the probability distribution over density matrices. One obtains a posterior probability distribution for any quantity that can be efficiently calculated from an arbitrary density matrix. For instance, one obtains a probability that one's state is entangled, as well as expectation values of any computable entanglement monotone, including estimates of statistical errors. These values should be compared to their a priori values to judge whether one's measurement results lead one to be more certain about entanglement or less.
For two qubits it is in principle sufficient for the purpose of detecting entanglement to measure spin on each qubit in just two orthogonal directions. On the other hand, empirically, we found that for accurately quantifying two-qubit entanglement, adding one more correlation measurement is very beneficial. Thus we concentrated on discussing measurements of five spin-spin correlation functions.
It is hard to say in general what sort of measurements, short of fully tomographic measurements, will be sufficient for estimating what sort of quantities. An easy check, though, is to count by how many parameters a given quantity is determined. For instance, purity is determined by the eigenvalues of the density matrix. Thus for two qubits one needs only three parameters. Thus, reliably estimating the purity of one's output states ought to be easier than estimating entanglement. Our simulations confirm this suspicion, producing relatively smaller error bars for estimates of purity than for entanglement.
It is important to note that in the above we used the phrase "characterizing entanglement sources," rather than "verifying entanglement," because the latter method, in its standard interpretation, has a different meaning: in entanglement verification one tries to find a proof of entanglement convincing a skeptic outsider. But the Bayesian method rather describes one's own belief. In particular, the difference is that one's prior belief of the entanglement-generating source is certainly to be included in a Bayesian description, but in entanglement verification methods such beliefs are not allowed. Nevertheless, Bayesian methods can be used for the stricter purpose of entanglement verification, as discussed in [22].
In order to characterize one's entanglement source, then, it is allowed to use a model describing one's source, based on, e.g., previous experiments and experiences with the same (or similar) device. We provided a criterion to judge whether a given model of one's source is more or less informative than other possible models. In particular, one can always parametrize the output states by using the full quantummechanical description of an arbitrary state of correct Hilbertspace dimension. The latter model, though, while being complete, may have more parameters than wished for or needed. Instead, one may be able to use a description of one's source in terms of a (small) number of physically relevant parameters. We proposed to use two criteria to judge the relative merits of such models, the Akaike Information Criterion (AIC), and the Bayesian Information Criterion (BIC) [13]. We then showed how the AIC and BIC can be used to choose a test set of states i.e., an a priori probability distribution over quantum states generated by one's source: a Bayesian method, of course, only produces probabilities of entanglement by first choosing a prior. If a simple model described one's source very well, then one's test set can be based on that model. We applied the AIC and BIC criteria to several examples, all involving two qubits, and showed that indeed, such criteria indicate whether model's predictions about purity and entanglement of the output of the source (including a probability that one's output state is entangled, as well as an estimate of the amount of entanglement) can be expected to be reliable or not. We demonstrated this by showing that certain estimates produced from a simple model are wrong if the information criteria deem the model to be less informative than the full 15d description of two-qubit quantum states, whereas those estimates are right on the mark, when the criteria deem the simple model to be more informative.

V. ACKNOWLEDGEMENTS
SJvE thanks Robin Blume-Kohout for many useful and inspiring discussions. This research is supported by the Disruptive Technologies Office (DTO) of the DNI.