File size: 4,142 Bytes
1f95838
be2d1ce
 
cd3d0d9
1f95838
be2d1ce
 
cd3d0d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1f95838
be2d1ce
 
 
 
 
1f95838
f5b5398
be2d1ce
 
 
1f95838
be2d1ce
 
 
1f95838
be2d1ce
 
 
 
f5b5398
 
 
 
1f95838
be2d1ce
f5b5398
 
 
 
1f95838
be2d1ce
1f95838
be2d1ce
1f95838
be2d1ce
1f95838
be2d1ce
 
 
 
 
 
1f95838
be2d1ce
 
 
 
 
1f95838
be2d1ce
 
1f95838
be2d1ce
1f95838
0c8e556
 
be2d1ce
1f95838
0c8e556
be2d1ce
1f95838
be2d1ce
1f95838
be2d1ce
1f95838
be2d1ce
 
1f95838
be2d1ce
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
---
language:
- en
license: cc-by-nc-nd-4.0
library_name: transformers
pipeline_tag: text-classification
widget:
- text: Mr. Jones, an architect is going to surprise his family by building them a
    new house.
  example_title: Pow
- text: They want the research to go well and be productive.
  example_title: Ach
- text: The man is trying to see a friend on board, but the officer will not let him
    go as the whistle for all ashore who are not going has already blown.
  example_title: Aff
- text: The recollection of skating on the Charles, and the time she had pushed me
    through the ice, brought a laugh to the conversation; but it quickly faded in
    the murky waters of the river that could no longer freeze over.
  example_title: Pow + Aff
- text: They are also well-known research scientists and are quite talented in this
    field.
  example_title: Pow + Ach
- text: After a nice evening with his family, he will be back at work tomorrow, doing
    the best job he can on his drafting.
  example_title: Ach + Aff
- text: She is surprised that she is able to make these calls and pleasantly surprised
    that her friends respond to her request.
  example_title: Pow + Aff
---
This is an updated version of [https://huggingface.co/encodingai/electra-base-discriminator-im-multilabel](https://huggingface.co/encodingai/electra-base-discriminator-im-multilabel),
reported in [Pang & Ring (2020)](https://rdcu.be/b38pm) 
and found at [implicitmotives.com](https://implicitmotives.com). The classifier identifies the 
presence of implicit motive imagery in sentences, namely the three felt needs for Power, Achievement, 
and Affiliation.

The current classifier is finetuned from ELECTRA-base and achieves > 0.90 ICC on the 
Winter (1994) training data (see the [OSF repo](https://osf.io/aurwb/) for the benchmark dataset). 
Development of this classifier is ongoing, and the current version has been trained on a larger and 
more diverse dataset, which means it generalizes better to unseen data.

This model is being made available to other researchers for inference via a Huggingface api. The 
current license allows for free use without modification for non-commercial purposes. If you would 
like to use this model commercially, get in touch with us for access to our most recent model.

```
Predictions on Winter manual dataset
-----
Intra-class Correlation Coefficient:
| Pow (Label_0): | 0.90469 |
| Ach (Label_1): | 0.93134 |
| Aff (Label_2): | 0.88893 |
| mean: | 0.90815 |

Pearson correlations:
| Pow (Label_0): 0.81604 |
| Ach (Label_1): 0.85726 |
| Aff (Label_2): 0.77257 |
| mean: 0.81455 |

```

## Inference guide

The inference api requires a Huggingface token. The sample code below illustrates how it can be used to classify individual sentences.

```python
import json
import requests
api_key = "<HF Token>"
headers = {"Authorization": f"Bearer {api_key}"}
api_url = "https://api.url.here"

# This is a sentence from the Winter manual that is dual-scored for both Pow and Aff
prompt = """The recollection of skating on the Charles, and the time she had
            pushed me through the ice, brought a laugh to the conversation; but
            it quickly faded in the murky waters of the river that could no
            longer freeze over."""

# Since this is a multilabel classifier, we want to return scores for the top 3 labels
data = {"inputs": prompt, "parameters": {"top_k": 3}}

response = requests.request("POST", api_url, headers=headers, json=data)

# Print the labels and scores (arranged in order of likelihood)
scores = {x['label']: x['score'] for x in response.json()}
print(scores)

# {'Aff': 0.999998927116394, 'Pow': 0.999890923500061, 'Ach': 5.351924119167961e-05}
```

## References

McClelland, D. C. (1965). Toward a theory of motive acquisition. American Psychologist, 20,321-333.

Pang, J. S., & Ring, H. (2020). Automated Coding of Implicit Motives: A Machine-Learning Approach. 
Motivation and Emotion, 44(4), 549-566. DOI: 10.1007/s11031-020-09832-8.

Winter, D.G. (1994). Manual for scoring motive imagery in running text. Unpublished Instrument. Ann Arbor: University of Michigan.