-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtilecode.pxd
More file actions
148 lines (105 loc) · 4 KB
/
tilecode.pxd
File metadata and controls
148 lines (105 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
cimport numpy as np
import numpy as np
cimport cython
from libc.math cimport fmin as c_min
from libc.math cimport fmax as c_max
from libc.math cimport log as c_log
from libc.math cimport exp as c_exp
from libc.math cimport sin as c_sin
from libc.math cimport cos as c_cos
from libc.stdlib cimport abs as c_abs
cdef extern from "fastonebigheader.h":
double c_log_approx "fastlog" (double)
cdef extern from "vfastexp2.h":
double c_exp "EXP" (double)
cdef extern from "fastonebigheader.h":
double c_exp_approx "fastexp" (double)
cdef extern from "fast_floattoint.h" nogil:
int c_int "Real2Int" (double)
cdef class Tilecode:
cdef public double countsuminv
cdef public int[:,:] neigh_idx
cdef public int[:] neigh_count
cdef public int N, D, L, n, XSN
cdef public int[:] T, lin_T
cdef public double Linv
cdef public double[:] Tinv
cdef public double[:] Y
cdef public double[:,:] X
cdef public double[:] a, b, d
cdef public double[:, :] lin_w # Linear coefficients
cdef public double[:, :] lin_c
cdef public double[:] lin_width
cdef public double[:, :] offset
cdef public double[:] w
cdef public double[:] wav
cdef public int[:] count
cdef public int[:] key
cdef public int[:] hashidx
cdef public int[:] datahash
cdef public int[:] datastruct
cdef public int[:,:] datastruct_reverse
cdef public int max_neigh
cdef public int SIZE
cdef public int mem_max
cdef public int dohash
cdef public int lin_SIZE
cdef public int[:] flat
cdef int[:] tempidx
cdef public double R2
cdef double[:,:] XS_zero
cdef public int[:] extrap
cdef int[:] extrap_zero
cdef int lin_spline
cdef int min_sample
cdef public int CORES
cdef double[:,:] xs
cdef public double[:,:] XS
cdef public int[:] extrapXS
cdef public double[:] fastvalues
cdef public int asgd
cdef public double eta
cdef public double scale
cdef public int sgd
cdef double[:,:] scale_X(self, double[:,:] X, int N, double[:,:] XS)
cdef int[:] check_extrap(self, double[:,:] XS, int N, int[:] extrap)
cdef void fit_tiles(self, double[:,:] X, double[:] Y)
cdef void fit_sgd(self, double[:,:] X, double[:] Y, double eta, double scale, int n_iters, int ASGD)
cdef void fit_linear(self, double[:,:] X, double[:] Y)
cdef double[:,:] matrix_values(self, double[:,:,:] X, int N1, int N2, double[:,:] values, double[:,:, :] XS, double[:,:] Xi)
cdef double one_value(self, double[:] x)
cdef double[:] N_values(self, double[:,:] X, int N, double[:] values, double[:,:] XS)
cdef double[:] N_values_policy(self, double[:,:] X, int N, double[:] values, int[:] extrap)
cdef void fit_data(self, double[:,:] X, int[:] countsofar)
#cdef double[:] local_quadratic(self, double[:, :] X, int N)
cdef void fit_data_reverse(self, double[:,:] X, int N, int[:] extrap)
cpdef partial_fit(self, double[:] Y, int copy)
cpdef double one_value_pdf(self, double[:] X)
cdef class Function_Group:
cdef public int N, D, L, N_low # Here N is number of users
cdef double Linv
cdef public int[:] T
cdef public double[:] Tinv
cdef public int lin_T
cdef public double[:, :] a
cdef public double[:, :] b
cdef public double[:, :] d
cdef public double[:, :, :] lin_w # Linear coefficients
cdef public double[:, :, :] lin_c
cdef public double[:] lin_width
cdef public double[:,:] offset
cdef public int linval
cdef public int min_sample
cdef public int mem_max
cdef public double[:,:] w
cdef public int[:,:] count
cdef public int[:,:] key
cdef public int SIZE
cdef public int lin_SIZE
cdef public int[:] flat
cdef double[:] xs_zeros
cdef double[:,:] XS
cdef int[:] keyi
cdef public double[:] extrap
cdef void scale_X(self, double[:,:] X, int N)
cpdef double[:] get_values(self, double[:,:] x, double[:] values)