Skip to content

Commit

Permalink
better indentation and better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
PirosB3 committed Mar 7, 2014
1 parent b7158ec commit 97ed25f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions applications/classification/train_multiclass_svm.py
Expand Up @@ -10,7 +10,13 @@
#

import argparse
from modshogun import LibSVMFile, SparseRealFeatures, MulticlassLabels, GaussianKernel, MulticlassLibSVM, SerializableHdf5File
import logging
from modshogun import (LibSVMFile, SparseRealFeatures, MulticlassLabels,
GaussianKernel, MulticlassLibSVM,
SerializableHdf5File)

logging.basicConfig(level=logging.INFO, format='[%(asctime)-15s %(module)s] %(message)s')
logger = logging.getLogger(__file__)

def parse_arguments():
parser = argparse.ArgumentParser(description="Train a multiclass SVM stored \
Expand All @@ -29,6 +35,11 @@ def parse_arguments():
return parser.parse_args()

def main(dataset, output, epsilon, capacity, width):
logger.info("SVM Multiclass classifier")
logger.info("Epsilon: %s" % epsilon)
logger.info("Capacity: %s" % capacity)
logger.info("Gaussian width: %s" % width)

input_file = LibSVMFile(dataset)

sparse_feats = SparseRealFeatures()
Expand All @@ -43,7 +54,7 @@ def main(dataset, output, epsilon, capacity, width):

writable_file = SerializableHdf5File(output, 'w')
svm.save_serializable(writable_file)
print "DONE"
logger.info("Serialized classifier saved in: '%s'" % output)


if __name__ == '__main__':
Expand Down

0 comments on commit 97ed25f

Please sign in to comment.