@@ -319,7 +319,7 @@ def setOutputsMapping(self, outputsMapping, acc_output=None):
319
319
the desired output order (in this case only one value can be provided).
320
320
If it is Model then keys must be str.
321
321
:param acc_output: name of the model's output that will be used for calculating
322
- the accuracy of the model (only needed for Graph models)
322
+ the accuracy of the model (only needed for Model models)
323
323
"""
324
324
if isinstance (self .model , Sequential ) and len (list (outputsMapping )) > 1 :
325
325
raise Exception ("When using Sequential models only one output can be provided in outputsMapping" )
@@ -404,9 +404,12 @@ def setOptimizer(self, lr=None, momentum=None, loss='categorical_crossentropy',
404
404
if not self .silence :
405
405
logger .info ("Compiling model..." )
406
406
407
- # compile differently depending if our model is 'Sequential', 'Model' or 'Graph'
407
+ # compile differently depending if our model is 'Sequential', 'Model'
408
408
if isinstance (self .model , Sequential ) or isinstance (self .model , Model ):
409
- self .model .compile (optimizer = optimizer , metrics = metrics , loss = loss , loss_weights = loss_weights ,
409
+ self .model .compile (optimizer = optimizer ,
410
+ metrics = metrics ,
411
+ loss = loss ,
412
+ loss_weights = loss_weights ,
410
413
sample_weight_mode = sample_weight_mode )
411
414
else :
412
415
raise NotImplementedError ()
@@ -576,8 +579,7 @@ def trainNetFromSamples(self, x, y, parameters=None, class_weight=None, sample_w
576
579
:param parameters:
577
580
:param class_weight:
578
581
:param sample_weight:
579
- :param out_name: name of the output node that will be used to evaluate the network accuracy.
580
- Only applicable to Graph models.
582
+ :param out_name: name of the output node that will be used to evaluate the network accuracy. Only applicable to Models.
581
583
582
584
The input 'parameters' is a dict() which may contain the following (optional) training parameters:
583
585
#### Visualization parameters
@@ -884,7 +886,6 @@ def testNet(self, ds, parameters, out_name=None):
884
886
for name , o in zip (self .model .metrics_names , out ):
885
887
logger .info ('test ' + name + ': %0.8s' % o )
886
888
887
-
888
889
def testNetSamples (self , X , batch_size = 50 ):
889
890
"""
890
891
Applies a forward pass on the samples provided and returns the predicted classes and probabilities.
@@ -914,7 +915,7 @@ def testOnBatch(self, X, Y, accuracy=True, out_name=None):
914
915
return loss , score , top_score , n_samples
915
916
return loss , n_samples
916
917
else :
917
- [data , last_output ] = self ._prepareGraphData (X , Y )
918
+ [data , last_output ] = self ._prepareModelData (X , Y )
918
919
loss = self .model .test_on_batch (data )
919
920
loss = loss [0 ]
920
921
if accuracy :
@@ -1594,10 +1595,10 @@ def predictOnBatch(self, X, in_name=None, out_name=None, expand=False):
1594
1595
predictions = self .model .predict_on_batch (X )
1595
1596
1596
1597
# Select output if indicated
1597
- if isinstance (self .model , Model ): # Graph
1598
+ if isinstance (self .model , Model ):
1598
1599
if out_name :
1599
1600
predictions = predictions [out_name ]
1600
- elif isinstance (self .model , Sequential ): # Sequential
1601
+ elif isinstance (self .model , Sequential ):
1601
1602
predictions = predictions [0 ]
1602
1603
1603
1604
return predictions
@@ -1861,7 +1862,7 @@ def decode_predictions_one_hot(preds, index2word, verbose=0):
1861
1862
1862
1863
def prepareData (self , X_batch , Y_batch = None ):
1863
1864
"""
1864
- Prepares the data for the model, depending on its type (Sequential, Model, Graph ).
1865
+ Prepares the data for the model, depending on its type (Sequential, Model).
1865
1866
:param X_batch: Batch of input data.
1866
1867
:param Y_batch: Batch output data.
1867
1868
:return: Prepared data.
0 commit comments