Spaces:
Paused
Paused
Commit ·
f0a8734
1
Parent(s): e82b235
update
Browse files- server/viraltest_environment.py +15 -3
- train-bhai-train +0 -1
server/viraltest_environment.py
CHANGED
|
@@ -163,6 +163,7 @@ WEEKLY_FATIGUE_MULT = 0.75
|
|
| 163 |
|
| 164 |
SATURATION_PENALTY_K = 0.25
|
| 165 |
TREND_DEFAULT_HALFLIFE_HOURS = 60
|
|
|
|
| 166 |
# Collab reward shaping (Later 2023 reach study, HypeAuditor 2024 niche affinity, Rival IQ 2025 overlap patterns,
|
| 167 |
# Cen et al. 2024 disengagement model for diminishing returns instead of a hard cap).
|
| 168 |
COLLAB_REACH_K = 0.60 # cross-audience exposure: capped reach uplift when overlap is 0
|
|
@@ -1006,8 +1007,13 @@ class ViraltestEnvironment(Environment):
|
|
| 1006 |
def _is_topic_trending(self, topic: Optional[str]) -> bool:
|
| 1007 |
if not topic:
|
| 1008 |
return False
|
| 1009 |
-
|
| 1010 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1011 |
|
| 1012 |
# ----- reward -----
|
| 1013 |
|
|
@@ -1038,7 +1044,13 @@ class ViraltestEnvironment(Environment):
|
|
| 1038 |
comp_component = min(1.0, diff / 1.3) * 0.15
|
| 1039 |
|
| 1040 |
burnout_penalty = 0.1 if self._energy < 0.2 else 0.0
|
| 1041 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1042 |
return max(0.0, min(1.0, raw))
|
| 1043 |
|
| 1044 |
def _compute_rest_reward(self) -> float:
|
|
|
|
| 163 |
|
| 164 |
SATURATION_PENALTY_K = 0.25
|
| 165 |
TREND_DEFAULT_HALFLIFE_HOURS = 60
|
| 166 |
+
TREND_MATCH_STOPWORDS = {"tips", "guide", "review", "routine", "ideas", "hacks", "tutorial", "the", "a", "an", "and", "of", "for", "to"}
|
| 167 |
# Collab reward shaping (Later 2023 reach study, HypeAuditor 2024 niche affinity, Rival IQ 2025 overlap patterns,
|
| 168 |
# Cen et al. 2024 disengagement model for diminishing returns instead of a hard cap).
|
| 169 |
COLLAB_REACH_K = 0.60 # cross-audience exposure: capped reach uplift when overlap is 0
|
|
|
|
| 1007 |
def _is_topic_trending(self, topic: Optional[str]) -> bool:
|
| 1008 |
if not topic:
|
| 1009 |
return False
|
| 1010 |
+
t_words = set(topic.lower().split()) - TREND_MATCH_STOPWORDS
|
| 1011 |
+
if not t_words:
|
| 1012 |
+
return False
|
| 1013 |
+
for trend in self._trending_topics:
|
| 1014 |
+
if t_words & (set(trend.lower().split()) - TREND_MATCH_STOPWORDS):
|
| 1015 |
+
return True
|
| 1016 |
+
return False
|
| 1017 |
|
| 1018 |
# ----- reward -----
|
| 1019 |
|
|
|
|
| 1044 |
comp_component = min(1.0, diff / 1.3) * 0.15
|
| 1045 |
|
| 1046 |
burnout_penalty = 0.1 if self._energy < 0.2 else 0.0
|
| 1047 |
+
is_post = sa.action_type == "post"
|
| 1048 |
+
trending_topic_mult = 1.5 if is_post and self._is_topic_trending(sa.topic) else 1.0
|
| 1049 |
+
peak_hour_mult = 1.3 if is_post and self._get_hour_multiplier() >= 1.2 else 1.0
|
| 1050 |
+
raw = (
|
| 1051 |
+
(eng_component + tag_component + comp_component) * trending_topic_mult * peak_hour_mult
|
| 1052 |
+
+ energy_component + consistency_component - burnout_penalty
|
| 1053 |
+
)
|
| 1054 |
return max(0.0, min(1.0, raw))
|
| 1055 |
|
| 1056 |
def _compute_rest_reward(self) -> float:
|
train-bhai-train
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
Subproject commit ce11257dc34d8f8dbb36445cf834f89852539088
|
|
|
|
|
|