Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
e1a02ab3
Unverified
Commit
e1a02ab3
authored
Oct 02, 2018
by
Guolin Ke
Committed by
GitHub
Oct 02, 2018
Browse files
fix indices type in csr and csc (#1719)
* fix indices type in csr and csc * fix
parent
87c39dec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+12
-0
No files found.
python-package/lightgbm/basic.py
View file @
e1a02ab3
...
@@ -548,6 +548,9 @@ class _InnerPredictor(object):
...
@@ -548,6 +548,9 @@ class _InnerPredictor(object):
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csr
.
indptr
)
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csr
.
indptr
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csr
.
data
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csr
.
data
)
assert
csr
.
shape
[
1
]
<=
MAX_INT32
csr
.
indices
=
csr
.
indices
.
astype
(
np
.
int32
,
copy
=
False
)
_safe_call
(
_LIB
.
LGBM_BoosterPredictForCSR
(
_safe_call
(
_LIB
.
LGBM_BoosterPredictForCSR
(
self
.
handle
,
self
.
handle
,
ptr_indptr
,
ptr_indptr
,
...
@@ -596,6 +599,9 @@ class _InnerPredictor(object):
...
@@ -596,6 +599,9 @@ class _InnerPredictor(object):
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csc
.
indptr
)
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csc
.
indptr
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csc
.
data
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csc
.
data
)
assert
csc
.
shape
[
0
]
<=
MAX_INT32
csc
.
indices
=
csc
.
indices
.
astype
(
np
.
int32
,
copy
=
False
)
_safe_call
(
_LIB
.
LGBM_BoosterPredictForCSC
(
_safe_call
(
_LIB
.
LGBM_BoosterPredictForCSC
(
self
.
handle
,
self
.
handle
,
ptr_indptr
,
ptr_indptr
,
...
@@ -888,6 +894,9 @@ class Dataset(object):
...
@@ -888,6 +894,9 @@ class Dataset(object):
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csr
.
indptr
)
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csr
.
indptr
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csr
.
data
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csr
.
data
)
assert
csr
.
shape
[
1
]
<=
MAX_INT32
csr
.
indices
=
csr
.
indices
.
astype
(
np
.
int32
,
copy
=
False
)
_safe_call
(
_LIB
.
LGBM_DatasetCreateFromCSR
(
_safe_call
(
_LIB
.
LGBM_DatasetCreateFromCSR
(
ptr_indptr
,
ptr_indptr
,
ctypes
.
c_int
(
type_ptr_indptr
),
ctypes
.
c_int
(
type_ptr_indptr
),
...
@@ -913,6 +922,9 @@ class Dataset(object):
...
@@ -913,6 +922,9 @@ class Dataset(object):
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csc
.
indptr
)
ptr_indptr
,
type_ptr_indptr
,
__
=
c_int_array
(
csc
.
indptr
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csc
.
data
)
ptr_data
,
type_ptr_data
,
_
=
c_float_array
(
csc
.
data
)
assert
csc
.
shape
[
0
]
<=
MAX_INT32
csc
.
indices
=
csc
.
indices
.
astype
(
np
.
int32
,
copy
=
False
)
_safe_call
(
_LIB
.
LGBM_DatasetCreateFromCSC
(
_safe_call
(
_LIB
.
LGBM_DatasetCreateFromCSC
(
ptr_indptr
,
ptr_indptr
,
ctypes
.
c_int
(
type_ptr_indptr
),
ctypes
.
c_int
(
type_ptr_indptr
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment