예제 #1
0
def main(argv):
  l_config = renter_constants.learned_config
  if len(argv) == 2:
    # - Convert the raw data to SETI.
    which = argv[1]
    if which == '1':
      l_config = renter_constants.learned_config2
    elif which == '2':
      l_config = renter_constants.learned_config2
      l_config.raw_filenames = ['data/from_haoran/clean_*.csv']
    elif which == '3' or which =='regression_test':
      l_config = renter_constants.learned_config2
      l_config.raw_filenames = ['data/new_data_set/clean_full_all.csv'] #['data/round1/prices_samples_full_0921212303_all.csv']
      if which == 'regression_test':
        model_cfg.change_dirs('tmp/regression_test', l_config.model_configs)
  setis = logs_to_seti.generate_seti(l_config.raw_filenames)
  #setis = setis[0:1000]
  print 'Generated: %d setis' % len(setis)
  if _DEBUG:
    f = open('tmp/cur_run_setis.csv', 'wb')
    setis_txt = '\n'.join([str(seti) for seti in setis])
    f.write(setis_txt)
    f.close()
  run_pipeline.run(l_config.model_configs, setis)
  return {
    'setis': setis,
    'l_config': l_config
  }
예제 #2
0
def testLogsToSeti():
  # First three lines are copied from tdg_v0.csv
  csvs = ['testdata/logs_to_seti_csv0.csv']
  # s0. dob: 05/06/1989. gender:f
  # s1. dob: 05/06/1949. gender:m
  s0 = seti.create_seti(19.15, bfs=[('has_bite_dog', 'N')], cfs=[('dob', 26.0)])
  s1 = seti.create_seti(22.51, bfs=[('has_bite_dog', 'N')], cfs=[('dob', 66.0)])

  # Test model gets created and loaded.
  # Test that we can score one example.
  setis = logs_to_seti.generate_seti(csvs, for_test=True)
  wants = [s0, s1]
  for i in xrange(len(setis)):
    assertEquals(str(wants[i]), str(setis[i]))