Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 33 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,51 @@
# Recommender System
### Author & Maintainer: Rafipilot
Maintainer: [Rafipilot](https://github.com/Rafipilot), rafayel.latif@gmail.com
# AO Labs Recommender System

A recommender system built with AO Labs' post-training learning architecture. The system learns from user behavior in real-time, providing increasingly personalized recommendations.

## Description
This is a basic video recommender system designed to offer personalized video recommendations. Unlike many modern systems that rely on collaborative filtering鈥攔esulting in suggestions based on broad user trends鈥攖his system aims to provide more unique and individually tailored recommendations. By giving users greater control over how they provide feedback, the system helps break free from repetitive content and exposes users to a wider range of videos, making it easier to find content that truly resonates with their tastes.
## Domains

## Installation/Setup
This recommender has been adapted to multiple domains:

### Local Environment
If you plan to run the app in a conda or virtual environment, make sure to set up your environment following the respective instructions for those tools.
- **YouTube** (original) - Video recommendations based on genre and mood
- **Programming Education** - Coding tutorial and course recommendations based on skill level and interests

1. Install the requirements:
## Quick Start

```bash
pip install -r requirements.txt
```

2. Install ao_core and ao_arch with the pip install git+ method which lets you install python code from git repos.

```bash
pip install git+https://github.com/aolabsai/ao_arch git+https://github.com/aolabsai/ao_core
```

3. Run the application with the following command:
### YouTube Recommender
```bash
pip install -r requirements.txt
streamlit run main.py
```

```bash
streamlit run recommender.py
```
### Programming Education Recommender
```bash
pip install -r requirements.txt
streamlit run coding_edu_recommender.py
```

4. Once running, the app will be accessible at `localhost:8501`.
## Programming Education Domain

The coding education recommender suggests programming tutorials, courses, and practice resources based on:

### Docker Installation
- **Topic**: Web Dev, Mobile, Data Science, AI/ML, Systems, DevOps, Game Dev, Blockchain, IoT, Security
- **Difficulty**: Beginner, Intermediate, Advanced
- **Format**: Video, Interactive/Hands-on
- **Experience**: No experience, Some basics, Experienced, Senior

1) Generate a GitHub Personal Access Token to ao_core
Go to https://github.com/settings/tokens?type=beta
The system uses AO Labs' binary encoding architecture with 8-bit input vectors to represent user preferences and learn from feedback.

2) Clone this repo and create a `.env` file in your local clone where you'll add the PAT as follows:
`ao_github_PAT=token_goes_here`
No spaces! See `.env_example`.
## Architecture

