Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
amaiya committed Aug 19, 2019
2 parents 553163f + 1f42c84 commit b590de6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ Most recent releases are shown at the top. Each release shows:
- **Changed**: Additional parameters, changes to inputs or outputs, etc
- **Fixed**: Bug fixes that don't change documented behaviour

## 0.2.3 (2019-08-18)

### New:
- N/A

### Changed:
-

### Fixed:
- Fixed issue with ```learner.validate``` and ```learner.predict``` failing when validation data is in
the form of an Iterator (e.g., DirectoryIterator).


## 0.2.2 (2019-08-16)

### New:
Expand Down
13 changes: 2 additions & 11 deletions ktrain/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,8 @@ def predict(self, val_data=None):
val = self.val_data
if val is None: raise Exception('val_data must be supplied to get_learner or predict')
if U.is_iter(val):
return self.model.predict_generator(val)
steps = np.ceil(U.nsamples_from_data(val)/val.batch_size)
return self.model.predict_generator(val, steps=steps)
else:
return self.model.predict(val[0])

Expand Down Expand Up @@ -1105,16 +1106,6 @@ def layer_output(self, layer_id, example_id=0, batch_id=0, use_val=False):
return layer_out


def predict(self):
"""
Makes predictions on validation set
"""
if self.val_data is None:
raise Exception('val_data is None')
return self.model.predict_generator(self.val_data)



def get_predictor(model, preproc):
"""
Returns a Predictor instance that can be used to make predictions on
Expand Down
2 changes: 1 addition & 1 deletion ktrain/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__all__ = ['__version__']
__version__ = '0.2.2'
__version__ = '0.2.3'
3 changes: 2 additions & 1 deletion tutorial-03-image-classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@
"metadata": {},
"outputs": [],
"source": [
"loss, acc = learner.model.evaluate_generator(learner.val_data)"
"loss, acc = learner.model.evaluate_generator(learner.val_data, \n",
" steps=len(learner.val_data))"
]
},
{
Expand Down

0 comments on commit b590de6

Please sign in to comment.