Error in per class precision computation 
{'login': 'tidhamecha2', 'id': 38906722, 'node_id': 'MDQ6VXNlcjM4OTA2NzIy', 'avatar_url': 'https://avatars.githubusercontent.com/u/38906722?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/tidhamecha2', 'html_url': 'https://github.com/tidhamecha2', 'followers_url': 'https://api.github.com/users/tidhamecha2/followers', 'following_url': 'https://api.github.com/users/tidhamecha2/following{/other_user}', 'gists_url': 'https://api.github.com/users/tidhamecha2/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/tidhamecha2/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/tidhamecha2/subscriptions', 'organizations_url': 'https://api.github.com/users/tidhamecha2/orgs', 'repos_url': 'https://api.github.com/users/tidhamecha2/repos', 'events_url': 'https://api.github.com/users/tidhamecha2/events{/privacy}', 'received_events_url': 'https://api.github.com/users/tidhamecha2/received_events', 'type': 'User', 'site_admin': False}
[{'id': 1935892857, 'node_id': 'MDU6TGFiZWwxOTM1ODkyODU3', 'url': 'https://api.github.com/repos/huggingface/datasets/labels/bug', 'name': 'bug', 'color': 'd73a4a', 'default': True, 'description': "Something isn't working"}]
[]
Hi @tidhamecha2, thanks for reporting.

Indeed, we fixed this issue just one week ago: #3008

The fix will be included in our next version release.

In the meantime, you can incorporate the fix by installing `datasets` from the master branch:
```
pip install -U git+ssh://git@github.com/huggingface/datasets.git@master#egg=datasest
```
or
```
pip install -U git+https://github.com/huggingface/datasets.git@master#egg=datasets
```
## Describe the bug
When trying to get the per class precision values by providing `average=None`, following error is thrown `ValueError: can only convert an array of size 1 to a Python scalar`

## Steps to reproduce the bug
```python
from datasets import load_dataset, load_metric
precision_metric = load_metric("precision")
predictions = [0, 2, 1, 0, 0, 1]
references = [0, 1, 2, 0, 1, 2]
results = precision_metric.compute(predictions=predictions, references=references, average=None)
```

## Expected results
`  {'precision': array([0.66666667, 0.        , 0.        ])}`
as per https://github.com/huggingface/datasets/blob/master/metrics/precision/precision.py

## Actual results
```
   output = self._compute(predictions=predictions, references=references, **kwargs)
  File "~/.cache/huggingface/modules/datasets_modules/metrics/precision/94709a71c6fe37171ef49d3466fec24dee9a79846c9f176dff66a649e9811690/precision.py", line 110, in _compute
    sample_weight=sample_weight,
ValueError: can only convert an array of size 1 to a Python scalar
```

## Environment info
<!-- You can run the command `datasets-cli env` and copy-and-paste its output below. -->
- `datasets` version: 1.12.1
- Platform: linux
- Python version: 3.6.9
- PyArrow version: 5.0.0

{'url': 'https://api.github.com/repos/huggingface/datasets/issues/3057/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}