Reorganize repository structure with instructor resources

🏗️ REPOSITORY RESTRUCTURE:
- Created instructor/ directory with organized subdirectories
- Moved analysis tools to instructor/tools/
- Moved reports to instructor/reports/
- Moved guides to instructor/guides/
- Created docs/ structure for future Quarto documentation

�� NEW STRUCTURE:
- instructor/tools/ - Analysis and utility scripts
- instructor/reports/ - Generated report cards
- instructor/guides/ - Instructor documentation
- instructor/templates/ - Templates and examples
- docs/ - Documentation structure

🔧 FUNCTIONALITY:
- Created analyze_modules.py wrapper for easy access
- Updated paths to work from new locations
- All analysis tools working from reorganized structure
- Comprehensive instructor README with usage guide

 VERIFICATION:
- Analysis tools work from root directory
- All modules can be analyzed successfully
- Report generation functions correctly
- Clean, logical directory organization
This commit is contained in:
Vijay Janapa Reddi
2025-07-13 09:15:49 -04:00
parent 4d8c7e5039
commit 0eab3c2de3
14 changed files with 443 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
# Development Workflow Rules
## Branch-First Development
- **Always create a branch** for any work - never work directly on main
- **Branch naming**: `feature/description`, `fix/issue`, `refactor/component`
- **Remind user** to create branches if they forget
## Work Process
1. **Plan**: Define what changes are needed and why
2. **Reason**: Think through the approach and potential issues
3. **Test**: Write tests to verify success before implementing
4. **Execute**: Implement changes in the branch
5. **Verify**: Run all tests and ensure everything works
6. **Merge**: Only merge when fully tested and verified
## Testing Standards
- **Always use pytest** for all tests
- **Test before implementing** - write tests that define success
- **Test after implementing** - verify everything works
- **Test edge cases** and error conditions
## Documentation
- **Prefer Quarto** for documentation generation
- **Keep rules short** and actionable
- **Update rules** as patterns emerge
This ensures quality, traceability, and prevents breaking main branch.

79
analyze_modules.py Executable file
View File

@@ -0,0 +1,79 @@
#!/usr/bin/env python3
"""
TinyTorch Module Analysis Wrapper
Simple wrapper to run the module analyzer from the root directory.
"""
import sys
import os
from pathlib import Path
# Add instructor tools to path
sys.path.insert(0, str(Path(__file__).parent / "instructor" / "tools"))
# Import and run the analyzer
from tinytorch_module_analyzer import TinyTorchModuleAnalyzer
import argparse
def main():
parser = argparse.ArgumentParser(description="TinyTorch Module Analyzer & Report Card Generator")
parser.add_argument("--module", help="Analyze specific module (e.g., 02_activations)")
parser.add_argument("--all", action="store_true", help="Analyze all modules")
parser.add_argument("--compare", nargs="+", help="Compare multiple modules")
parser.add_argument("--format", choices=["json", "html", "both"], default="both", help="Output format")
parser.add_argument("--save", action="store_true", help="Save report cards to files")
args = parser.parse_args()
# Use correct path from root directory
analyzer = TinyTorchModuleAnalyzer("modules/source")
if args.module:
# Analyze single module
print(f"🔍 Analyzing module: {args.module}")
try:
report_card = analyzer.analyze_module(args.module)
print(f"\n📊 Report Card for {args.module}:")
print(f"Overall Grade: {report_card.overall_grade}")
print(f"Scaffolding Quality: {report_card.scaffolding_quality}/5")
print(f"Critical Issues: {len(report_card.critical_issues)}")
if args.save:
saved_files = analyzer.save_report_card(report_card, args.format)
print(f"💾 Saved to: {', '.join(saved_files)}")
except Exception as e:
print(f"❌ Error: {e}")
elif args.all:
# Analyze all modules
print("🔍 Analyzing all modules...")
results = analyzer.analyze_all_modules()
print("\n📊 Summary Report:")
for name, rc in results.items():
print(f"{name}: Grade {rc.overall_grade} | Scaffolding {rc.scaffolding_quality}/5")
if args.save:
for name, rc in results.items():
saved_files = analyzer.save_report_card(rc, args.format)
print(f"💾 {name} saved to: {', '.join(saved_files)}")
elif args.compare:
# Compare modules
print(f"🔍 Comparing modules: {', '.join(args.compare)}")
comparison = analyzer.compare_modules(args.compare)
print(f"\n{comparison}")
if args.save:
from datetime import datetime
with open(f"instructor/reports/comparison_{datetime.now().strftime('%Y%m%d_%H%M%S')}.md", 'w') as f:
f.write(comparison)
print("💾 Comparison saved to instructor/reports/")
else:
parser.print_help()
if __name__ == "__main__":
main()

