Convert all saved attributes from a list to np.array. This may or may not work - every saved attribute must have the same shape for every instance. i.e., if `K` changes shape due to `z` changing shape then the call will raise an exception. This can also hap
(self)
| 163 | return list(self._DL.keys()) |
| 164 | |
| 165 | def to_array(self): |
| 166 | """ |
| 167 | Convert all saved attributes from a list to np.array. |
| 168 | |
| 169 | This may or may not work - every saved attribute must have the |
| 170 | same shape for every instance. i.e., if `K` changes shape due to `z` |
| 171 | changing shape then the call will raise an exception. |
| 172 | |
| 173 | This can also happen if the default initialization in __init__ gives |
| 174 | the variable a different shape then it becomes after a predict/update |
| 175 | cycle. |
| 176 | """ |
| 177 | for key in self.keys: |
| 178 | try: |
| 179 | self.__dict__[key] = np.array(self._DL[key]) |
| 180 | except: |
| 181 | # get back to lists so we are in a valid state |
| 182 | self.__dict__.update(self._DL) |
| 183 | |
| 184 | raise ValueError( |
| 185 | "could not convert {} into np.array".format(key)) |
| 186 | |
| 187 | def flatten(self): |
| 188 | """ |