Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HSS misbehaves for certain data types. #6

Open
Debasish-Mahapatra opened this issue Apr 6, 2024 · 1 comment
Open

HSS misbehaves for certain data types. #6

Debasish-Mahapatra opened this issue Apr 6, 2024 · 1 comment
Assignees

Comments

@Debasish-Mahapatra
Copy link
Owner

Debasish-Mahapatra commented Apr 6, 2024

Executing HSS gives the following Traceback,

433 def compute_bss(self, threshold, dim=None): 434 """ --> 
435 Compute the Brier Skill Score (BSS) for a given threshold. 
436 
437 Args: 
438 threshold (float): The threshold value for binary classification. 
439 dim (str, list, or None): The dimension(s) along which to compute the BSS. 
440 If None, compute the BSS over the entire data. 
441 
442 Returns: 
443 xarray.DataArray: The computed BSS values. 
444 """ 
445 # Convert data to binary based on the threshold 
446 obs_binary = (self.obs_data >= threshold).astype(int) 

...

2299 ) 
2300 result = Variable(dims, new_data, attrs=attrs) 
2301 return result

TypeError: numpy boolean subtract, the - operator, is not supported, use the bitwise_xor, the ^ operator, or the logical_xor function instead.

@harry9713 any idea why, can you check this a bit as well?

@Debasish-Mahapatra Debasish-Mahapatra self-assigned this Apr 6, 2024
@Debasish-Mahapatra
Copy link
Owner Author

Scratch that, the error seems to come from here,

 tn, fp, fn, tp = self.confusion_matrix(obs_binary, model_binary, dim)
    # Calculate the HSS
---> hss = 2 * (tp * tn - fp * fn) / ((tp + fn) * (fn + tn) + (tp + fp) * (fp + tn))
    return hss

which actually makes sense.

@Debasish-Mahapatra Debasish-Mahapatra changed the title FSS misbehaves for certain data types. HSS misbehaves for certain data types. Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant