Skip to content

Commit

Permalink
Update docstrings of functions that convert between simple and log re…
Browse files Browse the repository at this point in the history
…turns (#128)
  • Loading branch information
mirca committed Mar 11, 2022
1 parent 70ebdf4 commit 8fb6976
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions deepdow/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,38 @@ def covariance(x, y):


def log2simple(x):
"""Turn simple returns into log returns.
"""Turn log returns into simple returns.
r_simple = exp(r_log) - 1.
Parameters
----------
x : torch.Tensor
Tensor of any shape where each entry represents a simple return.
Tensor of any shape where each entry represents a logarithmic return.
Returns
-------
torch.Tensor
Logarithmic returns.
Simple returns.
"""
return torch.exp(x) - 1


def simple2log(x):
"""Turn log returns into simple returns.
"""Turn simple returns into log returns.
r_log = ln(r_simple + 1).
Parameters
----------
x : torch.Tensor
Tensor of any shape where each entry represents a logarithmic return.
Tensor of any shape where each entry represents a simple return.
Returns
-------
torch.Tensor
Simple returns.
Logarithmic returns.
"""
return torch.log(x + 1)
Expand Down

0 comments on commit 8fb6976

Please sign in to comment.