MCPcopy Create free account
hub / github.com/modAL-python/modAL / alp_QBC

Function alp_QBC

examples/runtime_comparison.py:177–192  ·  view source on GitHub ↗
(X, y, n_queries)

Source from the content-addressed store, hash-verified

175
176@timeit()
177def alp_QBC(X, y, n_queries):
178 X_labeled, y_labeled = X[[0, 50, 100]], y[[0, 50, 100]]
179 estimators = [LogisticRegression(solver='liblinear', n_jobs=1, multi_class='ovr'),
180 LogisticRegression(solver='liblinear', n_jobs=1, multi_class='ovr')]
181
182 for estimator in estimators:
183 estimator.fit(X_labeled, y_labeled)
184
185 learner = ActiveLearnerALP(strategy='vote_entropy')
186
187 for _ in range(n_queries):
188 query_idx = learner.rank(estimators, X, num_queries=1)
189 X_labeled = np.concatenate((X_labeled, X[query_idx]), axis=0)
190 y_labeled = np.concatenate((y_labeled, y[query_idx]), axis=0)
191 for estimator in estimators:
192 estimator.fit(X_labeled, y_labeled)
193
194
195def comparisons(n_queries=10):

Callers 1

comparisonsFunction · 0.85

Calls 1

fitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…