示例#1
0
def plotpoints_knn_fm_fires():
   fm = amf.ForwardMapping(amf.regression.kNN, [55], 3)
   data = amf.data.load('../data/fires.txt')
   subset = amf.data.random_subsets(data, [400])[0]

   fm.train(subset)

   for x in misc.xfrange(45.0, 75.0, .1):
      print x, fm.predict((x,))[0]
def plotpoints_knn_fm_fires():

   data = amf.data.load('../data/fires.txt')
   subset = amf.data.random_subsets(data, [200])[0]

   for k in range(5, 30, 5):
      fm = amf.ForwardMapping(amf.regression.kNN, [k], 1)
      fm.train(subset)
      out = open('../data/plots/fires_knn_graph/k=%d' % k, 'w')

      for x in misc.xfrange(45.0, 75.0, .1):
         print >> out, x, fm.predict((x,))[0]

   gpscript = open('../data/plots/fires_knn_graph/plot.gp' ,'w')

   print >> gpscript, """
def plotpoints_loess_fm_fires():

   data = amf.data.load('../data/fires.txt')
   subset = amf.data.random_subsets(data, [200])[0]

   window = .5
   for i in range(3):
      fm = amf.ForwardMapping(amf.regression.LOESS, [window, 1], 1)
      fm.train(subset)
      out = open('../data/plots/fires_loess_graph/window=%.1f' % window, 'w')

      for x in misc.xfrange(45.0, 75.0, .1):
         print >> out, x, fm.predict((x,))[0]

      window += .5
   gpscript = open('../data/plots/fires_loess_graph/plot.gp' ,'w')

   print >> gpscript, """