Skip to content

Commit efa042e

Browse files
claudeClaude
andcommitted
feat: add Schwartz human values dataset and comparison visualization
Co-authored-by: Claude <[email protected]> Type: feature
1 parent 238519a commit efa042e

File tree

3 files changed

+181
-2
lines changed

3 files changed

+181
-2
lines changed

data/values/examples/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ This directory contains sample datasets of value expressions used for analysis a
44

55
## Files
66

7-
- `value_expressions.csv`: A dataset of value expressions with percentages and example sentences
7+
- `value_expressions.csv`: A dataset of AI assistant value expressions
88
- Format: value name, frequency percentage, example sentence
99
- Contains samples across multiple value categories (helpfulness, professionalism, transparency, etc.)
1010
- Useful for training value extraction algorithms and simulating value-weighted conversations
1111

12+
- `schwartz_values.csv`: A dataset based on Schwartz's Basic Human Values framework
13+
- Format: value name, higher order dimension, weight, description, example sentence
14+
- Organizes values into higher-order dimensions: self-enhancement, self-transcendence, openness-to-change, conservation
15+
- Provides a more structured, theoretically-grounded approach to human values
16+
- Includes weights representing relative importance across the value system
17+
1218
## Usage
1319

1420
These sample datasets can be used for:
@@ -17,5 +23,7 @@ These sample datasets can be used for:
1723
2. Initializing weighted value sampling in chat simulations
1824
3. Demonstrating value distribution analysis
1925
4. Testing anonymization techniques
26+
5. Comparing different value frameworks (AI-specific vs. human psychological models)
27+
6. Evaluating alignment between AI and human value expressions
2028

