Ejemplo n.º 1
0
                                     'parameters': {}
                                 }]
                             }
                         }))

training_pipeline.add_trainer(
    TFFeedForwardTrainer(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={
                      transformed_label_name('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()

# Another way to do is is to create a DeploymentPipeline.
# Uncomment to create the model via this pipeline
Ejemplo n.º 2
0
                                     'parameters': {}
                                 }]
                             }
                         }))

# Add a trainer
training_pipeline.add_trainer(
    TFFeedForwardTrainer(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']}))

# Run the pipeline locally
training_pipeline.run()

# See schema of data
training_pipeline.view_schema()

# See statistics of train and eval
training_pipeline.view_statistics()

# Creates a notebook for evaluation
training_pipeline.evaluate()
Ejemplo n.º 3
0
    ],
                         labels=['has_diabetes'],
                         overwrite={
                             'has_diabetes': {
                                 'transform': [{
                                     'method': 'no_transform',
                                     'parameters': {}
                                 }]
                             }
                         }))

# Add a trainer
training_pipeline.add_trainer(MyScikitTrainer(
    C=0.8,
    kernel='rbf',
))

# Add an evaluator
label_name = naming_utils.transformed_label_name('has_diabetes')
training_pipeline.add_evaluator(
    AgnosticEvaluator(prediction_key=naming_utils.output_name(label_name),
                      label_key=label_name,
                      slices=[['has_diabetes']],
                      metrics=['mean_squared_error']))

# Run the pipeline locally
training_pipeline.run()

# Evaluate
training_pipeline.evaluate()