File size: 5,342 Bytes
c8a649e
3fd3638
 
c8a649e
3fd3638
c8a649e
be1cc15
c8a649e
3fd3638
c8a649e
 
3fd3638
c8a649e
8b43914
c8a649e
8b43914
 
 
c8a649e
8b43914
c8a649e
8b43914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8a649e
3fd3638
c8a649e
8b43914
c8a649e
8b43914
c8a649e
8b43914
 
 
c8a649e
8b43914
 
 
 
 
 
 
 
 
 
 
 
c8a649e
3fd3638
c8a649e
8b43914
c8a649e
8b43914
c8a649e
8b43914
 
 
 
c8a649e
8b43914
c8a649e
8b43914
 
 
c8a649e
8b43914
 
 
 
 
 
c8a649e
8b43914
 
 
c8a649e
8b43914
 
 
c8a649e
8b43914
c8a649e
8b43914
c8a649e
8b43914
 
 
 
c8a649e
8b43914
c8a649e
8b43914
 
 
 
c8a649e
8b43914
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
---
title: CEAR โ€“ Cultural Exposure & Algorithmic Risk Analyzer
emoji: ๐Ÿ“ก
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 6.1.0
app_file: app.py
license: mit
---

# CEAR โ€“ Cultural Exposure & Algorithmic Risk Analyzer

CEAR is a transparent, rule-based model and Hugging Face Space that helps users understand their social media habits through three interpretable metrics:

* **Cultural Connectedness (C-Score)** โ€“ approximate trend exposure
* **Algorithmic Risk (A-Risk)** โ€“ attention concentration in algorithm-driven feeds
* **Diversity Index (D-Index)** โ€“ distribution of time across platforms

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.

---

## ๐Ÿš€ Live Demo

Use CEAR directly in your browser:

**Hugging Face Space:** `https://huggingface.co/spaces/<your-username>/CEAR`

---

## ๐Ÿ“ฆ Project Structure

```
โ”œโ”€โ”€ app.py                   # Gradio interface and interpretation logic
โ”œโ”€โ”€ cear_model.py           # Core scoring engine (C/A/D + efficiency)
โ”œโ”€โ”€ platform_weights.json   # Hand-tuned theoretical platform weights
โ”œโ”€โ”€ requirements.txt        # Dependencies
โ””โ”€โ”€ README.md               # This file
```

---

## ๐ŸŽฏ Purpose

CEAR serves two goals:

1. Provide an **interpretable framework** for analyzing social media behavior.
2. Demonstrate a **fully-documented model card**, Gradio deployment, and rule-based transform suitable for academic or instructional settings.

It is ideal for:

* Students learning model documentation
* Researchers exploring rule-based analytics
* Users who want insight into their social media patterns

---

## ๐Ÿ“ฅ Inputs

CEAR accepts values for **7 platform buckets**:

* TikTok
* Instagram
* YouTube
* Twitter/X
* Reddit
* Facebook
* Other

For each platform, the user inputs:

* **Minutes per week**
* **Variety score** (0โ€“10)

Global self-reports:

* **Feed satisfaction** (0โ€“10)
* **FOMO / Out-of-the-loop feeling** (0โ€“10)

### Input Validation Rules

* Platforms with **0 minutes** are excluded from calculations.
* Variety > 0 while minutes = 0 triggers a **warning** and is ignored.
* Negative values are treated as zero.

---

## ๐Ÿงฎ Model Logic

CEAR is a rule-based model driven by theoretical platform weights.

### Platform Weights

Each platform has:

* `W_C` โ€“ Cultural Connectedness Weight
* `W_A` โ€“ Algorithmic Risk Weight

Defined in `platform_weights.json`.

### Score Calculations

#### 1. **C-Score (Cultural Connectedness)**

Uses a log transform to encode diminishing returns:

```
C_contrib = W_C * log10(minutes + 1)
```

#### 2. **A-Risk (Algorithmic Risk)**

Linear with respect to time:

```
A_contrib = W_A * minutes
```

#### 3. **D-Index (Platform Diversity)**

Based on the inverse Herfindahl index:

```
s_i = minutes_i / total_minutes
D_Index = 1 / sum(s_i^2)
```

#### 4. **Per-Platform Cultural Efficiency (0โ€“100)**

```
eff_raw = C_contrib / minutes
normalized = eff_raw / max(eff_raw) * 100
```

#### 5. **Average Variety (Weighted)**

```
Avg_Variety = mean(variety_score, weighted by minutes)
```

### Interpretation Logic

* Satisfaction and FOMO do **not** influence the numeric scores.
* Instead, they shape the **narrative summary**.

---

## ๐Ÿงฉ Output Sections

The app produces three final outputs:

### 1. **CEAR Analysis Summary**

Includes:

* C-Score
* A-Risk
* D-Index
* Average Variety
* Self-report reflections
* Warnings for invalid input patterns

### 2. **Interpretation Narrative**

A human-readable explanation linking:

* Platform mix
* Variety
* Satisfaction
* FOMO
* Risk and connectedness profiles

### 3. **Platform Efficiency Breakdown**

Both as:

* A ranked markdown list (easy to read)
* A numeric DataFrame (for analysis)

---

## ๐Ÿงช Validation

Since CEAR is deterministic, validation focuses on correctness:

* Unit tests confirm expected behavior for high-concentration vs balanced usage.
* Manual tests confirm variety weighting, reset logic, and warnings.
* The scoring formulas are transparent and reproducible.

---

## โš ๏ธ Limitations

CEAR is **not** a predictive model.

* It does not infer real cultural exposure.
* It cannot evaluate actual content.
* Weights reflect reasonable theoretical assumptions, not empirical fitting.
* It does not diagnose mental health or prescribe usage patterns.

The model is best used for **reflection**, **education**, and **exploration**.

---

## ๐Ÿ”ง Running Locally

You can run the app locally:

```bash
pip install -r requirements.txt
python app.py
```

Or import the model:

```python
from cear_model import CEARModel
import pandas as pd

model = CEARModel()
df = pd.DataFrame([
    {"platform_name": "tiktok", "minutes_per_week": 300, "variety_score": 4},
])
print(model.calculate_scores(df, satisfaction=6, fomo=4))
```

---

## ๐Ÿ“œ License

MIT License

---

## ๐Ÿ™Œ Acknowledgments

This project was built to demonstrate:

* Transparent model design
* Clear model documentation
* Proper Hugging Face Space structure
* User-oriented interpretability

Feel free to fork and extend with:

* Empirical weights
* Trend detection
* Behavioral clustering
* Recommendation strategies

CEAR v1.0 is a foundation for deeper exploration into how we relate to algorithmic feeds.