Exemple #1
0
training_pipeline.add_evaluator(
    TFMAEvaluator(
        slices=[['has_diabetes']],
        metrics={'has_diabetes': ['binary_crossentropy', 'binary_accuracy']}))

# Add cortex deployer
api_config = {
    "name": CORTEX_MODEL_NAME,
    "kind": "RealtimeAPI",
    "predictor": {
        "type": "tensorflow",
        # Set signature key of the model as we are using Tensorflow Trainer
        "models": {
            "signature_key": "serving_default"
        }
    }
}
training_pipeline.add_deployment(
    CortexDeployer(
        env=CORTEX_ENV,
        api_config=api_config,
        predictor=TensorFlowPredictor,
    ))

# Define the artifact store
artifact_store = ArtifactStore(
    os.path.join(GCP_BUCKET, 'cortex/artifact_store'))

# Run the pipeline
training_pipeline.run(artifact_store=artifact_store)
Exemple #2
0
                             'has_diabetes': {
                                 'transform': [{
                                     'method': 'no_transform',
                                     'parameters': {}
                                 }]
                             }
                         }))

training_pipeline.add_trainer(
    FeedForwardTrainer(loss='binary_crossentropy',
                       last_activation='sigmoid',
                       output_units=1,
                       metrics=['accuracy'],
                       epochs=20))

# Add an evaluator
training_pipeline.add_evaluator(
    TFMAEvaluator(
        slices=[['has_diabetes']],
        metrics={'has_diabetes': ['binary_crossentropy', 'binary_accuracy']}))

# Add the deployer
training_pipeline.add_deployment(
    GCAIPDeployer(
        project_id=GCP_PROJECT,
        model_name=MODEL_NAME,
    ))

# Run the pipeline
training_pipeline.run()