spaCy/spacy/_ml.pxd

37 lines
1.2 KiB
Cython
Raw Normal View History

2017-03-14 23:28:43 +03:00
from thinc.linear.features cimport ConjunctionExtracter
from thinc.typedefs cimport atom_t, weight_t
from thinc.structs cimport FeatureC
2017-03-24 02:23:32 +03:00
from libc.stdint cimport uint32_t, uint64_t
2017-03-14 23:28:43 +03:00
cimport numpy as np
from cymem.cymem cimport Pool
2017-03-24 02:23:32 +03:00
from libcpp.vector cimport vector
2017-03-14 23:28:43 +03:00
cdef class LinearModel:
cdef ConjunctionExtracter extracter
cdef readonly int nr_class
cdef readonly uint32_t nr_weight
cdef public weight_t learn_rate
2017-03-30 03:35:36 +03:00
cdef public weight_t momentum
2017-03-14 23:28:43 +03:00
cdef Pool mem
2017-03-30 03:35:36 +03:00
cdef weight_t time
2017-03-14 23:28:43 +03:00
cdef weight_t* W
2017-03-30 03:35:36 +03:00
cdef weight_t* mom
cdef weight_t* averages
cdef weight_t* last_upd
2017-03-14 23:28:43 +03:00
cdef void hinge_lossC(self, weight_t* d_scores,
const weight_t* scores, const weight_t* costs) nogil
cdef void log_lossC(self, weight_t* d_scores,
const weight_t* scores, const weight_t* costs) nogil
cdef void regression_lossC(self, weight_t* d_scores,
const weight_t* scores, const weight_t* costs) nogil
cdef void set_scoresC(self, weight_t* scores,
const FeatureC* features, int nr_feat) nogil
cdef void set_gradientC(self, const weight_t* d_scores, const FeatureC*
features, int nr_feat) nogil