-
Notifications
You must be signed in to change notification settings - Fork 325
Home
Modular Active Learning framework for Python3
ModAL is an active learning framework for Python3, designed with modularity, flexibility and extensibility in mind. Built on top of scikit-learn, it allows you to rapidly create active learning workflows with nearly complete freedom. What is more, you can easily replace parts with your custom built solutions, allowing you to design novel algorithms with ease.
Let's take a look at a general active learning workflow!
The key components of any workflow are the model you choose, the uncertainty measure you use and the query strategy you apply to request labels. With modAL, instead of choosing from a small set of built-in components, you have the freedom to seamlessly integrate scikit-learn or Keras models into your algorithm and you can easily tailor your custom query strategies and uncertainty measures.
Active learning with a scikit-learn classifier, for instance RandomForestClassifier, can be as simple as the following.
from sklearn.ensemble import RandomForestClassifier
from modAL.models import ActiveLearner
# initializing the learner
learner = ActiveLearner(
predictor=RandomForestClassifier(),
training_data=X_train, training_labels=y_train
)
# the active learning loop
n_loops = 50
for loop_idx in range(n_loops):
# query for labels
query_idx, query_inst = learner.query(X_pool)
# supply label for queried instance
learner.teach(X_pool[query_idx], y_pool[query_idx])