| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #!/usr/bin/env python3
- """
- Day {{DAY_N}}: {{TOPIC_NAME}}
- The Math Skeleton - Pure numpy/torch operations, no high-level APIs
- Expected functions:
- - def {{function_name}}(): # Your implementation here
- """
- import numpy as np
- import torch
- import matplotlib.pyplot as plt
- from typing import Tuple
- # Configure visualization
- plt.style.use('seaborn-v0_8-darkgrid')
- def {{function_name}}({{parameters}}):
- """
- {{brief_description}}
- Parameters:
- {{param1}}: {{param1_type}} - {{param1_desc}}
- {{param2}}: {{param2_type}} - {{param2_desc}}
- Returns:
- {{return_type}}: {{return_desc}}
- """
- # TODO: Implement the mathematical operation
- # Your math translation here...
- # Example: numpy implementation
- return result
- def plot_concept():
- """
- Visualize the concept with matplotlib.
- Include this in your solution.
- Typical visualizations:
- - Loss contours
- - Activation functions
- - Geometric interpretations
- """
- fig, ax = plt.subplots(figsize=(10, 6))
- # TODO: Add your visualization logic here
- ax.set_xlabel('{{x_label}}')
- ax.set_ylabel('{{y_label}}')
- ax.set_title('{{visualization_title}}')
- ax.legend()
- plt.tight_layout()
- plt.show()
- if __name__ == "__main__":
- # Manual testing
- print(f"Testing Day {{DAY_N}}: {{TOPIC_NAME}}")
- # Test the core function
- result = {{function_name}}()
- print(f"Result: {result}")
- # Run the visualizer
- plot_concept()
|