Skip to content
このページはまだお使いの言語に翻訳されていません。英語版を表示しています。

सक्रिय अधिगम (Active Learning)

मूल्यवान उदाहरणों पर annotation को प्राथमिकता देने के लिए uncertainty sampling का उपयोग करें।

सक्रिय अधिगम (Active Learning)

Active learning आपको सबसे अधिक जानकारीपूर्ण उदाहरणों को प्राथमिकता देकर annotation को स्मार्ट बनाने में मदद करता है। यादृच्छिक रूप से annotation करने के बजाय, उन instances पर ध्यान केंद्रित करें जहाँ model सबसे अधिक अनिश्चित है।

यह कैसे काम करता है

Potato का active learning machine learning predictions के आधार पर annotation instances को स्वचालित रूप से पुनः क्रमबद्ध करता है:

  1. प्रारंभिक संग्रह - न्यूनतम संख्या में annotations एकत्र करें
  2. प्रशिक्षण - मौजूदा annotations पर एक classifier प्रशिक्षित करें
  3. पूर्वानुमान - unannotated instances के लिए uncertainty scores प्राप्त करें
  4. पुनः क्रमण - सर्वाधिक uncertainty वाले instances को प्राथमिकता दें
  5. Annotation - Annotators प्राथमिकता प्राप्त instances को label करते हैं
  6. पुनः प्रशिक्षण - नए annotations के साथ model को समय-समय पर अपडेट करें

कॉन्फ़िगरेशन

बुनियादी सेटअप

yaml
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

पूर्ण कॉन्फ़िगरेशन

yaml
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सर्वश्रेष्ठ उपयोगगति
LogisticRegressionBinary/multiclass classificationतीव्र
RandomForestClassifierजटिल patternsमध्यम
SVCछोटे datasetsधीमा
MultinomialNBText classificationअत्यंत तीव्र

Classifier उदाहरण

yaml
# 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.0

Vectorizers

Vectorizerविवरण
TfidfVectorizerTF-IDF weighted features (अनुशंसित)
CountVectorizerसरल word counts
HashingVectorizerबड़े vocabularies के लिए memory-efficient
yaml
# 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: 10000

LLM एकीकरण

Active learning वैकल्पिक रूप से उन्नत instance चयन के लिए LLMs का उपयोग कर सकता है:

yaml
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 के बीच चक्र चला सकता है:

yaml
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: 100

Model Persistence

सर्वर पुनः आरंभ के बाद प्रशिक्षित models को सहेजें और पुनः लोड करें:

yaml
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 प्राप्त करें:

yaml
active_learning:
  enabled: true
  min_instances_for_training: 50  # Wait for 50 annotations

2. उचित Classifiers चुनें

  • LogisticRegression: तीव्र, अधिकांश कार्यों के लिए अच्छा default
  • RandomForest: जटिल patterns के लिए बेहतर, धीमा
  • MultinomialNB: अत्यंत तीव्र, सरल text classification के लिए अच्छा

3. Class वितरण की निगरानी करें

Active learning class imbalance उत्पन्न कर सकता है। Admin dashboard में निगरानी करें और stratified sampling पर विचार करें।

4. उचित Retrain आवृत्ति निर्धारित करें

अत्यधिक बार-बार retraining से संसाधन व्यर्थ होते हैं:

yaml
update_frequency: 100  # Retrain every 100 annotations

5. Model Persistence सक्षम करें

पुनः आरंभ पर scratch से retraining से बचने के लिए models सहेजें:

yaml
model_persistence:
  enabled: true
  save_dir: "models/"

उदाहरण: पूर्ण कॉन्फ़िगरेशन

yaml
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: true

AI Support के साथ संयोजन

Active learning और LLM सहायता दोनों का उपयोग करें:

yaml
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 की समीक्षा करें

आगे पढ़ें

कार्यान्वयन विवरण के लिए, source documentation देखें।