#NEWLINE# def test_predictive_probability_unobserved( seed = 0 ) : #NEWLINE# #INDENT# ( T , M_r , M_c , X_L , X_D , engine ) = quick_le ( seed ) #NEWLINE# Q = [ ( N_ROWS , 1 , 1.5 ) , ( N_ROWS , 10 , 2 ) ] #NEWLINE# Y = [ ] #NEWLINE# with pytest . raises ( ValueError ) : #NEWLINE# #INDENT# vals = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# #UNINDENT# Q = [ ( N_ROWS , 1 , 1.5 ) , ( ( N_ROWS - 1 ) , 10 , 2 ) ] #NEWLINE# Y = [ ] #NEWLINE# with pytest . raises ( ValueError ) : #NEWLINE# #INDENT# vals = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# #UNINDENT# Q = [ ( N_ROWS , 1 , 1.5 ) , ( N_ROWS , 1 , 2 ) ] #NEWLINE# Y = [ ] #NEWLINE# with pytest . raises ( ValueError ) : #NEWLINE# #INDENT# val = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# #UNINDENT# Q = [ ( N_ROWS , 0 , 1.5 ) , ( ( N_ROWS + 1 ) , 1 , 2 ) ] #NEWLINE# Y = [ ( N_ROWS , 1 , 1.5 ) , ( N_ROWS , 2 , 3 ) ] #NEWLINE# with pytest . raises ( Exception ) : #NEWLINE# #INDENT# val = engine . predictive_probability ( M_c , X_L , X_D , Y , Q [ 0 ] ) #NEWLINE# #UNINDENT# Q = [ ( N_ROWS , 1 , 1.5 ) , ( N_ROWS , 0 , 1.3 ) ] #NEWLINE# Y = [ ( N_ROWS , 1 , 1.6 ) ] #NEWLINE# val = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# assert ( val == ( - float ( 'inf' ) ) ) #NEWLINE# assert isinstance ( val , float ) #NEWLINE# Q = [ ( N_ROWS , 0 , 1.3 ) ] #NEWLINE# Y = [ ( N_ROWS , 0 , 1.3 ) ] #NEWLINE# val = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# assert ( val == 0 ) #NEWLINE# Q = [ ( N_ROWS , 1 , 1.5 ) , ( N_ROWS , 0 , 1.3 ) ] #NEWLINE# Y = [ ( N_ROWS , 1 , 1.5 ) , ( N_ROWS , 2 , 3 ) ] #NEWLINE# val_0 = engine . predictive_probability ( M_c , val , X_D , Y , Q ) #NEWLINE# val_1 = engine . predictive_probability ( M_c , X_L , X_D , Y , Q [ 1 : ] ) #NEWLINE# assert ( val_0 == val_1 ) #NEWLINE# Q = [ ( N_ROWS , 0 , 0.5 ) ] #NEWLINE# Y = [ ( 0 , 0 , 1 ) , ( ( N_ROWS // 2 ) , 4 , 5 ) , ( N_ROWS , 1 , 0.5 ) , ( ( N_ROWS + 1 ) , 0 , 1.2 ) ] #NEWLINE# val_0 = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# val_1 = engine . simple_predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# assert ( val_0 == val_1 ) #NEWLINE# Q = [ ( N_ROWS , 2 , 1 ) ] #NEWLINE# Y = [ ( 0 , 0 , 1 ) , ( ( N_ROWS // 2 ) , 4 , 5 ) , ( N_ROWS , 1 , 0.5 ) , ( ( N_ROWS + 1 ) , 0 , 1.2 ) ] #NEWLINE# val_0 = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# val_1 = engine . simple_predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# assert ( val_0 == val_1 ) #NEWLINE# Q = [ ( N_ROWS , 3 , 4 ) , ( N_ROWS , 4 , 1.3 ) ] #NEWLINE# Y = [ ( N_ROWS , 0 , 1 ) , ( N_ROWS , 1 , ( - 0.7 ) ) , ( N_ROWS , 2 , 3 ) ] #NEWLINE# val = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# assert isinstance ( val , float ) #NEWLINE# Q = [ ( N_ROWS , 0 , 1 ) , ( N_ROWS , 1 , ( - 0.7 ) ) , ( N_ROWS , 2 , 3 ) ] #NEWLINE# Y = [ ( N_ROWS , 3 , 4 ) , ( N_ROWS , 4 , 1.3 ) ] #NEWLINE# val = engine . predictive_probability ( M_c , X_L , X_D , Y , Q ) #NEWLINE# assert isinstance ( val , float )