| Initialize |
| all weights () to small random numbers and make them known to both parties. |
| Repeat |
| for all training sample do |
| This part mainly uses (5) and (9). Samples are obtained after only one step of Gibbs sampling |
| because one-step Gibbs has been shown to work surprisingly well [22]. |
| Step 1. Gibbs Sampling |
| { |
| For each hidden layer node , Party computes , and Party computes |
| Using Algorithm 1, Parties and jointly compute the sigmoid function for , obtaining the random shares and , |
| respectively, s.t. |
| For each visible layer node , after that Party computes , and Party computes |
| then again using Algorithm 1, Parties and jointly compute the sigmoid function for , |
| obtaining the random shares and , respectively, s.t. |
| For each hidden layer node , Party computes , and Party computes |
| Using Algorithm 1, Parties and jointly compute the sigmoid function for , |
| obtaining the random shares and , respectively, s.t. |
| } |
| return and to two parties. |
| This part mainly uses (4), (6) and (7). |
| Step 2. Update Weights |
| { |
| Parties and compute , , and respectively. |
| Parties and apply Algorithm 2 to securely compute the product , |
| obtaining random shares and , respectively, |
| s.t. . Similarly, they compute the random partitions of , , and , s.t. . |
| Parties and apply Algorithm 2 to securely compute the product , |
| obtaining random shares and , respectively, |
| s.t. . Similarly, they compute the random partitions of , , and , s.t. . |
| If Party owns the visible unit, which is , then Party computes , |
| and Party computes . Then Party sends this value to Party , |
| who can add these two numbers to get the log-likelihood gradients |
| for an RBM. |
| If Party owns the visible unit, then the same method can be used to calculate the value. |
| Then using these log-likelihood gradients Party can update the parameter of this RBM. |
|
| } |
| return new to two parties |
| Using the same method, we can update parameters and |
| end for |
| Until (termination condition) |