Enrich

PredictiveModel

Create Manager

from terrene.enrich import PredictiveModelManager

manager = PredictiveModelManager(credentials=credentials, workspace=workspace)

Create

model = manager.create(
    name='my model', description='a short description about my model',
    input_variables='col1, col2, col3, col4', output_variables='col5')

Get

model = mananger.get('uuid')

Query

query_params = {
    'workspace__object_id': '',
    'name': '',
    'description': '',
    'workspace__name': '',
    'workspace__owners__object_id': '',
    'workspace__owners__email': '',
    'workspace__contributors__object_id': '',
    'workspace__contributors__email': ''
}
models = manger.query(query_params)

Update

model.name = 'new name'
model.save()

Train

from terrene.enrich import ModelRuntime, ModelType, ModelOptimizer
model.train(
    transfer=training_dataset, epochs=100, loss=ModelType.regression,
    runtime=ModelRuntime.default, optimizer=ModelOptimizer(type='adam'))

Upload

with open('my-model.h5') as file:
    model.upload(accuracy=1, loss=0, file=file)