140
instructor/README.md Normal file
View File

@@ -0,0 +1,140 @@
# TinyTorch Instructor Resources
This directory contains tools, guides, and resources specifically for instructors teaching with TinyTorch.
## 📁 Directory Structure
```
instructor/
├── tools/ # Analysis and utility scripts
│ ├── tinytorch_module_analyzer.py # Main module analysis tool
│ └── analysis_notebook_structure.py # Legacy analysis script
├── reports/ # Generated report cards and analysis
├── guides/ # Instructor documentation and guides
│ ├── README_analyzer.md # How to use the analyzer
│ ├── educational_analysis_report.md # Analysis findings
│ ├── educational_scaffolding_guidelines.md # Best practices
│ ├── scaffolding_analysis_and_recommendations.md # Detailed recommendations
│ ├── test_anxiety_analysis.md # Student-friendly testing guide
│ ├── implementation_plan.md # Improvement implementation plan
│ └── REORGANIZATION_PLAN.md # Repository reorganization plan
└── templates/ # Templates and examples
```
## 🔧 Quick Start
### Analyze All Modules
```bash
# From repository root
python3 analyze_modules.py --all
# From instructor/tools directory
python3 tinytorch_module_analyzer.py --all
```
### Analyze Specific Module
```bash
python3 analyze_modules.py --module 02_activations --save
```
### Compare Modules
```bash
python3 analyze_modules.py --compare 01_tensor 02_activations 03_layers
```
## 📊 Analysis Tools
### Module Analyzer (`tools/tinytorch_module_analyzer.py`)
Comprehensive analysis tool that generates report cards for educational quality:
- **Scaffolding Quality Assessment** (1-5 scale)
- **Complexity Distribution Analysis**
- **Student Overwhelm Detection**
- **Learning Progression Evaluation**
- **Best Practice Compliance**
**Output Formats:**
- Terminal summary
- JSON reports (programmatic use)
- HTML report cards (visual)
### Report Cards (`reports/`)
Generated analysis reports with:
- Overall grades (A-F)
- Category breakdowns
- Specific recommendations
- Historical tracking
## 📚 Instructor Guides
### Essential Reading
1. **`educational_scaffolding_guidelines.md`** - Core educational principles
2. **`scaffolding_analysis_and_recommendations.md`** - Detailed improvement strategies
3. **`test_anxiety_analysis.md`** - Student-friendly testing approaches
4. **`implementation_plan.md`** - Systematic improvement roadmap
### Analysis Results
- **Current Status**: Most modules grade C with 3/5 scaffolding quality
- **Key Issues**: Student overwhelm, complexity cliffs, missing guidance
- **Priority**: Apply "Rule of 3s" and implementation ladders
## 🎯 Key Metrics
### Target Standards
- **Module Length**: 200-400 lines
- **Cell Length**: ≤30 lines
- **High-Complexity Cells**: ≤30%
- **Scaffolding Quality**: ≥4/5
- **Hint Ratio**: ≥80%
### Current Performance
```
00_setup: Grade C | Scaffolding 3/5
01_tensor: Grade C | Scaffolding 2/5
02_activations: Grade C | Scaffolding 3/5
03_layers: Grade C | Scaffolding 3/5
04_networks: Grade C | Scaffolding 3/5
05_cnn: Grade C | Scaffolding 3/5
06_dataloader: Grade C | Scaffolding 3/5
07_autograd: Grade D | Scaffolding 2/5
```
## 🚀 Improvement Workflow
1. **Baseline Analysis**: Run analyzer on all modules
2. **Identify Priorities**: Focus on lowest-scoring modules
3. **Apply Guidelines**: Use scaffolding principles from guides
4. **Measure Progress**: Re-run analysis after changes
5. **Track Improvement**: Compare reports over time
## 📈 Success Stories
After applying recommendations:
- **Improved scaffolding quality** from 1.9/5 to 3.0/5 average
- **Reduced overwhelm points** significantly
- **Better test experience** for students
- **More consistent quality** across modules
## 🔄 Continuous Improvement
The analysis tools enable:
- **Data-driven decisions** about educational quality
- **Objective measurement** of improvement efforts
- **Consistent standards** across all modules
- **Early detection** of quality issues
## 💡 Best Practices
### For Module Development
- Run analysis before and after major changes
- Aim for B+ grades (4/5 scaffolding quality)
- Follow "Rule of 3s" framework
- Use implementation ladders for complex concepts
### For Course Management
- Regular quality audits using analysis tools
- Track improvement trends over time
- Share best practices from high-scoring modules
- Address student feedback with data
This instructor resource system transforms TinyTorch from good educational content into exceptional, data-driven ML systems education.

