Skip to content

Commit

Permalink
fix svr and krr examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Sep 2, 2012
1 parent 684cd3a commit 7bb1224
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Expand Up @@ -22,7 +22,7 @@
plot(X, Y, '.', label='train data')
plot(X[0], krr.apply().get_labels(), hold=True, label='train output')

XE, YE=util.compute_output_plot_isolines_sine(krr, gk, feat)
XE, YE=util.compute_output_plot_isolines_sine(krr, gk, feat, regression=True)
YE200=krr.apply_one(200)

plot(XE[0], YE, hold=True, label='test output')
Expand Down
4 changes: 2 additions & 2 deletions examples/undocumented/python_modular/graphical/svr_sinc.py
Expand Up @@ -19,9 +19,9 @@
svr.train()

plot(X, Y, '.', label='train data')
plot(X[0], svr.apply().get_confidences(), hold=True, label='train output')
plot(X[0], svr.apply().get_labels(), hold=True, label='train output')

XE, YE=util.compute_output_plot_isolines_sine(svr, gk, feat)
XE, YE=util.compute_output_plot_isolines_sine(svr, gk, feat, regression=True)
plot(XE[0], YE, hold=True, label='test output')

connect('key_press_event', util.quit)
Expand Down
8 changes: 6 additions & 2 deletions examples/undocumented/python_modular/graphical/util.py
Expand Up @@ -101,11 +101,15 @@ def get_sinedata():
return x, y


def compute_output_plot_isolines_sine(classifier, kernel, train):
def compute_output_plot_isolines_sine(classifier, kernel, train, regression=False):
x=4*rand(1, 500)-2
x.sort()
test=RealFeatures(x)
kernel.init(train, test)
y=classifier.apply().get_confidences()

if regression:
y=classifier.apply().get_labels()
else:
y=classifier.apply().get_confidences()

return x, y

0 comments on commit 7bb1224

Please sign in to comment.