Mercurial > ift6266
changeset 226:bfe20d63f88c
Test pour cas sans index, après question de James
author | fsavard |
---|---|
date | Fri, 12 Mar 2010 09:02:40 -0500 |
parents | eb78a695ad7a |
children | acae439d6572 |
files | utils/seriestables/test_series.py |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/utils/seriestables/test_series.py Thu Mar 11 16:29:39 2010 -0500 +++ b/utils/seriestables/test_series.py Fri Mar 12 09:02:40 2010 -0500 @@ -65,6 +65,33 @@ assert compare_lists(table.cols.minibatch[:], [1,2,1,2]) assert compare_lists(table.cols.validation_error[:], [32.0, 30.0, 28.0, 26.0]) +def test_ErrorSeries_no_index(h5f=None): + if not h5f: + h5f_path = tempfile.NamedTemporaryFile().name + h5f = tables.openFile(h5f_path, "w") + + validation_error = series.ErrorSeries(error_name="validation_error", + table_name="validation_error", + hdf5_file=h5f, + # empty tuple + index_names=tuple(), + title="Validation error with no index") + + # (1,1), (1,2) etc. are (epoch, minibatch) index + validation_error.append(tuple(), 32.0) + validation_error.append(tuple(), 30.0) + validation_error.append(tuple(), 28.0) + validation_error.append(tuple(), 26.0) + + h5f.close() + + h5f = tables.openFile(h5f_path, "r") + + table = h5f.getNode('/', 'validation_error') + + assert compare_lists(table.cols.validation_error[:], [32.0, 30.0, 28.0, 26.0]) + assert not ("epoch" in dir(table.cols)) + def test_ErrorSeries_notimestamp(h5f=None): if not h5f: h5f_path = tempfile.NamedTemporaryFile().name