Skip to content

Commit f1f5fe9

Browse files
authored
Merge pull request #52 from DevComPsy/feature/datasets
feature/datasets - add scavenger example dataset
2 parents 18b69ea + 120e333 commit f1f5fe9

File tree

3 files changed

+400
-16
lines changed

3 files changed

+400
-16
lines changed

cpm/datasets/base.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,42 @@ def load_bandit_data():
4747
-----
4848
The dataset will include the following columns:
4949
50-
- `ppt`: the participant number.
51-
- `trial`: the trial number.
52-
- `arm_left`: the stimulus presented on the left side.
53-
- `arm_right`: the stimulus presented on the right side.
50+
- `index`: variable to identify each row - this variable is clutter.
51+
- `left`: the stimulus presented on the left side.
52+
- `right`: the stimulus presented on the right side.
5453
- `reward_left`: the reward received when the left stimulus is selected.
5554
- `reward_right`: the reward received when the right stimulus is selected.
56-
- `response`: the response of the participant (1 for right, 0 for left).
57-
- `feedback`: the feedback received by the participant (1 for reward, 0 for no reward).
55+
- `ppt`: the participant number.
56+
- `responses`: the response of the participant (1 for right, 0 for left).
5857
"""
5958
return load_csv("bandit_small.csv")
6059

6160

62-
# def load_another_dataset():
63-
# """
64-
# Load another dataset from a CSV file.
61+
def load_risky_choices():
62+
"""
63+
Load the risky choices dataset from a CSV file.
64+
65+
Returns
66+
-------
67+
pd.DataFrame
68+
A pandas DataFrame containing the risky choices data.
69+
70+
Examples
71+
--------
72+
>>> data = load_risky_choices()
73+
>>> print(data.head())
6574
66-
# Returns
67-
# -------
68-
# pd.DataFrame
69-
# A pandas DataFrame containing the data from the CSV file.
70-
# """
71-
# return load_csv("another_dataset.csv")
75+
Notes
76+
-----
77+
The dataset will include the following columns:
7278
79+
- `ppt`: the participant number.
80+
- `safe_magnitudes`: the magnitudes of the safe option.
81+
- `risky_magnitudes_1`, `risky_magnitudes_2`: the magnitudes of the risky options.
82+
- `safe_prob`: the probability of the safe option.
83+
- `risky_prob_1`, `risky_prob_2`: the probabilities of the risky options.
84+
- `choice`: the choice of the participant (1 for risky, 0 for safe).
85+
- `chose_left`: whether the participant chose the left option (1 for left, 0 for right).
7386
74-
# Add more functions for other CSV files as needed
87+
"""
88+
return load_csv("risky_choices.csv")

cpm/datasets/data/risky_choices.csv

Lines changed: 301 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,301 @@
1+
ppt,safe_magnitudes,risky_magnitudes_1,risky_magnitudes_2,choice,chose_left,safe_prob,risky_prob_1,risky_prob_2
2+
593,-45,-100,0,0,0,1,0.5,0.5
3+
593,-55,-122,0,0,1,1,0.5,0.5
4+
593,-30,-51,0,1,0,1,0.5,0.5
5+
593,55,53,0,0,1,1,0.5,0.5
6+
593,-35,-64,0,1,0,1,0.5,0.5
7+
593,55,79,0,0,0,1,0.5,0.5
8+
593,55,124,0,1,1,1,0.5,0.5
9+
593,35,58,0,1,0,1,0.5,0.5
10+
593,30,220,0,1,1,1,0.5,0.5
11+
593,-55,-56,0,1,1,1,0.5,0.5
12+
593,-55,-68,0,1,1,1,0.5,0.5
13+
593,-35,-94,0,0,1,1,0.5,0.5
14+
593,-35,-112,0,0,0,1,0.5,0.5
15+
593,35,98,0,1,1,1,0.5,0.5
16+
593,-45,-110,0,0,0,1,0.5,0.5
17+
593,-45,-90,0,1,1,1,0.5,0.5
18+
593,55,51,0,0,0,1,0.5,0.5
19+
593,-55,-220,0,0,1,1,0.5,0.5
20+
593,55,113,0,1,1,1,0.5,0.5
21+
593,30,74,0,1,0,1,0.5,0.5
22+
593,35,98,0,1,1,1,0.5,0.5
23+
593,-35,-68,0,1,0,1,0.5,0.5
24+
593,-30,-120,0,0,0,1,0.5,0.5
25+
593,-35,-98,0,0,0,1,0.5,0.5
26+
593,-30,-60,0,1,0,1,0.5,0.5
27+
593,35,100,0,1,1,1,0.5,0.5
28+
593,-45,-49,0,1,0,1,0.5,0.5
29+
593,30,107,0,1,0,1,0.5,0.5
30+
593,35,87,0,1,1,1,0.5,0.5
31+
593,55,107,0,0,1,1,0.5,0.5
32+
593,-45,-132,0,0,0,1,0.5,0.5
33+
593,45,180,0,1,0,1,0.5,0.5
34+
593,30,100,0,1,0,1,0.5,0.5
35+
593,35,64,0,1,1,1,0.5,0.5
36+
593,30,49,0,1,1,1,0.5,0.5
37+
593,-35,-66,0,1,1,1,0.5,0.5
38+
593,55,66,0,0,0,1,0.5,0.5
39+
593,-35,-84,0,0,0,1,0.5,0.5
40+
593,35,107,0,1,1,1,0.5,0.5
41+
593,-35,-79,0,0,1,1,0.5,0.5
42+
593,-45,-84,0,1,0,1,0.5,0.5
43+
593,-55,-95,0,1,0,1,0.5,0.5
44+
593,-30,-53,0,1,1,1,0.5,0.5
45+
593,-45,-120,0,0,1,1,0.5,0.5
46+
593,35,85,0,1,1,1,0.5,0.5
47+
593,35,58,0,0,0,1,0.5,0.5
48+
593,-35,-66,0,1,1,1,0.5,0.5
49+
593,-30,-148,0,0,1,1,0.5,0.5
50+
593,45,102,0,1,1,1,0.5,0.5
51+
593,35,84,0,1,0,1,0.5,0.5
52+
593,55,98,0,0,0,1,0.5,0.5
53+
593,55,180,0,1,0,1,0.5,0.5
54+
593,55,108,0,0,0,1,0.5,0.5
55+
593,-35,-148,0,0,0,1,0.5,0.5
56+
593,-45,-117,0,0,0,1,0.5,0.5
57+
593,45,60,0,0,1,1,0.5,0.5
58+
593,35,66,0,0,0,1,0.5,0.5
59+
593,-35,-98,0,0,0,1,0.5,0.5
60+
593,45,124,0,1,1,1,0.5,0.5
61+
593,-55,-93,0,1,0,1,0.5,0.5
62+
595,55,74,0,0,0,1,0.5,0.5
63+
595,-55,-112,0,0,0,1,0.5,0.5
64+
595,-30,-97,0,1,1,1,0.5,0.5
65+
595,35,53,0,0,1,1,0.5,0.5
66+
595,30,180,0,1,1,1,0.5,0.5
67+
595,30,93,0,1,1,1,0.5,0.5
68+
595,30,58,0,0,1,1,0.5,0.5
69+
595,-30,-82,0,0,1,1,0.5,0.5
70+
595,30,112,0,1,1,1,0.5,0.5
71+
595,30,117,0,1,1,1,0.5,0.5
72+
595,-45,-58,0,1,1,1,0.5,0.5
73+
595,45,107,0,1,0,1,0.5,0.5
74+
595,30,56,0,0,1,1,0.5,0.5
75+
595,55,79,0,0,1,1,0.5,0.5
76+
595,55,57,0,0,1,1,0.5,0.5
77+
595,45,66,0,0,0,1,0.5,0.5
78+
595,-30,-180,0,0,0,1,0.5,0.5
79+
595,-55,-72,0,1,0,1,0.5,0.5
80+
595,-55,-117,0,0,0,1,0.5,0.5
81+
595,-30,-132,0,0,0,1,0.5,0.5
82+
595,35,94,0,1,1,1,0.5,0.5
83+
595,-45,-79,0,1,0,1,0.5,0.5
84+
595,-45,-74,0,1,0,1,0.5,0.5
85+
595,30,82,0,1,1,1,0.5,0.5
86+
595,-55,-140,0,0,1,1,0.5,0.5
87+
595,45,74,0,0,1,1,0.5,0.5
88+
595,55,87,0,0,0,1,0.5,0.5
89+
595,-30,-95,0,0,0,1,0.5,0.5
90+
595,45,56,0,0,1,1,0.5,0.5
91+
595,35,98,0,1,1,1,0.5,0.5
92+
595,55,220,0,1,0,1,0.5,0.5
93+
595,55,180,0,1,0,1,0.5,0.5
94+
595,-30,-76,0,0,0,1,0.5,0.5
95+
595,35,68,0,0,0,1,0.5,0.5
96+
595,-45,-102,0,0,0,1,0.5,0.5
97+
595,-30,-84,0,0,0,1,0.5,0.5
98+
595,-30,-58,0,1,0,1,0.5,0.5
99+
595,-55,-60,0,1,0,1,0.5,0.5
100+
595,45,94,0,1,0,1,0.5,0.5
101+
595,-55,-176,0,0,0,1,0.5,0.5
102+
595,-45,-74,0,1,1,1,0.5,0.5
103+
595,-35,-120,0,0,1,1,0.5,0.5
104+
595,35,70,0,0,0,1,0.5,0.5
105+
595,-45,-148,0,0,0,1,0.5,0.5
106+
595,-30,-76,0,0,0,1,0.5,0.5
107+
595,55,82,0,0,1,1,0.5,0.5
108+
595,-45,-55,0,0,0,1,0.5,0.5
109+
595,-30,-140,0,0,1,1,0.5,0.5
110+
595,45,87,0,1,0,1,0.5,0.5
111+
595,-30,-132,0,0,1,1,0.5,0.5
112+
595,-45,-87,0,1,1,1,0.5,0.5
113+
595,30,124,0,1,1,1,0.5,0.5
114+
595,-45,-74,0,1,0,1,0.5,0.5
115+
595,55,103,0,0,1,1,0.5,0.5
116+
595,35,94,0,1,0,1,0.5,0.5
117+
595,-35,-55,0,1,0,1,0.5,0.5
118+
595,-30,-72,0,0,0,1,0.5,0.5
119+
595,45,124,0,1,1,1,0.5,0.5
120+
595,45,140,0,1,1,1,0.5,0.5
121+
595,-45,-90,0,1,0,1,0.5,0.5
122+
597,30,85,0,0,1,1,0.5,0.5
123+
597,-30,-56,0,1,1,1,0.5,0.5
124+
597,55,144,0,1,1,1,0.5,0.5
125+
597,45,64,0,1,0,1,0.5,0.5
126+
597,-55,-93,0,1,1,1,0.5,0.5
127+
597,-55,-72,0,1,0,1,0.5,0.5
128+
597,-45,-98,0,1,1,1,0.5,0.5
129+
597,30,180,0,0,0,1,0.5,0.5
130+
597,-30,-108,0,0,1,1,0.5,0.5
131+
597,55,60,0,0,0,1,0.5,0.5
132+
597,45,64,0,0,0,1,0.5,0.5
133+
597,55,90,0,1,0,1,0.5,0.5
134+
597,55,110,0,0,0,1,0.5,0.5
135+
597,-30,-66,0,1,1,1,0.5,0.5
136+
597,45,55,0,0,0,1,0.5,0.5
137+
597,-55,-117,0,0,1,1,0.5,0.5
138+
597,30,84,0,1,0,1,0.5,0.5
139+
597,-45,-57,0,1,0,1,0.5,0.5
140+
597,30,66,0,1,0,1,0.5,0.5
141+
597,-30,-122,0,0,0,1,0.5,0.5
142+
597,35,100,0,1,0,1,0.5,0.5
143+
597,-30,-112,0,0,0,1,0.5,0.5
144+
597,-30,-97,0,0,1,1,0.5,0.5
145+
597,-55,-58,0,1,1,1,0.5,0.5
146+
597,-55,-79,0,1,0,1,0.5,0.5
147+
597,30,103,0,1,1,1,0.5,0.5
148+
597,-45,-103,0,1,0,1,0.5,0.5
149+
597,-30,-96,0,0,1,1,0.5,0.5
150+
597,-35,-74,0,0,1,1,0.5,0.5
151+
597,-55,-56,0,1,0,1,0.5,0.5
152+
597,30,93,0,1,0,1,0.5,0.5
153+
597,55,120,0,1,1,1,0.5,0.5
154+
597,45,62,0,0,1,1,0.5,0.5
155+
597,55,81,0,0,1,1,0.5,0.5
156+
597,-30,-76,0,1,1,1,0.5,0.5
157+
597,45,107,0,1,1,1,0.5,0.5
158+
597,-55,-148,0,0,1,1,0.5,0.5
159+
597,55,68,0,0,1,1,0.5,0.5
160+
597,-35,-180,0,1,1,1,0.5,0.5
161+
597,45,110,0,1,1,1,0.5,0.5
162+
597,-55,-176,0,0,1,1,0.5,0.5
163+
597,55,120,0,1,1,1,0.5,0.5
164+
597,35,102,0,1,0,1,0.5,0.5
165+
597,45,53,0,0,0,1,0.5,0.5
166+
597,-45,-57,0,1,0,1,0.5,0.5
167+
597,35,74,0,1,1,1,0.5,0.5
168+
597,55,96,0,0,0,1,0.5,0.5
169+
597,45,74,0,0,1,1,0.5,0.5
170+
597,45,220,0,1,0,1,0.5,0.5
171+
597,-30,-87,0,0,1,1,0.5,0.5
172+
597,-30,-55,0,0,1,1,0.5,0.5
173+
597,-45,-220,0,0,1,1,0.5,0.5
174+
597,-30,-94,0,1,1,1,0.5,0.5
175+
597,45,81,0,1,1,1,0.5,0.5
176+
597,45,180,0,1,1,1,0.5,0.5
177+
597,-35,-140,0,0,0,1,0.5,0.5
178+
597,35,79,0,1,0,1,0.5,0.5
179+
597,-55,-76,0,1,1,1,0.5,0.5
180+
597,-45,-74,0,1,1,1,0.5,0.5
181+
597,-55,-76,0,1,0,1,0.5,0.5
182+
614,-35,-95,0,0,1,1,0.5,0.5
183+
614,30,82,0,0,1,1,0.5,0.5
184+
614,45,117,0,0,0,1,0.5,0.5
185+
614,-35,-180,0,1,1,1,0.5,0.5
186+
614,45,124,0,0,0,1,0.5,0.5
187+
614,-45,-117,0,0,0,1,0.5,0.5
188+
614,35,220,0,1,0,1,0.5,0.5
189+
614,55,55,0,0,0,1,0.5,0.5
190+
614,55,62,0,0,1,1,0.5,0.5
191+
614,35,70,0,0,0,1,0.5,0.5
192+
614,30,93,0,0,1,1,0.5,0.5
193+
614,35,62,0,0,1,1,0.5,0.5
194+
614,-55,-49,0,1,0,1,0.5,0.5
195+
614,-35,-84,0,0,0,1,0.5,0.5
196+
614,-45,-53,0,1,1,1,0.5,0.5
197+
614,30,100,0,1,1,1,0.5,0.5
198+
614,-30,-220,0,1,0,1,0.5,0.5
199+
614,45,180,0,0,0,1,0.5,0.5
200+
614,-45,-56,0,1,0,1,0.5,0.5
201+
614,-45,-117,0,0,1,1,0.5,0.5
202+
614,-35,-49,0,1,1,1,0.5,0.5
203+
614,-30,-148,0,0,1,1,0.5,0.5
204+
614,30,108,0,1,1,1,0.5,0.5
205+
614,30,87,0,0,0,1,0.5,0.5
206+
614,-55,-66,0,1,1,1,0.5,0.5
207+
614,-30,-76,0,0,0,1,0.5,0.5
208+
614,35,100,0,0,0,1,0.5,0.5
209+
614,-35,-180,0,0,0,1,0.5,0.5
210+
614,-30,-64,0,0,1,1,0.5,0.5
211+
614,-55,-76,0,1,1,1,0.5,0.5
212+
614,35,112,0,1,0,1,0.5,0.5
213+
614,35,79,0,0,0,1,0.5,0.5
214+
614,45,56,0,0,1,1,0.5,0.5
215+
614,45,96,0,0,1,1,0.5,0.5
216+
614,45,72,0,0,1,1,0.5,0.5
217+
614,-30,-79,0,0,1,1,0.5,0.5
218+
614,-35,-82,0,1,1,1,0.5,0.5
219+
614,45,108,0,0,0,1,0.5,0.5
220+
614,30,57,0,0,1,1,0.5,0.5
221+
614,-35,-74,0,0,1,1,0.5,0.5
222+
614,45,56,0,0,1,1,0.5,0.5
223+
614,-30,-110,0,0,0,1,0.5,0.5
224+
614,30,140,0,0,1,1,0.5,0.5
225+
614,-55,-66,0,0,1,1,0.5,0.5
226+
614,45,49,0,0,0,1,0.5,0.5
227+
614,-45,-87,0,0,1,1,0.5,0.5
228+
614,30,60,0,0,0,1,0.5,0.5
229+
614,-55,-176,0,0,1,1,0.5,0.5
230+
614,-30,-57,0,0,1,1,0.5,0.5
231+
614,35,96,0,0,0,1,0.5,0.5
232+
614,45,102,0,0,0,1,0.5,0.5
233+
614,30,120,0,0,1,1,0.5,0.5
234+
614,-30,-98,0,0,0,1,0.5,0.5
235+
614,-30,-66,0,0,1,1,0.5,0.5
236+
614,-30,-85,0,0,1,1,0.5,0.5
237+
614,55,140,0,0,0,1,0.5,0.5
238+
614,-35,-124,0,0,1,1,0.5,0.5
239+
614,-30,-176,0,0,1,1,0.5,0.5
240+
614,-45,-94,0,0,0,1,0.5,0.5
241+
614,55,85,0,0,1,1,0.5,0.5
242+
616,-30,-220,0,1,1,1,0.5,0.5
243+
616,55,180,0,1,0,1,0.5,0.5
244+
616,-35,-108,0,0,0,1,0.5,0.5
245+
616,45,98,0,1,1,1,0.5,0.5
246+
616,-35,-102,0,0,0,1,0.5,0.5
247+
616,55,68,0,0,1,1,0.5,0.5
248+
616,-55,-49,0,1,0,1,0.5,0.5
249+
616,-35,-113,0,1,1,1,0.5,0.5
250+
616,35,112,0,1,1,1,0.5,0.5
251+
616,35,81,0,0,1,1,0.5,0.5
252+
616,30,98,0,1,0,1,0.5,0.5
253+
616,-30,-56,0,1,0,1,0.5,0.5
254+
616,30,110,0,1,0,1,0.5,0.5
255+
616,55,144,0,0,1,1,0.5,0.5
256+
616,35,64,0,0,0,1,0.5,0.5
257+
616,-45,-70,0,1,1,1,0.5,0.5
258+
616,-45,-93,0,0,0,1,0.5,0.5
259+
616,-45,-64,0,1,1,1,0.5,0.5
260+
616,-55,-180,0,0,0,1,0.5,0.5
261+
616,30,117,0,1,0,1,0.5,0.5
262+
616,55,112,0,1,1,1,0.5,0.5
263+
616,35,85,0,0,0,1,0.5,0.5
264+
616,-45,-100,0,1,0,1,0.5,0.5
265+
616,-55,-93,0,0,1,1,0.5,0.5
266+
616,-45,-66,0,0,0,1,0.5,0.5
267+
616,55,56,0,0,0,1,0.5,0.5
268+
616,-35,-124,0,0,1,1,0.5,0.5
269+
616,55,132,0,0,0,1,0.5,0.5
270+
616,-30,-72,0,0,1,1,0.5,0.5
271+
616,-45,-113,0,0,1,1,0.5,0.5
272+
616,55,55,0,0,0,1,0.5,0.5
273+
616,30,70,0,0,0,1,0.5,0.5
274+
616,-55,-117,0,0,1,1,0.5,0.5
275+
616,-55,-113,0,0,0,1,0.5,0.5
276+
616,35,51,0,0,0,1,0.5,0.5
277+
616,-35,-82,0,0,1,1,0.5,0.5
278+
616,30,98,0,0,0,1,0.5,0.5
279+
616,-35,-72,0,0,1,1,0.5,0.5
280+
616,-55,-117,0,0,1,1,0.5,0.5
281+
616,-30,-100,0,0,0,1,0.5,0.5
282+
616,-35,-100,0,0,0,1,0.5,0.5
283+
616,-55,-87,0,0,0,1,0.5,0.5
284+
616,30,81,0,1,0,1,0.5,0.5
285+
616,30,90,0,1,1,1,0.5,0.5
286+
616,30,85,0,1,0,1,0.5,0.5
287+
616,-35,-93,0,0,0,1,0.5,0.5
288+
616,-55,-97,0,1,1,1,0.5,0.5
289+
616,-35,-51,0,0,0,1,0.5,0.5
290+
616,35,98,0,1,1,1,0.5,0.5
291+
616,55,90,0,1,1,1,0.5,0.5
292+
616,45,124,0,1,0,1,0.5,0.5
293+
616,-45,-56,0,0,0,1,0.5,0.5
294+
616,30,180,0,1,0,1,0.5,0.5
295+
616,45,53,0,1,0,1,0.5,0.5
296+
616,45,53,0,1,1,1,0.5,0.5
297+
616,55,58,0,0,0,1,0.5,0.5
298+
616,30,103,0,1,1,1,0.5,0.5
299+
616,-30,-107,0,0,1,1,0.5,0.5
300+
616,-30,-58,0,0,0,1,0.5,0.5
301+
616,30,68,0,1,1,1,0.5,0.5

0 commit comments

Comments
 (0)