#NEWLINE# def __init__( self , model , Y , name = 'inferenceX' , init = 'L2' ) : #NEWLINE# #INDENT# if ( np . isnan ( Y ) . any ( ) or getattr ( model , 'missing_data' , False ) ) : #NEWLINE# #INDENT# assert ( Y . shape [ 0 ] == 1 ) , 'The current implementation of inference X only support one data point at a time with missing data!' #NEWLINE# self . missing_data = True #NEWLINE# self . valid_dim = np . logical_not ( np . isnan ( Y [ 0 ] ) ) #NEWLINE# self . ninan = getattr ( model , 'ninan' , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . missing_data = False #NEWLINE# #UNINDENT# super ( InferenceX , self ) . __init__ ( name ) #NEWLINE# self . likelihood = model . likelihood . copy ( ) #NEWLINE# self . kern = model . kern . copy ( ) #NEWLINE# from copy import deepcopy #NEWLINE# self . posterior = deepcopy ( model . posterior ) #NEWLINE# if isinstance ( model . X , variational . VariationalPosterior ) : #NEWLINE# #INDENT# self . uncertain_input = True #NEWLINE# from ... models.ss_gplvm import IBPPrior #NEWLINE# from ... models.ss_mrd import IBPPrior_SSMRD #NEWLINE# if ( isinstance ( model . variational_prior , IBPPrior ) or isinstance ( model . variational_prior , IBPPrior_SSMRD ) ) : #NEWLINE# #INDENT# self . variational_prior = variational . SpikeAndSlabPrior ( pi = 0.5 , learnPi = False , group_spike = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . variational_prior = model . variational_prior . copy ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . uncertain_input = False #NEWLINE# #UNINDENT# if hasattr ( model , 'Z' ) : #NEWLINE# #INDENT# self . sparse_gp = True #NEWLINE# self . Z = model . Z . copy ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . sparse_gp = False #NEWLINE# self . uncertain_input = False #NEWLINE# self . Z = model . X . copy ( ) #NEWLINE# #UNINDENT# self . Y = Y #NEWLINE# self . X = self . _init_X ( model , Y , init = init ) #NEWLINE# self . compute_dL ( ) #NEWLINE# self . link_parameter ( self . X )