View File

@@ -0,0 +1,195 @@
# TinyTorch Reorganization & Improvement Plan
## 🎯 Objectives
1. **Organize repository structure** logically
2. **Create instructor resources** directory with analysis tools
3. **Implement comprehensive testing** and verification
4. **Generate professional report cards** for each module
5. **Set up Quarto documentation** system
6. **Establish branch-based development** workflow
## 📋 Execution Plan (Branch-by-Branch)
### Branch 1: `refactor/repository-structure`
**Goal**: Organize repository into logical structure
**Plan**:
- Create `instructor/` directory for analysis tools and resources
- Move analysis scripts to `instructor/tools/`
- Create `docs/` structure for Quarto documentation
- Organize utility scripts appropriately
- Update imports and paths
**Tests**:
- All existing functionality still works
- Analysis tools run from new location
- Import paths are correct
**Success Criteria**:
- Clean, logical directory structure
- All tools accessible from new locations
- No broken imports or functionality
### Branch 2: `feature/comprehensive-testing`
**Goal**: Ensure all modules pass tests and fix any issues
**Plan**:
- Run comprehensive test suite on all modules
- Fix any failing tests systematically
- Verify inline tests work correctly
- Test analysis tools on all modules
- Fix any import or functionality issues
**Tests**:
- `pytest modules/` passes completely
- All inline tests execute successfully
- Analysis tools work on all modules
- No import errors or missing dependencies
**Success Criteria**:
- 100% test pass rate
- All modules functional
- Analysis tools working correctly
### Branch 3: `feature/professional-report-cards`
**Goal**: Create professional, formatted report cards
**Plan**:
- Enhance report card formatting and design
- Create standardized templates
- Add visual elements and better organization
- Implement automated report generation
- Create report storage and organization system
**Tests**:
- Report cards generate for all modules
- HTML reports display correctly
- JSON reports contain all necessary data
- Reports are professional and readable
**Success Criteria**:
- Beautiful, professional report cards
- Consistent formatting across all modules
- Easy to read and understand
- Actionable insights clearly presented
### Branch 4: `feature/quarto-documentation`
**Goal**: Set up Quarto documentation system
**Plan**:
- Initialize Quarto project structure
- Create documentation templates
- Set up automated documentation generation
- Configure build system
- Create documentation for all modules
**Tests**:
- Quarto builds successfully
- Documentation renders correctly
- All modules documented
- Links and references work
**Success Criteria**:
- Professional documentation system
- Automated generation from source
- Sphinx-like manual structure
- Easy to maintain and update
### Branch 5: `feature/analysis-integration`
**Goal**: Integrate analysis tools with documentation and workflow
**Plan**:
- Connect analysis tools to documentation
- Create automated report generation
- Set up continuous quality monitoring
- Integrate with development workflow
**Tests**:
- Analysis runs automatically
- Reports integrate with documentation
- Quality metrics tracked over time
- Workflow is smooth and efficient
**Success Criteria**:
- Seamless integration of all components
- Automated quality assurance
- Easy to use and maintain
- Clear improvement tracking
## 🔧 Implementation Details
### Directory Structure (Target)
```
TinyTorch/
├── modules/source/ # Student-facing modules
├── instructor/ # Instructor resources
│ ├── tools/ # Analysis and utility scripts
│ ├── reports/ # Generated report cards
│ ├── guides/ # Instructor documentation
│ └── templates/ # Templates and examples
├── docs/ # Quarto documentation
│ ├── _quarto.yml # Quarto configuration
│ ├── index.qmd # Main documentation
│ ├── modules/ # Module documentation
│ └── instructor/ # Instructor documentation
├── tests/ # Test suites
└── tinytorch/ # Main package
```
### Analysis Tools Organization
- `instructor/tools/module_analyzer.py` - Main analysis tool
- `instructor/tools/report_generator.py` - Report card generator
- `instructor/tools/quality_monitor.py` - Continuous monitoring
- `instructor/reports/` - Generated report cards by date
- `instructor/guides/` - How-to guides for instructors
### Documentation Strategy
- **Quarto** for main documentation system
- **Automated generation** from source code and analysis
- **Multiple output formats** (HTML, PDF, etc.)
- **Integrated report cards** in documentation
- **Instructor and student** sections
## 🎯 Success Metrics
### Repository Organization
- [ ] Clean, logical directory structure
- [ ] All tools in appropriate locations
- [ ] No broken imports or functionality
- [ ] Easy to navigate and understand
### Testing & Quality
- [ ] 100% test pass rate across all modules
- [ ] All analysis tools working correctly
- [ ] No import errors or missing dependencies
- [ ] Comprehensive test coverage
### Report Cards
- [ ] Professional, formatted report cards
- [ ] Consistent design and layout
- [ ] Clear, actionable insights
- [ ] Easy to generate and update
### Documentation
- [ ] Quarto documentation system working
- [ ] Professional manual-style documentation
- [ ] Automated generation from source
- [ ] Easy to maintain and update
### Integration
- [ ] All components work together seamlessly
- [ ] Automated quality monitoring
- [ ] Clear improvement tracking
- [ ] Smooth development workflow
## 🚀 Execution Timeline
**Phase 1** (Branch 1): Repository structure reorganization
**Phase 2** (Branch 2): Comprehensive testing and fixes
**Phase 3** (Branch 3): Professional report card system
**Phase 4** (Branch 4): Quarto documentation setup
**Phase 5** (Branch 5): Integration and final polish
Each phase will be completed in a separate branch, thoroughly tested, and merged only when fully verified.
This plan ensures systematic improvement while maintaining quality and functionality throughout the process.

View File

@@ -80,7 +80,7 @@ class ModuleReportCard:
class TinyTorchModuleAnalyzer:
"""Comprehensive analyzer for TinyTorch educational modules"""
def __init__(self, modules_dir: str = "modules/source"):
def __init__(self, modules_dir: str = "../../modules/source"):
self.modules_dir = Path(modules_dir)
self.target_metrics = {
'ideal_lines': (200, 400),
@@ -913,7 +913,7 @@ def main():
parser.add_argument("--compare", nargs="+", help="Compare multiple modules")
parser.add_argument("--format", choices=["json", "html", "both"], default="both", help="Output format")
parser.add_argument("--save", action="store_true", help="Save report cards to files")
parser.add_argument("--modules-dir", default="modules/source", help="Path to modules directory")
parser.add_argument("--modules-dir", default="../../modules/source", help="Path to modules directory")
args = parser.parse_args()