@@ -94,28 +94,26 @@ def init(self, init_points):
9494 # points from self.explore method.
9595 self .init_points += list (map (list , zip (* l )))
9696
97- # Create empty list to store the new values of the function
98- y_init = []
97+ # Create empty arrays to store the new points and values of the function.
98+ self .X = np .empty ((0 , self .bounds .shape [0 ]))
99+ self .Y = np .empty (0 )
99100
100101 # Evaluate target function at all initialization
101102 # points (random + explore)
102103 for x in self .init_points :
103-
104- y_init . append (self .f (** dict (zip (self .keys , x ))))
104+ self . X = np . vstack (( self . X , np . asarray ( x ). reshape (( 1 , - 1 ))))
105+ self . Y = np . append (self . Y , self .f (** dict (zip (self .keys , x ))))
105106
106107 if self .verbose :
107108 self .plog .print_step (x , y_init [- 1 ])
108109
109110 # Append any other points passed by the self.initialize method (these
110111 # also have a corresponding target value passed by the user).
111112 self .init_points += self .x_init
113+ self .X = np .vstack ((self .X , np .asarray (self .x_init ).reshape (- 1 , self .X .shape [1 ])))
112114
113115 # Append the target value of self.initialize method.
114- y_init += self .y_init
115-
116- # Turn it into np array and store.
117- self .X = np .asarray (self .init_points )
118- self .Y = np .asarray (y_init )
116+ self .Y = np .concatenate ((self .Y , self .y_init ))
119117
120118 # Updates the flag
121119 self .initialized = True
0 commit comments