-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7fd479
commit bd010d6
Showing
7 changed files
with
182 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
import torch | ||
|
||
|
||
class GeneralizedPareto: | ||
""" | ||
Representing all functionalities tied to a generalized pareto distribution. The object is instantiated in the | ||
file, used by importing the file and using the instance of 'gp' ('generalized pareto'). | ||
""" | ||
|
||
@staticmethod | ||
def pdf(x: torch.Tensor, xi: torch.Tensor, beta: torch.Tensor) -> torch.Tensor: | ||
if xi == 0: | ||
return 1 / beta * torch.exp(-x / beta) | ||
else: | ||
return 1 / beta * (1 + xi / beta * x) ** (-1 / xi - 1) | ||
|
||
@staticmethod | ||
def cdf(x: torch.Tensor, xi: torch.Tensor, beta: torch.Tensor) -> torch.Tensor: | ||
if xi == 0: | ||
return 1 - torch.exp(-x / beta) | ||
else: | ||
return 1 - (1 + xi / beta * x) ** (-1 / xi) | ||
|
||
|
||
gp = GeneralizedPareto() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters