सक्रिय अधिगम (Active Learning)
मूल्यवान उदाहरणों पर annotation को प्राथमिकता देने के लिए uncertainty sampling का उपयोग करें।
सक्रिय अधिगम (Active Learning)
Active learning आपको सबसे अधिक जानकारीपूर्ण उदाहरणों को प्राथमिकता देकर annotation को स्मार्ट बनाने में मदद करता है। यादृच्छिक रूप से annotation करने के बजाय, उन instances पर ध्यान केंद्रित करें जहाँ model सबसे अधिक अनिश्चित है।
यह कैसे काम करता है
Potato का active learning machine learning predictions के आधार पर annotation instances को स्वचालित रूप से पुनः क्रमबद्ध करता है:
- प्रारंभिक संग्रह - न्यूनतम संख्या में annotations एकत्र करें
- प्रशिक्षण - मौजूदा annotations पर एक classifier प्रशिक्षित करें
- पूर्वानुमान - unannotated instances के लिए uncertainty scores प्राप्त करें
- पुनः क्रमण - सर्वाधिक uncertainty वाले instances को प्राथमिकता दें
- Annotation - Annotators प्राथमिकता प्राप्त instances को label करते हैं
- पुनः प्रशिक्षण - नए annotations के साथ model को समय-समय पर अपडेट करें
कॉन्फ़िगरेशन
बुनियादी सेटअप
active_learning:
enabled: true
schema_names:
- sentiment # Which annotation schemes to use
min_annotations_per_instance: 1
min_instances_for_training: 20
update_frequency: 50 # Retrain after every 50 annotations
max_instances_to_reorder: 1000पूर्ण कॉन्फ़िगरेशन
active_learning:
enabled: true
# Which schemas to use for training
schema_names:
- sentiment
# Minimum requirements
min_annotations_per_instance: 1
min_instances_for_training: 20
# Retraining frequency
update_frequency: 50
# How many instances to reorder
max_instances_to_reorder: 1000
# Classifier configuration
classifier:
type: LogisticRegression
params:
C: 1.0
max_iter: 1000
# Feature extraction
vectorizer:
type: TfidfVectorizer
params:
max_features: 5000
ngram_range: [1, 2]
# Model persistence
model_persistence:
enabled: true
save_dir: "models/"
max_saved_models: 5समर्थित Classifiers
| Classifier | सर्वश्रेष्ठ उपयोग | गति |
|---|---|---|
LogisticRegression | Binary/multiclass classification | तीव्र |
RandomForestClassifier | जटिल patterns | मध्यम |
SVC | छोटे datasets | धीमा |
MultinomialNB | Text classification | अत्यंत तीव्र |
Classifier उदाहरण
# Logistic Regression (recommended starting point)
classifier:
type: LogisticRegression
params:
C: 1.0
max_iter: 1000
# Random Forest
classifier:
type: RandomForestClassifier
params:
n_estimators: 100
max_depth: 10
# Support Vector Classifier
classifier:
type: SVC
params:
kernel: rbf
probability: true
# Naive Bayes
classifier:
type: MultinomialNB
params:
alpha: 1.0Vectorizers
| Vectorizer | विवरण |
|---|---|
TfidfVectorizer | TF-IDF weighted features (अनुशंसित) |
CountVectorizer | सरल word counts |
HashingVectorizer | बड़े vocabularies के लिए memory-efficient |
# TF-IDF (recommended)
vectorizer:
type: TfidfVectorizer
params:
max_features: 5000
ngram_range: [1, 2]
stop_words: english
# Count Vectorizer
vectorizer:
type: CountVectorizer
params:
max_features: 3000
ngram_range: [1, 1]
# Hashing Vectorizer (for large datasets)
vectorizer:
type: HashingVectorizer
params:
n_features: 10000LLM एकीकरण
Active learning वैकल्पिक रूप से उन्नत instance चयन के लिए LLMs का उपयोग कर सकता है:
active_learning:
enabled: true
schema_names:
- sentiment
# LLM-based selection
llm_integration:
enabled: true
endpoint_type: vllm
base_url: http://localhost:8000/v1
model: meta-llama/Llama-2-7b-chat-hf
# Mock mode for testing
mock_mode: falseबहु-Schema समर्थन
Active learning कई annotation schemas के बीच चक्र चला सकता है:
annotation_schemes:
- annotation_type: radio
name: sentiment
labels: [Positive, Negative, Neutral]
- annotation_type: radio
name: topic
labels: [Politics, Sports, Tech, Entertainment]
active_learning:
enabled: true
schema_names:
- sentiment
- topic
# Schema-specific settings
schema_config:
sentiment:
min_instances_for_training: 30
update_frequency: 50
topic:
min_instances_for_training: 50
update_frequency: 100Model Persistence
सर्वर पुनः आरंभ के बाद प्रशिक्षित models को सहेजें और पुनः लोड करें:
active_learning:
enabled: true
schema_names:
- sentiment
model_persistence:
enabled: true
save_dir: "models/"
max_saved_models: 5 # Keep last 5 models
# Save to database instead of files
use_database: falseप्रगति की निगरानी
Admin dashboard active learning मेट्रिक्स को ट्रैक करता है:
- वर्तमान model accuracy
- Training cycle गणना
- Uncertainty वितरण
- शेष instances
- Retraining इतिहास
अपनी admin API key के साथ /admin के माध्यम से एक्सेस करें।
सर्वोत्तम प्रथाएँ
1. यादृच्छिक sampling से शुरू करें
Active learning सक्षम करने से पहले प्रारंभिक annotations प्राप्त करें:
active_learning:
enabled: true
min_instances_for_training: 50 # Wait for 50 annotations2. उचित Classifiers चुनें
- LogisticRegression: तीव्र, अधिकांश कार्यों के लिए अच्छा default
- RandomForest: जटिल patterns के लिए बेहतर, धीमा
- MultinomialNB: अत्यंत तीव्र, सरल text classification के लिए अच्छा
3. Class वितरण की निगरानी करें
Active learning class imbalance उत्पन्न कर सकता है। Admin dashboard में निगरानी करें और stratified sampling पर विचार करें।
4. उचित Retrain आवृत्ति निर्धारित करें
अत्यधिक बार-बार retraining से संसाधन व्यर्थ होते हैं:
update_frequency: 100 # Retrain every 100 annotations5. Model Persistence सक्षम करें
पुनः आरंभ पर scratch से retraining से बचने के लिए models सहेजें:
model_persistence:
enabled: true
save_dir: "models/"उदाहरण: पूर्ण कॉन्फ़िगरेशन
task_name: "Sentiment Analysis with Active Learning"
task_dir: "."
port: 8000
data_files:
- "data/reviews.json"
item_properties:
id_key: id
text_key: text
annotation_schemes:
- annotation_type: radio
name: sentiment
description: "What is the sentiment?"
labels:
- Positive
- Negative
- Neutral
active_learning:
enabled: true
schema_names:
- sentiment
min_annotations_per_instance: 1
min_instances_for_training: 30
update_frequency: 50
max_instances_to_reorder: 500
classifier:
type: LogisticRegression
params:
C: 1.0
max_iter: 1000
vectorizer:
type: TfidfVectorizer
params:
max_features: 3000
ngram_range: [1, 2]
model_persistence:
enabled: true
save_dir: "models/"
max_saved_models: 3
output_annotation_dir: "output/"
output_annotation_format: "json"
allow_all_users: trueAI Support के साथ संयोजन
Active learning और LLM सहायता दोनों का उपयोग करें:
active_learning:
enabled: true
schema_names:
- sentiment
min_instances_for_training: 30
ai_support:
enabled: true
endpoint_type: openai
ai_config:
model: gpt-4
api_key: ${OPENAI_API_KEY}
features:
label_suggestions:
enabled: trueयह संयोजन अनिश्चित instances को प्राथमिकता देते हुए annotators की मदद के लिए AI hints प्रदान करता है।
समस्या निवारण
Training विफलताएँ
- पर्याप्त annotations सुनिश्चित करें (
min_instances_for_training) - Class वितरण जांचें - सभी classes के उदाहरणों की आवश्यकता है
- Data format schema से मेल खाता है यह सत्यापित करें
धीमा प्रदर्शन
max_instances_to_reorderकम करेंupdate_frequencyबढ़ाएँ- बड़े vocabularies के लिए
HashingVectorizerका उपयोग करें
Model अपडेट नहीं हो रहा
update_frequencyसेटिंग जांचें- सत्यापित करें कि annotations सहेजे जा रहे हैं
- Errors के लिए admin dashboard की समीक्षा करें
आगे पढ़ें
- AI Support - LLM-assisted annotation
- Task Assignment - Assignment strategies
- Admin Dashboard - Active learning metrics की निगरानी करें
कार्यान्वयन विवरण के लिए, source documentation देखें।