[Scipy-svn] r2145 - trunk/Lib/sandbox/svm/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Aug 3 11:14:30 EDT 2006
Author: fullung
Date: 2006-08-03 10:14:19 -0500 (Thu, 03 Aug 2006)
New Revision: 2145
Added:
trunk/Lib/sandbox/svm/tests/test_speed.py
Log:
Benchmark with large test dataset.
Added: trunk/Lib/sandbox/svm/tests/test_speed.py
===================================================================
--- trunk/Lib/sandbox/svm/tests/test_speed.py 2006-08-03 15:12:13 UTC (rev 2144)
+++ trunk/Lib/sandbox/svm/tests/test_speed.py 2006-08-03 15:14:19 UTC (rev 2145)
@@ -0,0 +1,28 @@
+from numpy.testing import *
+import numpy as N
+
+set_local_path('../..')
+from svm.classification import *
+from svm.dataset import *
+from svm.kernel import *
+from svm.predict import *
+restore_path()
+
+class test_classification_speed(NumpyTestCase):
+ def check_large_test_dataset(self):
+ x = N.random.randn(150, 5)
+ labels = N.random.random_integers(1, 5, x.shape[0])
+ traindata = LibSvmClassificationDataSet(labels, x)
+
+ kernel = RBFKernel(traindata.gamma)
+ model = LibSvmCClassificationModel(kernel)
+ results = model.fit(traindata, LibSvmPythonPredictor)
+ results.compact()
+
+ xdim, ydim = 32, 32
+ img = N.random.randn(xdim, ydim, 3)
+ testdata = LibSvmTestDataSet(img.reshape(xdim*ydim, 3))
+ v = results.predict_values(testdata)
+
+if __name__ == '__main__':
+ NumpyTest().run()
More information about the Scipy-svn
mailing list