def publish(self, pub):
        if not self.once:
            pub.text('warning', 'not updated yet')
            return
        
        pub.text('nsamples', '%s' % self.nsamples)
        
        pub.text('rcond', '%g' % self.rcond)
        with pub.subsection('model') as sub:
            try:
                model = self.get_model()
                model.publish(sub)
            except BDSEEstimatorInterface.NotReady as e:
                pub.text('not-ready', str(e))

        with pub.subsection('tensors') as sub:
            T = self.get_T()
            U = self.U.get_value()
            P = self.y_stats.get_covariance()
            Q = self.u_stats.get_covariance()
            P_inv = np.linalg.pinv(P)
            P_inv_cond = self.get_P_inv_cond()
            Q_inv = np.linalg.pinv(Q)
    #
    #        TP_inv2 = obtain_TP_inv_from_TP_2(T, P)  
    #        M2 = np.tensordot(TP_inv2, Q_inv, axes=(2, 0))
        
            pub_tensor3_slice2(sub, 'T', T)
            pub_tensor2_comp1(sub, 'U', U)
            pub_tensor2_cov(sub, 'P', P, rcond=self.rcond)
            pub_tensor2_cov(sub, 'P_inv', P_inv)
            pub_tensor2_cov(sub, 'P_inv_cond', P_inv_cond)
            pub_tensor2_cov(sub, 'Q', Q)
            pub_tensor2_cov(sub, 'Q_inv', Q_inv)
            # Might not have been computed
            # pub_tensor2_comp1(sub, 'Myav', self.Myav)
            # pub_tensor2_comp1(sub, 'UQ_inv', self.UQ_inv)

        with pub.subsection('y_stats') as sub:
            self.y_stats.publish(sub)

        with pub.subsection('u_stats') as sub:
            self.u_stats.publish(sub)
          
        with pub.subsection('alternative', robust=True) as sub:
            sub.text('info', 'This is estimating without conditioning P')
            T = self.get_T() 
            P = self.y_stats.get_covariance()
            Q = self.u_stats.get_covariance()
            
            M1 = get_M_from_P_T_Q(P, T, Q)
            pub_tensor3_slice2(sub, 'get_M_from_P_T_Q', M1)
            
            M2 = get_M_from_P_T_Q_alt(P, T, Q)
            pub_tensor3_slice2(sub, 'get_M_from_P_T_Q_alt', M2)

            M3 = get_M_from_P_T_Q_alt_scaling(P, T, Q)
            pub_tensor3_slice2(sub, 'get_M_from_P_T_Q_alt2', M3)
Beispiel #2
0
 def publish(self, pub):
     pub_tensor3_slice2(pub, 'M', self.M)
     pub_tensor2_comp1(pub, 'N', self.N)