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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
---
|
| 26 |
|
| 27 |
-
##
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
- **A-Risk** – linear, weight-adjusted attention risk
|
| 35 |
-
- **D-Index** – inverse Herfindahl index over your time share
|
| 36 |
-
3. Ranks platforms by **Cultural Efficiency** (0–100):
|
| 37 |
-
> “How much cultural exposure you get per minute” relative to your own most efficient platform.
|
| 38 |
-
4. Generates a **plain-language interpretation** tying all of this back to your satisfaction and FOMO.
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
---
|
| 43 |
|
| 44 |
-
##
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
- Instagram
|
| 52 |
-
- YouTube
|
| 53 |
-
- Twitter / X
|
| 54 |
-
- Reddit
|
| 55 |
-
- Facebook
|
| 56 |
-
- Other (anything else you use)
|
| 57 |
|
| 58 |
-
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
| 71 |
-
- If `minutes_per_week == 0` for a platform:
|
| 72 |
-
- That platform is **excluded** from the model calculations.
|
| 73 |
-
- Its variety value is **ignored**.
|
| 74 |
-
- If you set `variety_score > 0` while `minutes_per_week == 0`:
|
| 75 |
-
- The app **ignores** that variety score.
|
| 76 |
-
- You get a ⚠️ **warning line** listing affected platforms in the summary.
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
|
| 85 |
-
{
|
| 86 |
-
"tiktok": {"W_C": 0.95, "W_A": 0.90},
|
| 87 |
-
"instagram":{"W_C": 0.85, "W_A": 0.85},
|
| 88 |
-
"youtube": {"W_C": 0.70, "W_A": 0.75},
|
| 89 |
-
"twitter": {"W_C": 0.80, "W_A": 0.70},
|
| 90 |
-
"facebook": {"W_C": 0.50, "W_A": 0.60},
|
| 91 |
-
"reddit": {"W_C": 0.60, "W_A": 0.40},
|
| 92 |
-
"other": {"W_C": 0.10, "W_A": 0.20}
|
| 93 |
-
}
|
|
|
|
| 11 |
|
| 12 |
# CEAR – Cultural Exposure & Algorithmic Risk Analyzer
|
| 13 |
|
| 14 |
+
CEAR is a transparent, rule-based model and Hugging Face Space that helps users understand their social media habits through three interpretable metrics:
|
| 15 |
|
| 16 |
+
* **Cultural Connectedness (C-Score)** – approximate trend exposure
|
| 17 |
+
* **Algorithmic Risk (A-Risk)** – attention concentration in algorithm-driven feeds
|
| 18 |
+
* **Diversity Index (D-Index)** – distribution of time across platforms
|
| 19 |
|
| 20 |
+
The project combines an analytic scoring engine with a clean Gradio interface. It does not use machine learning but functions as an interpretable behavioral analysis model.
|
| 21 |
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## 🚀 Live Demo
|
| 25 |
+
|
| 26 |
+
Use CEAR directly in your browser:
|
| 27 |
+
|
| 28 |
+
**Hugging Face Space:** `https://huggingface.co/spaces/<your-username>/CEAR`
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## 📦 Project Structure
|
| 33 |
+
|
| 34 |
+
```
|
| 35 |
+
├── app.py # Gradio interface and interpretation logic
|
| 36 |
+
├── cear_model.py # Core scoring engine (C/A/D + efficiency)
|
| 37 |
+
├── platform_weights.json # Hand-tuned theoretical platform weights
|
| 38 |
+
├── requirements.txt # Dependencies
|
| 39 |
+
└── README.md # This file
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## 🎯 Purpose
|
| 45 |
+
|
| 46 |
+
CEAR serves two goals:
|
| 47 |
+
|
| 48 |
+
1. Provide an **interpretable framework** for analyzing social media behavior.
|
| 49 |
+
2. Demonstrate a **fully-documented model card**, Gradio deployment, and rule-based transform suitable for academic or instructional settings.
|
| 50 |
+
|
| 51 |
+
It is ideal for:
|
| 52 |
+
|
| 53 |
+
* Students learning model documentation
|
| 54 |
+
* Researchers exploring rule-based analytics
|
| 55 |
+
* Users who want insight into their social media patterns
|
| 56 |
+
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
## 📥 Inputs
|
| 60 |
+
|
| 61 |
+
CEAR accepts values for **7 platform buckets**:
|
| 62 |
+
|
| 63 |
+
* TikTok
|
| 64 |
+
* Instagram
|
| 65 |
+
* YouTube
|
| 66 |
+
* Twitter/X
|
| 67 |
+
* Reddit
|
| 68 |
+
* Facebook
|
| 69 |
+
* Other
|
| 70 |
+
|
| 71 |
+
For each platform, the user inputs:
|
| 72 |
+
|
| 73 |
+
* **Minutes per week**
|
| 74 |
+
* **Variety score** (0–10)
|
| 75 |
+
|
| 76 |
+
Global self-reports:
|
| 77 |
+
|
| 78 |
+
* **Feed satisfaction** (0–10)
|
| 79 |
+
* **FOMO / Out-of-the-loop feeling** (0–10)
|
| 80 |
+
|
| 81 |
+
### Input Validation Rules
|
| 82 |
+
|
| 83 |
+
* Platforms with **0 minutes** are excluded from calculations.
|
| 84 |
+
* Variety > 0 while minutes = 0 triggers a **warning** and is ignored.
|
| 85 |
+
* Negative values are treated as zero.
|
| 86 |
+
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## 🧮 Model Logic
|
| 90 |
+
|
| 91 |
+
CEAR is a rule-based model driven by theoretical platform weights.
|
| 92 |
+
|
| 93 |
+
### Platform Weights
|
| 94 |
+
|
| 95 |
+
Each platform has:
|
| 96 |
+
|
| 97 |
+
* `W_C` – Cultural Connectedness Weight
|
| 98 |
+
* `W_A` – Algorithmic Risk Weight
|
| 99 |
+
|
| 100 |
+
Defined in `platform_weights.json`.
|
| 101 |
+
|
| 102 |
+
### Score Calculations
|
| 103 |
+
|
| 104 |
+
#### 1. **C-Score (Cultural Connectedness)**
|
| 105 |
+
|
| 106 |
+
Uses a log transform to encode diminishing returns:
|
| 107 |
+
|
| 108 |
+
```
|
| 109 |
+
C_contrib = W_C * log10(minutes + 1)
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
#### 2. **A-Risk (Algorithmic Risk)**
|
| 113 |
+
|
| 114 |
+
Linear with respect to time:
|
| 115 |
+
|
| 116 |
+
```
|
| 117 |
+
A_contrib = W_A * minutes
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
#### 3. **D-Index (Platform Diversity)**
|
| 121 |
+
|
| 122 |
+
Based on the inverse Herfindahl index:
|
| 123 |
+
|
| 124 |
+
```
|
| 125 |
+
s_i = minutes_i / total_minutes
|
| 126 |
+
D_Index = 1 / sum(s_i^2)
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
#### 4. **Per-Platform Cultural Efficiency (0–100)**
|
| 130 |
+
|
| 131 |
+
```
|
| 132 |
+
eff_raw = C_contrib / minutes
|
| 133 |
+
normalized = eff_raw / max(eff_raw) * 100
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
#### 5. **Average Variety (Weighted)**
|
| 137 |
+
|
| 138 |
+
```
|
| 139 |
+
Avg_Variety = mean(variety_score, weighted by minutes)
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### Interpretation Logic
|
| 143 |
+
|
| 144 |
+
* Satisfaction and FOMO do **not** influence the numeric scores.
|
| 145 |
+
* Instead, they shape the **narrative summary**.
|
| 146 |
+
|
| 147 |
+
---
|
| 148 |
+
|
| 149 |
+
## 🧩 Output Sections
|
| 150 |
+
|
| 151 |
+
The app produces three final outputs:
|
| 152 |
+
|
| 153 |
+
### 1. **CEAR Analysis Summary**
|
| 154 |
+
|
| 155 |
+
Includes:
|
| 156 |
+
|
| 157 |
+
* C-Score
|
| 158 |
+
* A-Risk
|
| 159 |
+
* D-Index
|
| 160 |
+
* Average Variety
|
| 161 |
+
* Self-report reflections
|
| 162 |
+
* Warnings for invalid input patterns
|
| 163 |
+
|
| 164 |
+
### 2. **Interpretation Narrative**
|
| 165 |
+
|
| 166 |
+
A human-readable explanation linking:
|
| 167 |
+
|
| 168 |
+
* Platform mix
|
| 169 |
+
* Variety
|
| 170 |
+
* Satisfaction
|
| 171 |
+
* FOMO
|
| 172 |
+
* Risk and connectedness profiles
|
| 173 |
+
|
| 174 |
+
### 3. **Platform Efficiency Breakdown**
|
| 175 |
+
|
| 176 |
+
Both as:
|
| 177 |
+
|
| 178 |
+
* A ranked markdown list (easy to read)
|
| 179 |
+
* A numeric DataFrame (for analysis)
|
| 180 |
|
| 181 |
---
|
| 182 |
|
| 183 |
+
## 🧪 Validation
|
| 184 |
|
| 185 |
+
Since CEAR is deterministic, validation focuses on correctness:
|
| 186 |
|
| 187 |
+
* Unit tests confirm expected behavior for high-concentration vs balanced usage.
|
| 188 |
+
* Manual tests confirm variety weighting, reset logic, and warnings.
|
| 189 |
+
* The scoring formulas are transparent and reproducible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
+
---
|
| 192 |
+
|
| 193 |
+
## ⚠️ Limitations
|
| 194 |
+
|
| 195 |
+
CEAR is **not** a predictive model.
|
| 196 |
+
|
| 197 |
+
* It does not infer real cultural exposure.
|
| 198 |
+
* It cannot evaluate actual content.
|
| 199 |
+
* Weights reflect reasonable theoretical assumptions, not empirical fitting.
|
| 200 |
+
* It does not diagnose mental health or prescribe usage patterns.
|
| 201 |
+
|
| 202 |
+
The model is best used for **reflection**, **education**, and **exploration**.
|
| 203 |
|
| 204 |
---
|
| 205 |
|
| 206 |
+
## 🔧 Running Locally
|
| 207 |
|
| 208 |
+
You can run the app locally:
|
| 209 |
|
| 210 |
+
```bash
|
| 211 |
+
pip install -r requirements.txt
|
| 212 |
+
python app.py
|
| 213 |
+
```
|
| 214 |
|
| 215 |
+
Or import the model:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
+
```python
|
| 218 |
+
from cear_model import CEARModel
|
| 219 |
+
import pandas as pd
|
| 220 |
|
| 221 |
+
model = CEARModel()
|
| 222 |
+
df = pd.DataFrame([
|
| 223 |
+
{"platform_name": "tiktok", "minutes_per_week": 300, "variety_score": 4},
|
| 224 |
+
])
|
| 225 |
+
print(model.calculate_scores(df, satisfaction=6, fomo=4))
|
| 226 |
+
```
|
| 227 |
|
| 228 |
+
---
|
| 229 |
+
|
| 230 |
+
## 📜 License
|
| 231 |
|
| 232 |
+
MIT License
|
| 233 |
+
|
| 234 |
+
---
|
| 235 |
|
| 236 |
+
## 🙌 Acknowledgments
|
| 237 |
|
| 238 |
+
This project was built to demonstrate:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
|
| 240 |
+
* Transparent model design
|
| 241 |
+
* Clear model documentation
|
| 242 |
+
* Proper Hugging Face Space structure
|
| 243 |
+
* User-oriented interpretability
|
| 244 |
|
| 245 |
+
Feel free to fork and extend with:
|
| 246 |
|
| 247 |
+
* Empirical weights
|
| 248 |
+
* Trend detection
|
| 249 |
+
* Behavioral clustering
|
| 250 |
+
* Recommendation strategies
|
| 251 |
|
| 252 |
+
CEAR v1.0 is a foundation for deeper exploration into how we relate to algorithmic feeds.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|