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
def kelly_loss(c_assets, r_assets, spreads, spread_loss): | |
""" | |
Maximizes exponential rate of wealth growth | |
NOTE: the samples must be in the same order. | |
the assumption is that the returns are realized | |
in the same way. | |
Args: |
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
// Do a shifted/scaled fourier transform of polarization in each direction. | |
mat Fourier(const mat& pol, double zoom = 1.0/20.0, int axis=0, bool dering=true) const | |
{ | |
cout << "Computing Fourier Transform ..." << endl; | |
mat tore; | |
double dt = pol(3,0)-pol(2,0); | |
{ | |
int ndata = (pol.n_rows%2==0)? pol.n_rows : pol.n_rows-1; // Keep an even amount of data | |
for (int r=1; r<ndata; ++r) |
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
def slerp(v0, v1, t=0.05): | |
""" | |
Interpolate between quaternions v0 and v1. | |
""" | |
v0 = safe_normalize(v0) | |
v1 = safe_normalize(v1) | |
dot = tf.reduce_sum(v0*v1,axis=-1,keepdims=True) | |
# If the dot product is negative, slerp won't take | |
# the shorter path. Note that v1 and -v1 are equivalent when | |
# the negation is applied to all four components. Fix by |
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
// **************************************************************************** | |
// Customizable Smartphone Holders | |
// to mount your smartphone to a tripod or elsewhere using an action cam hook | |
// Author: Peter Holzwarth | |
// **************************************************************************** | |
// https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language | |
SmartphoneHolder([PhoneName, PhoneWidth, PhoneHeight, PhoneDepth, | |
PhoneCornerRoundingRadius, PhoneEdgeRoundingRadius, | |
PhoneCamPos, CamSlotHeight], MountPos); |
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
class Neural_Density(torch.nn.Module): | |
""" | |
A neural model of a time dependent probability density on | |
a vector valued state-space. | |
ie: rho(t,{x_0, x_1, ... x_{state_dim}}) | |
for now, I'm not even enforcing normalization. | |
could with a gaussian mixture or whatever. | |
""" |