From b2a174e81aead41492b5c8e44d156876d47fdb5e Mon Sep 17 00:00:00 2001 From: Soeren Sonnenburg Date: Wed, 11 Sep 2013 17:37:47 +0200 Subject: [PATCH] CSVFile conversion --- .../distance_mahalanobis_modular.py | 13 +++++-------- .../distance_manhatten_modular.py | 17 ++++++----------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/examples/undocumented/python_modular/distance_mahalanobis_modular.py b/examples/undocumented/python_modular/distance_mahalanobis_modular.py index 3bef0678415..eead4262122 100644 --- a/examples/undocumented/python_modular/distance_mahalanobis_modular.py +++ b/examples/undocumented/python_modular/distance_mahalanobis_modular.py @@ -1,19 +1,16 @@ #!/usr/bin/env python -from tools.load import LoadMatrix -lm = LoadMatrix() - -traindat = lm.load_numbers('../data/fm_train_real.dat') -testdat = lm.load_numbers('../data/fm_test_real.dat') +traindat = '../data/fm_train_real.dat' +testdat = '../data/fm_test_real.dat' parameter_list = [[traindat, testdat]] -def distance_mahalanobis_modular (fm_train_real = traindat, fm_test_real = testdat): +def distance_mahalanobis_modular (train_fname = traindat, test_fname = testdat): from modshogun import RealFeatures from modshogun import MahalanobisDistance - feats_train = RealFeatures(fm_train_real) - feats_test = RealFeatures(fm_test_real) + feats_train=RealFeatures(CSVFile(train_fname)) + feats_test=RealFeatures(CSVFile(test_fname)) distance = MahalanobisDistance(feats_train, feats_train) dm_train=distance.get_distance_matrix() diff --git a/examples/undocumented/python_modular/distance_manhatten_modular.py b/examples/undocumented/python_modular/distance_manhatten_modular.py index 4d9cb1436f1..8d69b0e7c07 100644 --- a/examples/undocumented/python_modular/distance_manhatten_modular.py +++ b/examples/undocumented/python_modular/distance_manhatten_modular.py @@ -1,19 +1,14 @@ #!/usr/bin/env python -from tools.load import LoadMatrix -lm=LoadMatrix() - -traindat = lm.load_numbers('../data/fm_train_real.dat') -testdat = lm.load_numbers('../data/fm_test_real.dat') +traindat = '../data/fm_train_real.dat' +testdat = '../data/fm_test_real.dat' parameter_list = [[traindat,testdat],[traindat,testdat]] -def distance_manhatten_modular (fm_train_real=traindat,fm_test_real=testdat): - - from modshogun import RealFeatures - from modshogun import ManhattanMetric +def distance_manhatten_modular (train_fname,test_fname=testdat): + from modshogun import RealFeatures, ManhattanMetric, CSVFile - feats_train=RealFeatures(fm_train_real) - feats_test=RealFeatures(fm_test_real) + feats_train=RealFeatures(CSVFile(train_fname)) + feats_test=RealFeatures(CSVFile(test_fname)) distance=ManhattanMetric(feats_train, feats_train)