def build_correct_setup():
    search_space = search_spaces.TextClassifierSearchSpace()
    search_strategy = search_strategies.RandomSearch()
    search_space.add_budget(param.Budget.GENERATIONS, 10)
    search_space.add_evaluation_metric(param.EvaluationMetric.MICRO_F1_SCORE)
    search_space.add_optimization_value(param.OptimizationValue.DEV_SCORE)
    search_space.add_parameter(param.ModelTrainer.LEARNING_RATE,
                               options=[0.01, 0.05, 0.1])
    search_space.add_parameter(param.DocumentRNNEmbeddings.HIDDEN_SIZE,
                               options=[128, 256, 512])
    search_space.add_parameter(param.DocumentRNNEmbeddings.WORD_EMBEDDINGS,
                               options=[['glove'], ['en'], ['en', 'glove']])
    return search_space, search_strategy
示例#2
0
from FlairParamOptimizer import search_strategies, search_spaces, orchestrator
import FlairParamOptimizer.parameter_listings.parameters_for_user_input as param
from flair.embeddings import WordEmbeddings

from flair.datasets import WNUT_17

corpus = WNUT_17()

search_space = search_spaces.SequenceTaggerSearchSpace()
search_strategy = search_strategies.RandomSearch()

search_space.add_tag_type("ner")

search_space.add_budget(param.Budget.TIME_IN_H, 24)
search_space.add_evaluation_metric(param.EvaluationMetric.MICRO_F1_SCORE)
search_space.add_optimization_value(param.OptimizationValue.DEV_SCORE)
search_space.add_max_epochs_per_training_run(25)

search_space.add_parameter(param.SequenceTagger.HIDDEN_SIZE,
                           options=[128, 256, 512])
search_space.add_parameter(param.SequenceTagger.DROPOUT,
                           options=[0, 0.1, 0.2, 0.3])
search_space.add_parameter(param.SequenceTagger.WORD_DROPOUT,
                           options=[0, 0.01, 0.05, 0.1])
search_space.add_parameter(param.SequenceTagger.RNN_LAYERS,
                           options=[2, 3, 4, 5, 6])
search_space.add_parameter(param.SequenceTagger.USE_RNN, options=[True, False])
search_space.add_parameter(param.SequenceTagger.USE_CRF, options=[True, False])
search_space.add_parameter(param.SequenceTagger.REPROJECT_EMBEDDINGS,
                           options=[True, False])
search_space.add_parameter(