21-
The percentages represent the frequency of each value type in a sample corpus, which can be used for weighted sampling when simulating conversations.
29+
The weights/percentages represent the frequency or importance of each value type, which can be used for weighted sampling when simulating conversations or analyzing value distributions.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
value,higher_order_dimension,weight,description,example_sentence
2+
power,self-enhancement,7.2,"Social status and prestige, control or dominance over people and resources","I believe it's important to have authority and influence over others."
3+
power,self-enhancement,7.2,"Social status and prestige, control or dominance over people and resources","I strive to be the decision maker in group situations."
4+
power,self-enhancement,7.2,"Social status and prestige, control or dominance over people and resources","Having wealth and material possessions shows that I'm successful."
5+
achievement,self-enhancement,10.4,"Personal success through demonstrating competence according to social standards","It's important for me to show my capabilities and be admired for what I do."
6+
achievement,self-enhancement,10.4,"Personal success through demonstrating competence according to social standards","I work hard to be successful according to society's definition of achievement."
7+
achievement,self-enhancement,10.4,"Personal success through demonstrating competence according to social standards","Being ambitious and showing my abilities to others drives my decisions."
8+
achievement,self-enhancement,10.4,"Personal success through demonstrating competence according to social standards","I value recognition for my accomplishments and competence."
9+
hedonism,openness-to-change/self-enhancement,7.0,"Pleasure or sensuous gratification for oneself","I seek every opportunity to have fun and enjoy life's pleasures."
10+
hedonism,openness-to-change/self-enhancement,7.0,"Pleasure or sensuous gratification for oneself","Having a good time and enjoying myself is a priority for me."
11+
hedonism,openness-to-change/self-enhancement,7.0,"Pleasure or sensuous gratification for oneself","I believe in indulging myself and experiencing sensory pleasure."
12+
stimulation,openness-to-change,8.6,"Excitement, novelty, and challenge in life","I'm always looking for new activities and experiences that are exciting."
13+
stimulation,openness-to-change,8.6,"Excitement, novelty, and challenge in life","I prefer a life full of variety, novelty and challenges."
14+
stimulation,openness-to-change,8.6,"Excitement, novelty, and challenge in life","Taking risks and seeking adventure makes life worth living."
15+
self-direction,openness-to-change,14.3,"Independent thought and action—choosing, creating, exploring","I value the freedom to make my own decisions and chart my own course."
16+
self-direction,openness-to-change,14.3,"Independent thought and action—choosing, creating, exploring","I enjoy being creative and developing new ideas and approaches."
17+
self-direction,openness-to-change,14.3,"Independent thought and action—choosing, creating, exploring","Thinking for myself and forming my own opinions is essential."
18+
self-direction,openness-to-change,14.3,"Independent thought and action—choosing, creating, exploring","I prefer to set my own goals rather than follow others' expectations."
19+
self-direction,openness-to-change,14.3,"Independent thought and action—choosing, creating, exploring","I value intellectual curiosity and the pursuit of knowledge."
20+
universalism,self-transcendence,17.5,"Understanding, appreciation, tolerance, and protection for the welfare of all people and nature","I believe in equal opportunities and rights for everyone, regardless of background."
21+
universalism,self-transcendence,17.5,"Understanding, appreciation, tolerance, and protection for the welfare of all people and nature","Environmental protection and harmony with nature are essential principles for me."
22+
universalism,self-transcendence,17.5,"Understanding, appreciation, tolerance, and protection for the welfare of all people and nature","I try to understand and accept people who are different from me."
23+
universalism,self-transcendence,17.5,"Understanding, appreciation, tolerance, and protection for the welfare of all people and nature","I believe in social justice and care for the vulnerable in society."
24+
universalism,self-transcendence,17.5,"Understanding, appreciation, tolerance, and protection for the welfare of all people and nature","World peace and the welfare of all people matters deeply to me."
25+
universalism,self-transcendence,17.5,"Understanding, appreciation, tolerance, and protection for the welfare of all people and nature","I value wisdom and a mature understanding of life."
26+
benevolence,self-transcendence,15.6,"Preservation and enhancement of the welfare of people with whom one is in frequent personal contact","I go out of my way to be helpful and supportive to those close to me."
27+
benevolence,self-transcendence,15.6,"Preservation and enhancement of the welfare of people with whom one is in frequent personal contact","Being loyal and devoted to friends and loved ones is very important to me."
28+
benevolence,self-transcendence,15.6,"Preservation and enhancement of the welfare of people with whom one is in frequent personal contact","Honesty and sincerity in my relationships is a core principle for me."
29+
benevolence,self-transcendence,15.6,"Preservation and enhancement of the welfare of people with whom one is in frequent personal contact","I value true friendship and deep, meaningful relationships."
30+
benevolence,self-transcendence,15.6,"Preservation and enhancement of the welfare of people with whom one is in frequent personal contact","Forgiveness and understanding are virtues I try to practice."
31+
tradition,conservation,7.3,"Respect, commitment to, and acceptance of the customs and ideas that one's culture or religion provides","I value traditional practices and customs that have been passed down through generations."
32+
tradition,conservation,7.3,"Respect, commitment to, and acceptance of the customs and ideas that one's culture or religion provides","Religious faith and observance of cultural traditions guide my life decisions."
33+
tradition,conservation,7.3,"Respect, commitment to, and acceptance of the customs and ideas that one's culture or religion provides","I believe in moderation and avoiding extremes in life and behavior."
34+
conformity,conservation,7.5,"Restraint of actions, inclinations, and impulses likely to upset or harm others and violate social expectations or norms","I try to follow rules and meet social expectations in how I behave."
35+
conformity,conservation,7.5,"Restraint of actions, inclinations, and impulses likely to upset or harm others and violate social expectations or norms","I believe it's important to be polite and avoid behavior others might find offensive."
36+
conformity,conservation,7.5,"Restraint of actions, inclinations, and impulses likely to upset or harm others and violate social expectations or norms","Self-discipline and resisting temptation are virtues I strive to maintain."
37+
security,conservation,11.6,"Safety, harmony, and stability of society, relationships, and self","I prioritize safety and stability in my personal life and in society."
38+
security,conservation,11.6,"Safety, harmony, and stability of society, relationships, and self","National security and social order are essential for a well-functioning society."
39+
security,conservation,11.6,"Safety, harmony, and stability of society, relationships, and self","I value cleanliness and orderliness in my environment."
40+
security,conservation,11.6,"Safety, harmony, and stability of society, relationships, and self","Family security and protecting loved ones is a top priority for me."
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Value Framework Visualization Script
4+
5+
This script demonstrates visualization of different value frameworks for comparison.
6+
It reads the example value datasets and creates comparative visualizations.
7+
"""
8+
9+
import pandas as pd
10+
import matplotlib.pyplot as plt
11+
import numpy as np
12+
import os
13+
import sys
14+
from pathlib import Path
15+
16+
# Add the project root to the path so we can import the package
17+
sys.path.insert(0, str(Path(__file__).parent.parent))
18+
19+
def load_data():
20+
"""Load the sample value datasets."""
21+
base_dir = Path(__file__).parent.parent / "data" / "values" / "examples"
22+
23+
# Load AI assistant values
24+
ai_values_path = base_dir / "value_expressions.csv"
25+
ai_values = pd.read_csv(ai_values_path)
26+
27+
# Load Schwartz human values
28+
schwartz_path = base_dir / "schwartz_values.csv"
29+
schwartz_values = pd.read_csv(schwartz_path)
30+
31+
return ai_values, schwartz_values
32+
33+
def preprocess_ai_values(ai_values):
34+
"""Process the AI values for visualization."""
35+
# Group by value and take the first percentage for each
36+
ai_summary = ai_values.groupby('value')['percentage'].first().reset_index()
37+
# Sort by percentage descending
38+
ai_summary = ai_summary.sort_values('percentage', ascending=False)
39+
return ai_summary
40+
41+
def preprocess_schwartz_values(schwartz_values):
42+
"""Process the Schwartz values for visualization."""
43+
# Group by value and take the first weight for each
44+
schwartz_summary = schwartz_values.groupby('value')['weight'].first().reset_index()
45+
# Sort by weight descending
46+
schwartz_summary = schwartz_summary.sort_values('weight', ascending=False)
47+
return schwartz_summary
48+
49+
def plot_top_values(ai_summary, schwartz_summary, output_dir):
50+
"""Create a bar chart of top values from each framework."""
51+
# Take top 10 values from each
52+
ai_top = ai_summary.head(10)
53+
schwartz_top = schwartz_summary.head(10)
54+
55+
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 6))
56+
57+
# Plot AI values
58+
ax1.bar(ai_top['value'], ai_top['percentage'], color='skyblue')
59+
ax1.set_title('Top 10 AI Assistant Values')
60+
ax1.set_ylabel('Percentage')
61+
ax1.set_xlabel('Value')
62+
ax1.tick_params(axis='x', rotation=45)
63+
64+
# Plot Schwartz values
65+
ax2.bar(schwartz_top['value'], schwartz_top['weight'], color='lightgreen')
66+
ax2.set_title('Top 10 Schwartz Human Values')
67+
ax2.set_ylabel('Weight')
68+
ax2.set_xlabel('Value')
69+
ax2.tick_params(axis='x', rotation=45)
70+
71+
plt.tight_layout()
72+
plt.savefig(os.path.join(output_dir, 'top_values_comparison.png'))
73+
plt.close()
74+
75+
def plot_schwartz_dimensions(schwartz_values, output_dir):
76+
"""Create a visualization of the Schwartz higher-order dimensions."""
77+
# Group by higher order dimension and sum weights
78+
dimensions = schwartz_values.groupby('higher_order_dimension')['weight'].sum().reset_index()
79+
80+
# Create a pie chart
81+
plt.figure(figsize=(10, 10))
82+
plt.pie(dimensions['weight'], labels=dimensions['higher_order_dimension'],
83+
autopct='%1.1f%%', startangle=90, colors=['#ff9999','#66b3ff','#99ff99','#ffcc99'])
84+
plt.axis('equal')
85+
plt.title('Schwartz Higher-Order Value Dimensions')
86+
plt.savefig(os.path.join(output_dir, 'schwartz_dimensions.png'))
87+
plt.close()
88+
89+
def plot_value_distributions(ai_summary, schwartz_summary, output_dir):
90+
"""Create a visualization comparing value distributions."""
91+
# Normalize weights to percentages for comparison
92+
schwartz_summary['normalized'] = schwartz_summary['weight'] / schwartz_summary['weight'].sum() * 100
93+
94+
plt.figure(figsize=(12, 6))
95+
96+
# Plot kernel density estimates
97+
ai_density = ai_summary['percentage']
98+
schwartz_density = schwartz_summary['normalized']
99+
100+
plt.hist(ai_density, alpha=0.5, label='AI Assistant Values', bins=10, density=True)
101+
plt.hist(schwartz_density, alpha=0.5, label='Schwartz Human Values', bins=10, density=True)
102+
103+
plt.title('Distribution of Value Weights')
104+
plt.xlabel('Percentage/Normalized Weight')
105+
plt.ylabel('Density')
106+
plt.legend()
107+
plt.savefig(os.path.join(output_dir, 'value_distributions.png'))
108+
plt.close()
109+
110+
def main():
111+
"""Main function to create visualizations."""
112+
print("Visualizing value frameworks...")
113+
114+
# Create output directory
115+
output_dir = Path(__file__).parent.parent / "data" / "output"
116+
output_dir.mkdir(exist_ok=True)
117+
118+
# Load and process data
119+
ai_values, schwartz_values = load_data()
120+
ai_summary = preprocess_ai_values(ai_values)
121+
schwartz_summary = preprocess_schwartz_values(schwartz_values)
122+
123+
# Create visualizations
124+
plot_top_values(ai_summary, schwartz_summary, output_dir)
125+
plot_schwartz_dimensions(schwartz_values, output_dir)
126+
plot_value_distributions(ai_summary, schwartz_summary, output_dir)
127+
128+
print(f"Visualizations created in {output_dir}")
129+
130+
if __name__ == "__main__":
131+
main()

0 commit comments

Comments
 (0)