Exemple #1
0
    ds = Repository.get_instance().get_datasource_by_name(
        'Pima Indians Diabetes')
training_pipeline.add_datasource(ds)

# Add a split
training_pipeline.add_split(RandomSplit(split_map={'train': 0.7, 'eval': 0.3}))

# Add a preprocessing unit
training_pipeline.add_preprocesser(
    StandardPreprocesser(features=[
        'times_pregnant', 'pgc', 'dbp', 'tst', 'insulin', 'bmi', 'pedigree',
        'age'
    ],
                         labels=['has_diabetes'],
                         overwrite={
                             'has_diabetes': {
                                 'transform': [{
                                     'method': 'no_transform',
                                     'parameters': {}
                                 }]
                             }
                         }))

# Add a trainer
training_pipeline.add_trainer(
    TFFeedForwardTrainer(loss='binary_crossentropy',
                         last_activation='sigmoid',
                         output_units=1,
                         metrics=['accuracy'],
                         epochs=20))
        except AlreadyExistsException:
            ds = repo.get_datasource_by_name("my_csv_datasource")

        training_pipeline.add_datasource(ds)

        # Add a split
        training_pipeline.add_split(CategoricalDomainSplit(
            categorical_column="name",
            split_map={'train': ["arnold", "nicholas"], 'eval': ["lülük"]}))

        # Add a preprocessing unit
        training_pipeline.add_preprocesser(
            StandardPreprocesser(
                features=["name", "age"],
                labels=['gpa'],
                overwrite={'gpa': {
                    'transform': [
                        {'method': 'no_transform', 'parameters': {}}]}}
            ))

        # Add a trainer
        training_pipeline.add_trainer(TFFeedForwardTrainer(
            batch_size=1,
            loss='binary_crossentropy',
            last_activation='sigmoid',
            output_units=1,
            metrics=['accuracy'],
            epochs=i))

        # Run the pipeline locally
        training_pipeline.run()