in targeted-marketing-python/build_model.py [0:0]
def create_model(ml, train_ds_id, recipe_fn, name):
"""Creates an ML Model object, which begins the training process.
The quality of the model that the training algorithm produces depends
primarily on the data, but also on the hyper-parameters specified
in the parameters map, and the feature-processing recipe.
"""
model_id = 'ml-' + base64.b32encode(os.urandom(10))
ml.create_ml_model(
MLModelId=model_id,
MLModelName=name + " model",
MLModelType="BINARY", # we're predicting True/False values
Parameters={
# Refer to the "Machine Learning Concepts" documentation
# for guidelines on tuning your model
"sgd.maxPasses": "100",
"sgd.maxMLModelSizeInBytes": "104857600", # 100 MiB
"sgd.l2RegularizationAmount": "1e-4",
},
Recipe=open(recipe_fn).read(),
TrainingDataSourceId=train_ds_id
)
print("Created ML Model %s" % model_id)
return model_id