Exemple #1
0
    def test_trainer_ba(self):
        """Test the `data-batch` subcommands."""
        with db.session_scope(META_FILE) as (session, metadata):
            cache = PhenotypeCache()
            cache.make(IMAGE_DIR, TEMP_DIR, self.config, update=False)

            train_data = BatchMakeTrainData(self.config, TEMP_DIR)
            train_data.batch_export(self.train_dir)
Exemple #2
0
    def test_trainer_ab(self):
        """Test the `data` subcommands."""
        filter_ = self.config.classification.filter.as_dict()

        with db.session_scope(META_FILE) as (session, metadata):
            cache = PhenotypeCache()
            cache.make(IMAGE_DIR, TEMP_DIR, self.config, update=False)

            train_data = MakeTrainData(self.config, TEMP_DIR)
            train_data.export(self.train_file, filter_)
Exemple #3
0
def validate(config, k, autoskip=False):
    """Start validation routines."""
    with db.session_scope(META_FILE) as (session, metadata):
        cache = PhenotypeCache()
        cache.make(IMAGE_DIR, TEMP_DIR, config, update=False)

        validator = Validator(config, TEMP_DIR, TEMP_DIR)
        scores = validator.k_fold_xval_stratified(k, autoskip)

    print
    for path in sorted(scores.keys()):
        values = np.array(scores[path])

        print "Accuracy[{path}]: {mean:.2%} (+/- {sd:.2%})".format(**{
            'path': path,
            'mean': values.mean(),
            'sd': values.std() * 2
        })