Coverage for src/meta_learning/__init__.py: 75%
36 statements
« prev ^ index » next coverage.py v7.10.5, created at 2025-09-03 12:49 +0900
« prev ^ index » next coverage.py v7.10.5, created at 2025-09-03 12:49 +0900
1"""
2💰 SUPPORT THIS RESEARCH - PLEASE DONATE! 💰
4🙏 If this library helps your research or project, please consider donating:
5💳 https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WXQKYYKPHWXHS
7Your support makes advanced AI research accessible to everyone! 🚀
9Meta-Learning: Algorithms for Learning-to-Learn
10===============================================
12This package implements meta-learning algorithms including:
13- Test-Time Compute Scaling (Snell et al., 2024)
14- Model-Agnostic Meta-Learning (MAML) and variants
15- Few-Shot Learning architectures
16- Continual and Online Meta-Learning
17- Multi-Modal Meta-Learning
19Based on research analysis of 30+ foundational papers spanning 1987-2025,
20implementing algorithms missing from current library ecosystem.
22🔬 Research Foundation:
23- Test-Time Compute Scaling (Snell et al., 2024): θ* = argmin_θ Σᵢ L(fθ(xᵢ), yᵢ) + λR(θ)
24- Model-Agnostic Meta-Learning (Finn et al., 2017): θ' = θ - α∇θL_τᵢ(fθ)
25- Prototypical Networks (Snell et al., 2017): p(y=k|x) = exp(-d(f(x), cₖ)) / Σₖ' exp(-d(f(x), cₖ'))
26- Matching Networks (Vinyals et al., 2016): ŷ = Σᵢ a(x, xᵢ)yᵢ where a(x, xᵢ) = softmax(c(f(x), g(xᵢ)))
27- Relation Networks (Sung et al., 2018): rᵢⱼ = gφ(C(f(xᵢ), f(xⱼ)))
28- Online Meta-Learning (Finn et al., 2019): Follow-The-Meta-Leader with regret bound O(√T)
30🎯 Key Features:
31- First public implementation of Test-Time Compute Scaling
32- MAML variants including MAML-en-LLM for large language models
33- Few-Shot Learning with multi-scale features
34- Continual Meta-Learning with experience replay
35- Research-accurate implementations of foundational algorithms
37Author: Benedict Chen (benedict@benedictchen.com)
38License: Custom Non-Commercial License with Donation Requirements
39"""
41def _print_attribution():
42 """Print attribution message with donation link"""
43 try:
44 print("\n🧠 Meta-Learning Library - Made possible by Benedict Chen")
45 print(" \\033]8;;mailto:benedict@benedictchen.com\\033\\\\benedict@benedictchen.com\\033]8;;\\033\\\\")
46 print("")
47 print("💰 PLEASE DONATE! Your support keeps this research alive! 💰")
48 print(" 🔗 \\033]8;;https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WXQKYYKPHWXHS\\033\\\\💳 CLICK HERE TO DONATE VIA PAYPAL\\033]8;;\\033\\\\")
49 print("")
50 print(" ☕ Buy me a coffee → 🍺 Buy me a beer → 🏎️ Buy me a Lamborghini → ✈️ Buy me a private jet!")
51 print(" (Start small, dream big! Every donation helps! 😄)")
52 print("")
53 except:
54 print("\\n🧠 Meta-Learning Library - Made possible by Benedict Chen")
55 print(" benedict@benedictchen.com")
56 print("")
57 print("💰 PLEASE DONATE! Your support keeps this research alive! 💰")
58 print(" 💳 PayPal: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WXQKYYKPHWXHS")
59 print("")
60 print(" ☕ Buy me a coffee → 🍺 Buy me a beer → 🏎️ Buy me a Lamborghini → ✈️ Buy me a private jet!")
61 print(" (Start small, dream big! Every donation helps! 😄)")
63# Import meta-learning algorithms with their configuration classes
64from .meta_learning_modules.test_time_compute import (
65 TestTimeComputeScaler,
66 TestTimeComputeConfig,
67 # FIXME Solution Configuration Factories
68 create_process_reward_config,
69 create_consistency_verification_config,
70 create_gradient_verification_config,
71 create_attention_reasoning_config,
72 create_feature_reasoning_config,
73 create_prototype_reasoning_config,
74 create_comprehensive_config,
75 create_fast_config
76)
77# Comprehensive configuration system for ALL FIXME solutions
78from .meta_learning_modules.config_factory import (
79 ComprehensiveMetaLearningConfig,
80 create_all_fixme_solutions_config,
81 create_research_accurate_config,
82 create_performance_optimized_config,
83 create_specific_solution_config,
84 create_modular_config,
85 create_educational_config,
86 get_available_solutions,
87 print_solution_summary,
88 validate_config
89)
90from .meta_learning_modules.maml_variants import MAMLLearner, FirstOrderMAML, MAMLConfig
91from .meta_learning_modules.few_shot_learning import (
92 PrototypicalNetworks,
93 MatchingNetworks,
94 RelationNetworks,
95 PrototypicalConfig,
96 MatchingConfig,
97 RelationConfig
98)
99from .meta_learning_modules.continual_meta_learning import OnlineMetaLearner, ContinualMetaConfig
100from .meta_learning_modules.utils import (
101 MetaLearningDataset,
102 TaskSampler,
103 few_shot_accuracy,
104 adaptation_speed,
105 compute_confidence_interval,
106 compute_confidence_interval_research_accurate,
107 compute_t_confidence_interval,
108 compute_meta_learning_ci,
109 compute_bca_bootstrap_ci,
110 visualize_meta_learning_results,
111 save_meta_learning_results,
112 load_meta_learning_results,
113 TaskConfiguration,
114 EvaluationConfig,
115 # Factory functions for easy configuration
116 create_basic_task_config,
117 create_research_accurate_task_config,
118 create_basic_evaluation_config,
119 create_research_accurate_evaluation_config,
120 create_meta_learning_standard_evaluation_config,
121 evaluate_meta_learning_algorithm
122)
124# Show attribution on library import
125_print_attribution()
127__version__ = "1.1.0"
128__author__ = "Benedict Chen"
129__email__ = "benedict@benedictchen.com"
131# Core meta-learning algorithms and configurations
132__all__ = [
133 # Test-Time Compute (Snell et al., 2024)
134 "TestTimeComputeScaler",
135 "TestTimeComputeConfig",
137 # FIXME Solution Configuration Factories
138 "create_process_reward_config",
139 "create_consistency_verification_config",
140 "create_gradient_verification_config",
141 "create_attention_reasoning_config",
142 "create_feature_reasoning_config",
143 "create_prototype_reasoning_config",
144 "create_comprehensive_config",
145 "create_fast_config",
147 # Comprehensive Configuration System for ALL FIXME Solutions
148 "ComprehensiveMetaLearningConfig",
149 "create_all_fixme_solutions_config",
150 "create_research_accurate_config",
151 "create_performance_optimized_config",
152 "create_specific_solution_config",
153 "create_modular_config",
154 "create_educational_config",
155 "get_available_solutions",
156 "print_solution_summary",
157 "validate_config",
159 # MAML variants
160 "MAMLLearner",
161 "FirstOrderMAML",
162 "MAMLConfig",
164 # Few-shot learning
165 "PrototypicalNetworks",
166 "MatchingNetworks",
167 "RelationNetworks",
168 "PrototypicalConfig",
169 "MatchingConfig",
170 "RelationConfig",
172 # Continual learning
173 "OnlineMetaLearner",
174 "ContinualMetaConfig",
176 # Utilities
177 "MetaLearningDataset",
178 "TaskSampler",
179 "few_shot_accuracy",
180 "adaptation_speed",
181 "compute_confidence_interval",
182 "compute_confidence_interval_research_accurate",
183 "compute_t_confidence_interval",
184 "compute_meta_learning_ci",
185 "compute_bca_bootstrap_ci",
186 "visualize_meta_learning_results",
187 "save_meta_learning_results",
188 "load_meta_learning_results",
189 "TaskConfiguration",
190 "EvaluationConfig",
191 # Factory functions for easy configuration
192 "create_basic_task_config",
193 "create_research_accurate_task_config",
194 "create_basic_evaluation_config",
195 "create_research_accurate_evaluation_config",
196 "create_meta_learning_standard_evaluation_config",
197 "evaluate_meta_learning_algorithm",
198]
200# Package metadata
201ALGORITHMS_IMPLEMENTED = [
202 "Test-Time Compute Scaling (Snell et al., 2024)",
203 "Model-Agnostic Meta-Learning (Finn et al., 2017)",
204 "Prototypical Networks (Snell et al., 2017)",
205 "Matching Networks (Vinyals et al., 2016)",
206 "Relation Networks (Sung et al., 2018)",
207 "Online Meta-Learning (Finn et al., 2019)",
208]
210RESEARCH_PAPERS_BASIS = 30
211IMPLEMENTATION_COVERAGE = "Implements key algorithms missing from existing libraries"
212FRAMEWORK_SUPPORT = ["PyTorch", "HuggingFace Transformers", "Scikit-learn"]
214"""
215💝 Thank you for using this research software! 💝
217📚 If this work contributed to your research, please:
218💳 DONATE: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WXQKYYKPHWXHS
219📝 CITE: Benedict Chen (2025) - Meta-Learning Research Implementation
221Your support enables continued development of AI research tools! 🎓✨
222"""