#!/usr/bin/env python

# A sample training component that trains a simple scikit-learn decision tree model.
# This implementation works in File mode and makes no assumptions about the input file names.
# Input is specified as CSV with a data point in each row and the labels in the first column.

import sys
import shutil, os

prefix = '/opt/ml/'

input_path = prefix + 'input/data/training'
model_path = os.path.join(prefix, 'model')

# # This algorithm has a single channel of input data called 'training'. Since we run in
# # File mode, the input files are copied to the directory specified here.
# channel_name='training'
# training_path = os.path.join(input_path, channel_name)

# The function to execute the training.
def train():
    files = [input_path + '/model.h5', input_path + '/model.json']
    for f in files:
        shutil.copy(f, model_path)
    return
if __name__ == '__main__':
    train()

    # A zero exit code causes the job to be marked a Succeeded.
    sys.exit(0)
