Beispiel #1
0
                      model=LogisticRegression(penalty='l1',
                                               solver='liblinear'),
                      performance_metric='accuracy_score',
                      stopping_criteria='num_of_queries',
                      stopping_value=stop)
al_unc.split_AL(test_ratio=trn_tst_split,
                initial_label_rate=init_labels,
                split_count=splits,
                all_class=True)
al_unc.set_query_strategy(strategy='QueryInstanceUncertainty')
al_unc.set_performance_metric(performance_metric='accuracy_score')
al_unc.start_query(multi_thread=False)
# print(al.get_experiment_result())
# al.plot_learning_curve()
analyser = ExperimentAnalyser(x_axis='num_of_queries')
analyser.add_method('uncertainty', al_unc.get_experiment_result())
al_qbc = AlExperiment(X,
                      y,
                      model=LogisticRegression(penalty='l1',
                                               solver='liblinear'),
                      performance_metric='accuracy_score',
                      stopping_criteria='num_of_queries',
                      stopping_value=stop)
al_qbc.split_AL(test_ratio=trn_tst_split,
                initial_label_rate=init_labels,
                split_count=splits,
                all_class=True)
al_qbc.set_query_strategy(strategy='QueryInstanceQBC')
al_qbc.set_performance_metric(performance_metric='accuracy_score')
al_qbc.start_query(multi_thread=False)
analyser.add_method('by committee', al_qbc.get_experiment_result())
                      label_idx=lab,
                      unlabel_idx=unlab)

    # set the query strategy
    # using the a pre-defined strategy
    al.set_query_strategy(strategy=strategy)

    # or using your own query strategy
    # class my_qs_class:
    #     	def __init__(self, X=None, y=None, **kwargs):
    # 		pass

    # 	def select(self, label_index, unlabel_index, batch_size=1, **kwargs):
    # 		"""Select instances to query."""
    # 		pass
    # al.set_query_strategy(strategy=my_qs_class(), **kwargs)

    # set the metric for experiment.
    al.set_performance_metric('accuracy_score')

    # by default,run in multi-thread.
    al.start_query(multi_thread=False)
    # or execute sequentially
    # al.start_query(multi_thread=False)

    # get the experiemnt result
    stateIO = al.get_experiment_result()

    # get a brief description of the experiment
    # al.plot_learning_curve(title='Alexperiment result')