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
67ca6091
Commit
67ca6091
authored
Nov 26, 2016
by
Guolin Ke
Browse files
explicit close file in python
parent
83a14174
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+7
-1
No files found.
python-package/lightgbm/basic.py
View file @
67ca6091
...
...
@@ -274,7 +274,9 @@ class Predictor(object):
predict_type
,
num_iteration
,
c_str
(
tmp_pred_fname
)))
lines
=
open
(
tmp_pred_fname
,
"r"
).
readlines
()
tmp_file
=
open
(
tmp_pred_fname
,
"r"
)
lines
=
tmp_file
.
readlines
()
tmp_file
.
close
()
nrow
=
len
(
lines
)
preds
=
[]
for
line
in
lines
:
...
...
@@ -505,7 +507,11 @@ class Dataset(object):
return
Dataset
(
data
,
label
=
label
,
max_bin
=
self
.
max_bin
,
reference
=
self
,
weight
=
weight
,
group_id
=
group_id
,
predictor
=
self
.
predictor
,
silent
=
silent
,
params
=
params
)
def
subset
(
self
,
used_indices
,
params
=
None
):
"""
Get subset of current dataset
"""
used_indices
=
list_to_1d_numpy
(
used_indices
,
np
.
int32
)
ret
=
Dataset
(
None
)
ret
.
handle
=
ctypes
.
c_void_p
()
...
...
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