(filename, UnsupervisedModel=AutoEncoder)
| 103 | |
| 104 | @staticmethod |
| 105 | def load(filename, UnsupervisedModel=AutoEncoder): |
| 106 | dbn = DBN([], UnsupervisedModel) |
| 107 | npz = np.load(filename) |
| 108 | dbn.hidden_layers = [] |
| 109 | count = 0 |
| 110 | for i in range(0, len(npz.files), 3): |
| 111 | W = npz['arr_%s' % i] |
| 112 | bh = npz['arr_%s' % (i + 1)] |
| 113 | bo = npz['arr_%s' % (i + 2)] |
| 114 | |
| 115 | if i == 0: |
| 116 | dbn.D = W.shape[0] |
| 117 | |
| 118 | ae = UnsupervisedModel.createFromArrays(W, bh, bo, count) |
| 119 | dbn.hidden_layers.append(ae) |
| 120 | count += 1 |
| 121 | return dbn |
| 122 | |
| 123 | |
| 124 | def main(): |
no test coverage detected