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
b7947c85
Commit
b7947c85
authored
Dec 15, 2016
by
Guolin Ke
Committed by
GitHub
Dec 15, 2016
Browse files
Update Python_intro.md
parent
b1e34d15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
docs/Python_intro.md
docs/Python_intro.md
+14
-2
No files found.
docs/Python_intro.md
View file @
b7947c85
...
...
@@ -30,9 +30,9 @@ The data is stored in a ```Dataset``` object.
#### To load a libsvm text file or a LightGBM binary file into ```Dataset```:
```
python
train_data
=
lgb
.
Dataset
(
'train.svm'
)
test_data
=
lgb
.
Dataset
(
'test.svm.bin'
)
train_data
=
lgb
.
Dataset
(
'train.svm.bin'
)
```
#### To load a numpy array into ```Dataset```:
```
python
data
=
np
.
random
.
rand
(
500
,
10
)
# 500 entities, each contains 10 features
...
...
@@ -49,6 +49,18 @@ train_data = lgb.Dataset(csr)
train_data
=
lgb
.
Dataset
(
'train.svm.txt'
)
train_data
.
save_binary
(
"train.bin"
)
```
#### Create validation data
```
python
test_data
=
train_data
.
create_valid
(
'test.svm'
)
```
or
```
python
test_data
=
lgb
.
Dataset
(
'test.svm'
,
reference
=
train_data
)
```
In LightGBM, the validation data should be aligned with training data.
#### Specific feature names and categorical features
...
...
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