Skip to content

Commit

Permalink
added closing statement
Browse files Browse the repository at this point in the history
  • Loading branch information
PirosB3 committed Mar 7, 2014
1 parent 356d728 commit d335493
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions applications/classification/train_multiclass_svm.py
Expand Up @@ -31,7 +31,7 @@

import argparse
import logging
from contextlib import contextmanager
from contextlib import contextmanager, closing
from modshogun import (LibSVMFile, SparseRealFeatures, MulticlassLabels,
GaussianKernel, MulticlassLibSVM,
SerializableHdf5File, Time)
Expand Down Expand Up @@ -92,7 +92,8 @@ def train_multiclass(dataset, output, epsilon, capacity, width):

# Serialize to file
writable_file = SerializableHdf5File(output, 'w')
svm.save_serializable(writable_file)
with closing(writable_file):
svm.save_serializable(writable_file)
LOGGER.info("Serialized classifier saved in: '%s'" % output)


Expand Down

0 comments on commit d335493

Please sign in to comment.