Coverage for langbrainscore/interface/brainscore.py: 85%

13 statements  

« prev     ^ index     » next       coverage.py v6.4, created at 2022-06-07 21:22 +0000

1import typing 

2from abc import ABC, abstractmethod 

3from mimetypes import init 

4 

5import numpy as np 

6import xarray as xr 

7from langbrainscore.interface.mapping import _Mapping 

8from langbrainscore.interface.metric import _Metric 

9from langbrainscore.interface.cacheable import _Cacheable 

10 

11 

12class _BrainScore(_Cacheable, ABC): 

13 # class _BrainScore(ABC): 

14 """ 

15 evaluates a `Mapping` of `X` and `Y` using `Metric` 

16 """ 

17 

18 def __init__( 

19 self, X: xr.DataArray, Y: xr.DataArray, mapping: _Mapping, metric: _Metric 

20 ): 

21 pass 

22 

23 def score(self) -> xr.DataArray: 

24 """ 

25 applies mapping to (X, Y), then evaluates using metric 

26 

27 Returns: 

28 xr.DataArray: scores 

29 """ 

30 raise NotImplementedError