diff --git a/docs/courses/data-science/2.1-single-objective.md b/docs/courses/data-science/2.1-single-objective.md index 9010958..8534595 100644 --- a/docs/courses/data-science/2.1-single-objective.md +++ b/docs/courses/data-science/2.1-single-objective.md @@ -1,21 +1,42 @@ # 🧩 2.1 Single-objective Optimization -% ```{contents} -% :depth: 2 -% ``` +##�� Learning Objectives +- Understand the fundamentals of Bayesian Optimization (BO) +- Learn to implement single-objective optimization using Honegumi +- Master practical aspects of experimental optimization +- Develop skills in model validation and analysis -## 🔰 Tutorial +## 🔰 Tutorial Materials +### 1. Video Tutorial ✅ Watch [the portion about real-world Bayesian optimization and honegumi](https://youtu.be/IVaWl2tL06c?si=KQYNfAVw9f0AK-Ip&t=1874) from "A Gentle Introduction to Bayesian Optimization".
-✅ Read through the homepage of -[Honegumi](https://honegumi.readthedocs.io/en/latest/), a Bayesian optimization -template generator. This tool will be used at various points during the course -to help with demonstrating advanced optimization topics. +### 2. Key Concepts + +#### Bayesian Optimization Fundamentals +- Surrogate model (Gaussian Process) +- Acquisition functions +- Exploration vs. exploitation trade-off +- Sequential decision making + +#### Practical Implementation +- Parameter space definition +- Constraint handling +- Experimental budget management +- Model validation techniques + +### 3. Tools and Framework +✅ Read through the [Honegumi documentation](https://honegumi.readthedocs.io/en/latest/): +- Framework overview +- Template generation +- Configuration options +- Best practices + +## 💻 Hands-on Tutorial :::{grid-item-card} Coding Tutorial Optimizing a 3D Printed Material for Strength Under Constraints @@ -28,28 +49,53 @@ Coding Tutorial ``` ::: -## 🚀 Quiz +### Step-by-Step Guide +1. Environment Setup + - Installing required packages + - Configuring development environment + +2. Problem Definition + - Defining parameter space + - Setting up constraints + - Creating objective function + +3. Optimization Implementation + - Using Honegumi templates + - Configuring AxClient + - Running experiments + +4. Results Analysis + - Model validation + - Feature importance analysis + - Visualization techniques + +## 📚 Additional Resources +### Documentation +- [Ax Platform Documentation](https://ax.dev/) +- [BoTorch Tutorials](https://botorch.org/tutorials/) +- [Gaussian Processes for Machine Learning](http://gaussianprocess.org/gpml/) + +### Research Papers +- ["A Tutorial on Bayesian Optimization"](https://arxiv.org/abs/1807.02811) +- ["Practical Bayesian Optimization of Machine Learning Algorithms"](https://papers.nips.cc/paper/2012/hash/05311655a15b75fab86956663e1819cd-Abstract.html) + +## 🚀 Quiz ::::{tab-set} :sync-group: category :::{tab-item} Sp/Su 2024 :sync: sp2024 - https://q.utoronto.ca/courses/370068/assignments/1327549 ::: - :::: ## 📄 Assignment - ::::{tab-set} :sync-group: category :::{tab-item} Sp/Su 2024 :sync: sp2024 - https://q.utoronto.ca/courses/370068/assignments/1327550 ::: - :::: diff --git a/docs/courses/data-science/2.2-multi-objective.md b/docs/courses/data-science/2.2-multi-objective.md index fd84cb9..a60e05a 100644 --- a/docs/courses/data-science/2.2-multi-objective.md +++ b/docs/courses/data-science/2.2-multi-objective.md @@ -1,36 +1,99 @@ # 🧩 2.2 Multi-objective Optimization -% ```{contents} -% :depth: 2 -% ``` +##�� Learning Objectives -## 🔰 Tutorial +After completing this tutorial, you will be able to: +1. Understand the difference between single- and multi-objective optimization +2. Apply Bayesian optimization to multi-objective problems +3. Interpret Pareto fronts and trade-offs +4. Implement constraints in multi-objective optimization -% TODO: Add side-by-side buttons! +## 🔰 Tutorial Materials ::::{grid} 1 2 2 2 -:::{grid-item-card} Concept Doc -Single- vs. Multi-objective Optimization +:::{grid-item-card} Concept Documentation +**Single- vs. Multi-objective Optimization** + +Key concepts covered: +- Trade-offs between competing objectives +- Pareto optimality +- Dominated vs non-dominated solutions +- Visualization of Pareto fronts + +++ ```{button-link} https://honegumi.readthedocs.io/en/latest/curriculum/concepts/sobo-vs-mobo/sobo-vs-mobo.html :color: info :expand: :click-parent: -Concept Doc +Read Concepts ``` ::: -:::{grid-item-card} Coding Tutorial -Multi Objective Optmization of Polymers for Strength and Biodegradability + +:::{grid-item-card} Hands-on Tutorial +**Multi-objective Optimization of Polymers** + +Practice exercises: +- Setting up optimization parameters +- Defining multiple objectives +- Adding constraints +- Analyzing Pareto optimal solutions +- Visualizing results + +++ ```{button-link} https://honegumi.readthedocs.io/en/latest/curriculum/tutorials/mobo/mobo.html :color: info :expand: :click-parent: -Coding Tutorial +Start Tutorial ``` ::: :::: +## 📚 Additional Resources + +### Key Concepts Review +1. **Pareto Optimality** + - Definition and importance + - How to identify Pareto optimal solutions + - Real-world applications + +2. **Trade-off Analysis** + - Understanding competing objectives + - Quantifying trade-offs + - Making informed decisions + +3. **Constraint Handling** + - Types of constraints + - Implementation strategies + - Impact on optimization + +### Honegumi Tools +1. **Optimization Setup** + ```python + from honegumi import MultiObjectiveOptimizer + + # Example setup + optimizer = MultiObjectiveOptimizer( + parameters=[...], + objectives=[...], + constraints=[...] + ) + ``` + +2. **Visualization Functions** + ```python + # Example visualization + optimizer.plot_pareto_front() + optimizer.plot_parallel_coordinates() + ``` + +3. **Results Analysis** + ```python + # Example analysis + optimal_points = optimizer.get_pareto_optimal() + trade_offs = optimizer.compute_trade_offs() + ``` + ## 🚀 Quiz ::::{tab-set} @@ -39,11 +102,37 @@ Coding Tutorial :::{tab-item} Sp/Su 2024 :sync: sp2024 -https://q.utoronto.ca/courses/370068/assignments/1327551 +Test your understanding: +- [Practice Quiz](https://q.utoronto.ca/courses/370068/assignments/1327551) +- Focus on concepts and implementation ::: :::: +## 📝 Pre-assignment Checklist + +Before starting the assignment, ensure you: + +1. **Understand Core Concepts** + - [ ] Pareto optimality + - [ ] Trade-off analysis + - [ ] Constraint implementation + +2. **Complete Tutorial** + - [ ] Read concept documentation + - [ ] Follow hands-on tutorial + - [ ] Test example code + +3. **Setup Environment** + - [ ] Install required packages + - [ ] Test Honegumi installation + - [ ] Verify visualization tools + +4. **Review Examples** + - [ ] Multi-objective optimization setup + - [ ] Constraint definition + - [ ] Results analysis + ## 📄 Assignment ::::{tab-set} @@ -52,7 +141,9 @@ https://q.utoronto.ca/courses/370068/assignments/1327551 :::{tab-item} Sp/Su 2024 :sync: sp2024 -https://q.utoronto.ca/courses/370068/assignments/1327552 +Ready for the challenge? +- [Assignment Link](https://q.utoronto.ca/courses/370068/assignments/1327552) +- Apply concepts to real-world epoxy optimization ::: :::: diff --git a/docs/courses/data-science/2.3-batch.md b/docs/courses/data-science/2.3-batch.md index 24a0a89..3ed8e00 100644 --- a/docs/courses/data-science/2.3-batch.md +++ b/docs/courses/data-science/2.3-batch.md @@ -1,13 +1,56 @@ # 🧩 2.3 Batch Optimization -% ```{contents} -% :depth: 2 -% ``` +## 📚 Learning Objectives -## 🔰 Tutorial +After completing this module, you should be able to: +- Understand the principles of batch optimization +- Implement batch-based Bayesian optimization +- Handle constraints in optimization problems +- Analyze optimization results effectively + +## 🔰 Prerequisites + +### Required Knowledge +- Basic understanding of Gaussian Processes +- Familiarity with Python programming +- Understanding of optimization concepts + +### Required Packages +```python +ax-platform>=0.3.0 # For Bayesian optimization +numpy>=1.20.0 # For numerical operations +pandas>=1.3.0 # For data manipulation +scipy>=1.7.0 # For scientific computing +``` + +## 📖 Core Concepts + +### Batch Optimization +Batch optimization allows for parallel evaluation of multiple design points, which is particularly useful when: +- Experiments are time-consuming +- Multiple samples can be processed simultaneously +- Resource constraints exist + +### Key Components +1. **Sampling Strategies** + - Initial Sobol sampling for exploration + - Batch Thompson sampling for exploitation + - Trade-off between exploration and exploitation + +2. **Constraint Handling** + - Device/system constraints + - Parameter bounds + - Feasibility checks + +3. **Performance Metrics** + - Optimization convergence + - Batch diversity + - Constraint satisfaction + +## 🔰 Tutorial Resources ::::{grid} 1 2 3 3 -:::{grid-item-card} Concept Doc \#1 +:::{grid-item-card} Concept Doc #1 Frequentist Vs. Fully Bayesian Gaussian Process Models +++ ```{button-link} https://honegumi.readthedocs.io/en/latest/curriculum/concepts/freq-vs-bayes/freq-vs-bayes.html @@ -17,7 +60,7 @@ Frequentist Vs. Fully Bayesian Gaussian Process Models Concept Doc ``` ::: -:::{grid-item-card} Concept Doc \#2 +:::{grid-item-card} Concept Doc #2 Single vs. Batch Optimization +++ ```{button-link} https://honegumi.readthedocs.io/en/latest/curriculum/concepts/batch/single-vs-batch.html @@ -39,6 +82,42 @@ Coding Tutorial ::: :::: +## 💡 Implementation Tips + +### Best Practices +1. **Parameter Setup** + - Validate parameter ranges + - Check for constraint feasibility + - Use appropriate data types + +2. **Optimization Process** + ```python + # Example structure + for batch in range(n_batches): + # Get next batch of parameters + parameters = get_next_batch() + + # Check constraints + validate_constraints(parameters) + + # Run experiments + results = run_batch_experiments(parameters) + + # Update model + update_optimization_model(results) + ``` + +3. **Results Analysis** + - Track convergence + - Monitor constraint violations + - Analyze batch diversity + +### Common Pitfalls +- Not handling constraints properly +- Insufficient initial exploration +- Poor parameter scaling +- Inadequate error handling + ## 🚀 Quiz ::::{tab-set} @@ -64,3 +143,33 @@ https://q.utoronto.ca/courses/370068/assignments/1327554 ::: :::: + +## 📚 Additional Resources + +### Reference Materials +- [Ax Platform Documentation](https://ax.dev/) +- [BoTorch Tutorials](https://botorch.org/tutorials/) +- [Bayesian Optimization Book](https://bayesoptbook.com/) + +### Related Topics +- Multi-objective optimization +- Constrained Bayesian optimization +- Sequential vs. batch sampling strategies + +## 🤔 FAQ + +1. **Q: Why use batch optimization?** + A: Batch optimization is efficient when experiments are time-consuming and multiple trials can be run in parallel. + +2. **Q: How to handle failed experiments?** + A: Implement proper error handling and consider using robust optimization strategies. + +3. **Q: What's the optimal batch size?** + A: It depends on your resources and the trade-off between exploration and exploitation. + +## 📝 Notes + +- Keep track of all experimental results +- Document any deviations from expected behavior +- Consider the computational cost of optimization +- Validate results against physical constraints diff --git a/docs/courses/data-science/2.5-multi-task.md b/docs/courses/data-science/2.5-multi-task.md index 0a68e65..7150412 100644 --- a/docs/courses/data-science/2.5-multi-task.md +++ b/docs/courses/data-science/2.5-multi-task.md @@ -1,11 +1,23 @@ -# 🧩 2.5 Multi-fidelity Optimization +# 🧩 2.5 Multi-task Optimization ```{contents} :depth: 2 ``` +## 📚 Introduction + +Multi-task Bayesian optimization (MTBO) is a powerful extension of traditional Bayesian optimization that allows us to simultaneously optimize related but distinct tasks. This approach is particularly valuable when we have multiple related optimization problems that share some underlying structure, but may have different optimal solutions. + ## 🔰 Tutorial +The following tutorial demonstrates how to implement multi-task Bayesian optimization using the Ax platform. We'll use two related objective functions: the standard Branin function and a shifted/inverted version of it, representing two different but related tasks. + +Key Components: +- Task encoding transforms +- Generation strategy setup +- Multi-task parameter configuration +- Alternating optimization between tasks + Run the following in an interpreter of your choice (`pip install ax-platform`). ```python @@ -116,6 +128,22 @@ print(f"Objective for task A: {objective_A}") print(f"Objective for task B: {objective_B}") ``` +## 💡 Key Concepts + +1. **Task Parameters**: Special parameters that identify which task is being optimized +2. **Transform Functions**: Help the model understand relationships between tasks +3. **Generation Strategy**: Combines initial exploration with model-based optimization +4. **Fixed Features**: Allow us to specify which task to optimize in each iteration + +## 🔑 Best Practices + +When implementing multi-task optimization: +1. Ensure tasks are genuinely related +2. Balance experiments between tasks +3. Consider using task-specific constraints +4. Monitor performance differences between tasks +5. Validate transfer learning benefits + ::::{grid} 1 2 2 2 :::{grid-item-card} Concept Doc Multitask Bayesian Optimization @@ -164,3 +192,9 @@ https://q.utoronto.ca/courses/370068/assignments/1327558 ::: :::: + +## 📌 Additional Resources + +- [BoTorch Multi-task GP Documentation](https://botorch.org/tutorials/multi_task_gp) +- [Ax Platform Examples](https://ax.dev/tutorials/multitask.html) +- [Multi-task Bayesian Optimization Research Paper](https://proceedings.neurips.cc/paper/2011/file/f3f1b7fc5a8779a9e618e1f23a7b7860-Paper.pdf) diff --git a/docs/courses/hello-world/1.5-data-logging.md b/docs/courses/hello-world/1.5-data-logging.md index 26d1b99..ad479dd 100644 --- a/docs/courses/hello-world/1.5-data-logging.md +++ b/docs/courses/hello-world/1.5-data-logging.md @@ -1,7 +1,4 @@ -# 🧩 1.5 Logging Data - -% ```{rubric} 🧩 1.5 Logging Data -% ``` +# �� 1.5 Logging Data ```{contents} :depth: 3 @@ -10,10 +7,10 @@ ## 🔰 Tutorial ```{warning} -As a temporary workaround to the issue described in https://github.com/orgs/micropython/discussions/15112, add [`urequests_2.py`](https://github.com/AccelerationConsortium/ac-microcourses/blob/main/docs/courses/hello-world/urequests_2.py) [[permalink](https://github.com/AccelerationConsortium/ac-microcourses/blob/e5541ce3ec307a8e5e0f2b20f000c03f040e1f56/docs/courses/hello-world/urequests_2.py)] to your microcontroller, and change `import urequests` to `import urequests_2 as urequests` in the code below. See https://github.com/orgs/micropython/discussions/15112 and https://github.com/micropython/micropython-lib/pull/861 for ongoing updates. The corresponding assignment will also be affected, but this can be addressed using the same workaround. +As a temporary workaround to the issue described in https://github.com/orgs/micropython/discussions/15112, add [`urequests_2.py`](https://github.com/AccelerationConsortium/ac-microcourses/blob/main/docs/courses/hello-world/urequests_2.py) to your microcontroller, and change `import urequests` to `import urequests_2 as urequests` in the code below. ``` -In this tutorial, you will learn how to upload data to a MongoDB database directly from a microcontroller and read data from a database using Python. +In this tutorial, you will learn how to upload data to a MongoDB database from a microcontroller and read data from a database using Python with PyMongo.