#NEWLINE# def make_query( self ) : #NEWLINE# #INDENT# L = self . L #NEWLINE# Lindex = self . Lindex #NEWLINE# Uindex = self . Uindex #NEWLINE# query_index = ( - 1 ) #NEWLINE# min_eva = np . inf #NEWLINE# y_labeled = np . array ( [ label for label in self . y if ( label is not None ) ] ) #NEWLINE# det_Laa = np . linalg . det ( L [ np . ix_ ( Uindex , Uindex ) ] ) #NEWLINE# M3 = np . dot ( self . K [ np . ix_ ( Uindex , Lindex ) ] , np . linalg . inv ( ( self . lmbda * np . eye ( len ( Lindex ) ) ) ) ) #NEWLINE# M2 = np . dot ( M3 , self . K [ np . ix_ ( Lindex , Uindex ) ] ) #NEWLINE# M1 = ( ( self . lmbda * np . eye ( len ( Uindex ) ) ) + self . K [ np . ix_ ( Uindex , M3 ) ] ) #NEWLINE# inv_Laa = ( M1 - M2 ) #NEWLINE# iList = list ( range ( len ( Uindex ) ) ) #NEWLINE# if ( len ( iList ) == 1 ) : #NEWLINE# #INDENT# return Uindex [ 0 ] #NEWLINE# #UNINDENT# for ( i , each_index ) in enumerate ( Uindex ) : #NEWLINE# #INDENT# Uindex_r = Uindex [ : ] #NEWLINE# Uindex_r . remove ( each_index ) #NEWLINE# iList_r = iList [ : ] #NEWLINE# iList_r . remove ( i ) #NEWLINE# inv_Luu = ( inv_Laa [ np . ix_ ( iList_r , iList_r ) ] - ( ( 1 / inv_Laa [ ( i , i ) ] ) * np . dot ( inv_Laa [ ( iList_r , i ) ] , inv_Laa [ ( iList_r , i ) ] . T ) ) ) #NEWLINE# tmp = np . dot ( ( L [ each_index ] [ Lindex ] - np . dot ( np . dot ( L [ each_index ] [ Uindex_r ] , inv_Luu ) , L [ np . ix_ ( Uindex_r , Lindex ) ] ) ) , y_labeled ) #NEWLINE# eva = ( ( L [ each_index ] [ each_index ] - ( det_Laa / L [ each_index ] [ each_index ] ) ) + ( 2 * np . abs ( tmp ) ) ) #NEWLINE# if ( eva < min_eva ) : #NEWLINE# #INDENT# query_index = each_index #NEWLINE# min_eva = eva #NEWLINE# #UNINDENT# #UNINDENT# return query_index