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
|
"""Dataset abstractions for sequential data access. """
cimport numpy as np
ctypedef np.float64_t DOUBLE
ctypedef np.int32_t INTEGER
cdef class SequentialDataset:
cdef Py_ssize_t n_samples
cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr,
int *nnz, DOUBLE *y, DOUBLE *sample_weight)
cdef void shuffle(self, seed)
cdef class ArrayDataset(SequentialDataset):
cdef Py_ssize_t n_features
cdef int current_index
cdef int stride
cdef DOUBLE *X_data_ptr
cdef DOUBLE *Y_data_ptr
cdef np.ndarray feature_indices
cdef INTEGER *feature_indices_ptr
cdef np.ndarray index
cdef INTEGER *index_data_ptr
cdef DOUBLE *sample_weight_data
cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr,
int *nnz, DOUBLE *y, DOUBLE *sample_weight)
cdef void shuffle(self, seed)
cdef class CSRDataset(SequentialDataset):
cdef int current_index
cdef int stride
cdef DOUBLE *X_data_ptr
cdef INTEGER *X_indptr_ptr
cdef INTEGER *X_indices_ptr
cdef DOUBLE *Y_data_ptr
cdef np.ndarray feature_indices
cdef INTEGER *feature_indices_ptr
cdef np.ndarray index
cdef INTEGER *index_data_ptr
cdef DOUBLE *sample_weight_data
cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr,
int *nnz, DOUBLE *y, DOUBLE *sample_weight)
cdef void shuffle(self, seed)
|