Пример #1
0
import numpy as np
from scipy.linalg import norm
import fdasrsf as fs
import oclogit_warp as lw
import h5py

fun = h5py.File('/home/dtucker/fdasrsf/debug/debug_data_oc_logit.h5')
q = fun['q'][:]
y = fun['y'].value
alpha = fun['alpha'].value
nu = fun['nu'][:]

max_itr = 9000  # 4000
tol = 1e-4
deltag = .05
deltaO = .1
display = 1

q, scale = fs.scale_curve(q)  # q/norm(q)
nu, scale = fs.scale_curve(nu)  # nu/norm(nu)

gam_old, O_old = lw.oclogit_warp(np.ascontiguousarray(alpha),
                                 np.ascontiguousarray(nu),
                                 np.ascontiguousarray(q),
                                 np.ascontiguousarray(y, dtype=np.int32),
                                 max_itr, tol, deltaO, deltag, display)
Пример #2
0
import h5py

fun = h5py.File('/home/dtucker/fdasrsf/debug_data_oc_mlogit.h5')
q = fun['q'][:]
y = fun['y'][:]
alpha = fun['alpha'][:]
nu = fun['nu'][:]

max_itr = 8000  # 4000
tol = 1e-4
deltag = .05
deltaO = .08
display = 1

alpha = alpha/norm(alpha)
q, scale = fs.scale_curve(q)  # q/norm(q)
for ii in range(0, nu.shape[2]):
    nu[:, :, ii], scale = fs.scale_curve(nu[:, :, ii])  # nu/norm(nu)

# python code
n = q.shape[0]
TT = q.shape[1]
m = nu.shape[2]
time = np.linspace(0, 1, TT)
binsize = 1. / (TT - 1)

gam = np.linspace(0, 1, TT)
O = np.eye(n)
O_old = O.copy()
gam_old = gam.copy()
qtilde = q.copy()
Пример #3
0
from scipy.linalg import norm, expm
import h5py

fun = h5py.File('/Users/jderektucker/Documents/Research/fdasrsf/debug/debug_data_oc_logit.h5')
q = fun['q'][:]
y = fun['y'].value
alpha = fun['alpha'].value
nu = fun['nu'][:]

max_itr = 8000  # 4000
tol = 1e-4
deltag = .05
deltaO = .1
display = 1

q, scale = fs.scale_curve(q)
nu, scale = fs.scale_curve(nu)

# python code
n = q.shape[0]
TT = q.shape[1]
time = np.linspace(0, 1, TT)
binsize = 1. / (TT - 1)

gam = np.linspace(0, 1, TT)
O = np.eye(n)
O_old = O.copy()
gam_old = gam.copy()
qtilde = q.copy()
# warping basis (Fourier)
p = 20