ulpc / MWZ-1

제 1회 언더싸롱배 망월장
http://undersalon.com
5 stars 1 forks source link

Learning Machine Learning #31

Open insikk opened 6 years ago

insikk commented 6 years ago
import time

def train(model, dataset):
  time.sleep(3)
  return "some result"

def machine_print(msg):
  print("MACHINE:", msg)

def me_print(msg):
  print("     ME:", msg)

def show_time_progress(sec):
  for sec in range(sec):
    print("{} past...".format(sec))
    time.sleep(1)

def train_model_then_check_result(model, dataset):
  machine_print("train model {}...".format(model))
  result = train(model, dataset)
  result = "my result"
  return result

def is_goal_reached(goal, result):
  if result is None:
    return False
  if reulst == "success":
    return True
  return False

def devise_model_and_dataset(exp_num):
  me_print("prepare next experiment exp{:03d}".format(exp_num))
  show_time_progress(1)
  model = "model{:03d}".format(exp_num)
  dataset = "my dataset {:03d}".format(exp_num)
  return model, dataset

me_print("setup machine for machine training...")
machine_print("cpu ready.")
machine_print("gpu ready.")
goal = "reach accuracy 99% on image search"
me_print("my goal is: {}".format(goal))
exp_num = 0

while is_goal_reached(goal, result):
  model, dataset = devise_model_and_dataset(exp_num)
  result = train_model_then_check_result(model, dataset)
  me_print("learn from result: {}".format(result))
  exp_num += 1
  if exp_num == 5:
    break

by @insikk

I train a machine, and the machine trains... me?