Unifying Experiments and Dimensional Attributes as Traits
We need to decide how to model dimensional attributes in our system. After discussion, we're leaning toward a unified "trait" model that better reflects the evolutionary nature of our platform.
Cur
We need to decide how to model dimensional attributes in our system. After discussion, we're leaning toward a unified "trait" model that better reflects the evolutionary nature of our platform.
## Current Understanding
- **Experiments** are traits we control (like A/B tests)
- **Dimensional attributes** are traits we observe (like device type, country)
- In evolutionary terms, both are simply traits that affect fitness
## Proposed Solution
Create a unified trait model:
class Trait(models.Model):
product = models.ForeignKey(Product)
key = models.CharField()
trait_type = models.CharField(choices=[
('INHERITED', 'Inherited trait'),
('CONTROLLED', 'Controlled trait')
])
# Add these fields:
is_active = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
metadata = models.JSONField(default=dict) # For flexible trait-specific config
class TraitVariant(models.Model):
trait = models.ForeignKey(Trait)
key = models.CharField()
# Add these fields:
weight = models.FloatField(default=1.0) # For weighted sampling
constraints = models.JSONField(default=dict) # Rules for variant assignment
class UnitTrait(models.Model):
unit = models.ForeignKey(Unit)
trait = models.ForeignKey(Trait)
variant = models.ForeignKey(TraitVariant)
assigned_at = models.DateTimeField()
# Add this field:
fitness_score = models.FloatField(null=True) # Track variant performance
## Next Steps
- Evaluate impacts on existing experiment code
- Consider migration path from current experiment model
- Explore analysis possibilities with unified trait dataOn March 7, 2025, Eduarda Ferreira initiated a Socra titled "Unifying Experiments and Dimensional Attributes as Traits," focusing on the integration of dimensional attributes in their system through a unified trait model. The team agreed that both experiments (controlled traits like A/B tests) and dimensional attributes (observed traits such as device type or country) fundamentally represent traits influencing fitness within their evolutionary platform.
The proposed solution involved creating a structured trait model composed of three related classes: **Trait**, **TraitVariant**, and **UnitTrait**. The **Trait** class encapsulated product-related traits (both controlled and inherited), while the **TraitVariant** class allowed for weighted sampling and variant rules. The **UnitTrait** class connected units to traits and variants, incorporating a fitness score to assess variant performance.
Next steps identified included evaluating the impact of this new model on existing experiment code, planning for migration from the current model, and exploring data analysis opportunities with the newly unified trait data. The Socra remains a pivotal point for future reference, encapsulating the evolution of their approach to traits in data analysis.By Eduarda Ferreira