<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Approximate bayesian inference using EP
This notebooks demonstrates how to use the EP algorithm for pairwise data.
Step1:  Logit observation model
Step2:  Probit observation model
<ASSISTANT_TASK:>
Python Code:
import choix
import numpy as np
np.set_printoptions(precision=3, suppress=True)
n_items = 8
data = [
    (7, 3), (2, 0), (5, 2), (4, 2), (2, 1),
    (4, 5), (6, 3), (5, 4), (7, 0), (2, 3),
    (4, 0), (0, 4), (6, 5), (3, 2), (3, 4),
    (3, 4), (5, 2), (7, 3), (7, 6), (6, 5),
]
Explanation: Approximate bayesian inference using EP
This notebooks demonstrates how to use the EP algorithm for pairwise data.
End of explanation
mean, cov = choix.ep_pairwise(n_items, data, 0.1, model="logit")
print("mean:")
print(mean)
print("\ncovariance:")
print(cov)
print("\ntotal variance: {:3f}".format(np.trace(cov)))
Explanation: Logit observation model
End of explanation
mean, cov = choix.ep_pairwise(n_items, data, 0.1, model="probit")
print("mean:")
print(mean)
print("\ncovariance:")
print(cov)
print("\ntotal variance: {:3f}".format(np.trace(cov)))
Explanation: Probit observation model
End of explanation
<END_TASK>