3) In a Git Bash terminal, build and run the Dockerfile with these commands:
```shell
export DOCKER_BUILDKIT=1
Each domain has its own architecture file:
- `arch__Recommender.py` - YouTube recommender architecture
- `arch__CodingEduRecommender.py` - Programming education architecture

docker build --secret id=env,src=.env -t "ao_app" .
## Testing

docker run -p 8501:8501 streamlit
```bash
python -m pytest tests/test_coding_edu.py -v
```
You're done! Access the app at `localhost:8501` in your browser.

## Usage

The recommender system works by loading a set of random video links. Once the user hits the Run button, a video will be shown, and the system will suggest whether it recommends the video or not. The user can then provide feedback using "pain" or "pleasure" signals to guide the recommendation process. Based on this feedback, the system adjusts its responses and suggests another video. This cycle continues, allowing for more accurate and personalized recommendations over time.


## Contributing

Fork the repository, make your changes, and submit a pull request for review.


## License

See original repository for license information.
22 changes: 22 additions & 0 deletions arch__CodingEduRecommender.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
"""
Arch file for Programming/Coding Education Resource Recommender
Suggests programming tutorials, courses, and practice resources
based on the user's skill level, interests, and learning progress.
"""

import ao_arch as ar

description = "Programming Education Resource Recommender"

# Input encoding: topic(3) + difficulty(2) + format(1) + experience(2) = 8 bits
# topic: web/mobile/data/AI/systems/DevOps/game/crypto/embedded/other
# difficulty: beginner/intermediate/advanced
# format: video/article/interactive
# experience: none/some/experienced
arch_i = [3, 2, 1, 2] # topic_binary + difficulty_binary + format_binary + experience_binary
arch_z = [10] # output: resource recommendation encoding
arch_c = []
connector_function = "full_conn"

arch = ar.Arch(arch_i, arch_z, arch_c, connector_function, description)
213 changes: 213 additions & 0 deletions coding_edu_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# -*- coding: utf-8 -*-
"""
Programming Education Resource Domain Data
Catalog of coding learning resources for the recommender system.
"""

# Topic categories (10 topics, 3-bit binary encoding)
TOPIC_MAP = {
0: "Web Development",
1: "Mobile Development",
2: "Data Science",
3: "AI/Machine Learning",
4: "Systems Programming",
5: "DevOps/Cloud",
6: "Game Development",
7: "Blockchain/Crypto",
8: "Embedded/IoT",
9: "Security"
}

# Difficulty levels (2-bit encoding)
DIFFICULTY_MAP = {
0: "Beginner",
1: "Intermediate",
2: "Advanced",
3: "Expert"
}

# Format types (1-bit encoding)
FORMAT_MAP = {
0: "Video",
1: "Interactive/Hands-on"
}

# Experience levels (2-bit encoding)
EXPERIENCE_MAP = {
0: "No prior experience",
1: "Some programming (basics)",
2: "Experienced developer",
3: "Senior/Expert"
}

# Resource catalog - 12 items covering diverse programming topics
RESOURCE_CATALOG = [
{
"id": 0,
"title": "HTML & CSS Fundamentals",
"topic": "Web Development",
"difficulty": "Beginner",
"format": "Interactive",
"experience": "No prior experience",
"description": "Learn the building blocks of the web with hands-on exercises",
"url": "https://www.freecodecamp.org/learn/responsive-web-design/",
"duration": "300 hours",
"tags": ["html", "css", "responsive", "web"]
},
{
"id": 1,
"title": "React Complete Guide",
"topic": "Web Development",
"difficulty": "Intermediate",
"format": "Video",
"experience": "Some programming (basics)",
"description": "Build modern web apps with React hooks, state management, and routing",
"url": "https://react.dev/learn",
"duration": "40 hours",
"tags": ["react", "javascript", "frontend", "hooks"]
},
{
"id": 2,
"title": "Flutter Mobile App Development",
"topic": "Mobile Development",
"difficulty": "Intermediate",
"format": "Interactive",
"experience": "Some programming (basics)",
"description": "Build cross-platform mobile apps with Flutter and Dart",
"url": "https://flutter.dev/learn",
"duration": "30 hours",
"tags": ["flutter", "dart", "mobile", "cross-platform"]
},
{
"id": 3,
"title": "Python for Data Analysis",
"topic": "Data Science",
"difficulty": "Beginner",
"format": "Interactive",
"experience": "No prior experience",
"description": "Learn pandas, numpy, and matplotlib for data analysis",
"url": "https://www.kaggle.com/learn/pandas",
"duration": "20 hours",
"tags": ["python", "pandas", "data-analysis", "visualization"]
},
{
"id": 4,
"title": "Deep Learning Specialization",
"topic": "AI/Machine Learning",
"difficulty": "Advanced",
"format": "Video",
"experience": "Experienced developer",
"description": "Master neural networks, CNNs, RNNs, and transformers",
"url": "https://www.deeplearning.ai/courses/deep-learning-specialization/",
"duration": "120 hours",
"tags": ["deep-learning", "neural-networks", "cnn", "transformers"]
},
{
"id": 5,
"title": "Rust Systems Programming",
"topic": "Systems Programming",
"difficulty": "Advanced",
"format": "Interactive",
"experience": "Experienced developer",
"description": "Learn Rust for safe, concurrent systems programming",
"url": "https://doc.rust-lang.org/book/",
"duration": "60 hours",
"tags": ["rust", "systems", "memory-safety", "concurrency"]
},
{
"id": 6,
"title": "Docker & Kubernetes in Practice",
"topic": "DevOps/Cloud",
"difficulty": "Intermediate",
"format": "Interactive",
"experience": "Some programming (basics)",
"description": "Containerize apps and orchestrate with Kubernetes",
"url": "https://kubernetes.io/docs/tutorials/",
"duration": "40 hours",
"tags": ["docker", "kubernetes", "containers", "devops"]
},
{
"id": 7,
"title": "Unity Game Development Bootcamp",
"topic": "Game Development",
"difficulty": "Beginner",
"format": "Video",
"experience": "No prior experience",
"description": "Build 2D and 3D games with Unity and C#",
"url": "https://learn.unity.com/",
"duration": "50 hours",
"tags": ["unity", "csharp", "gamedev", "3d"]
},
{
"id": 8,
"title": "Smart Contract Development with Solidity",
"topic": "Blockchain/Crypto",
"difficulty": "Intermediate",
"format": "Interactive",
"experience": "Some programming (basics)",
"description": "Build decentralized applications on Ethereum",
"url": "https://cryptozombies.io/",
"duration": "20 hours",
"tags": ["solidity", "ethereum", "smart-contracts", "web3"]
},
{
"id": 9,
"title": "ESP32 IoT Projects",
"topic": "Embedded/IoT",
"difficulty": "Intermediate",
"format": "Interactive",
"experience": "Some programming (basics)",
"description": "Build IoT projects with ESP32, sensors, and MQTT",
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/",
"duration": "30 hours",
"tags": ["esp32", "iot", "sensors", "mqtt"]
},
{
"id": 10,
"title": "OWASP Web Security Fundamentals",
"topic": "Security",
"difficulty": "Intermediate",
"format": "Interactive",
"experience": "Experienced developer",
"description": "Learn web application security, OWASP Top 10, and penetration testing basics",
"url": "https://owasp.org/www-project-web-security-learning/",
"duration": "25 hours",
"tags": ["security", "owasp", "pentesting", "web-security"]
},
{
"id": 11,
"title": "Full-Stack JavaScript Mastery",
"topic": "Web Development",
"difficulty": "Advanced",
"format": "Video",
"experience": "Senior/Expert",
"description": "Master Node.js, Express, databases, deployment, and microservices",
"url": "https://nodejs.org/en/learn",
"duration": "80 hours",
"tags": ["nodejs", "express", "fullstack", "microservices"]
}
]

def get_topic_encoding(topic_name):
for k, v in TOPIC_MAP.items():
if v == topic_name:
return k
return 0

def get_difficulty_encoding(difficulty_name):
for k, v in DIFFICULTY_MAP.items():
if v == difficulty_name:
return k
return 0

def get_format_encoding(format_name):
for k, v in FORMAT_MAP.items():
if v == format_name:
return k
return 0

def get_experience_encoding(experience_name):
for k, v in EXPERIENCE_MAP.items():
if v == experience_name:
return k
return 0
Loading