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
7c6bb7c8
Commit
7c6bb7c8
authored
May 31, 2017
by
Yuyu Zhang
Committed by
Guolin Ke
Jun 01, 2017
Browse files
Update Python-intro.md (#570)
Fix coding style inconsistency (quotation mark) and redundant blank space.
parent
1d5867b4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
docs/Python-intro.md
docs/Python-intro.md
+3
-3
No files found.
docs/Python-intro.md
View file @
7c6bb7c8
...
@@ -41,9 +41,9 @@ train_data = lgb.Dataset('train.svm.bin')
...
@@ -41,9 +41,9 @@ train_data = lgb.Dataset('train.svm.bin')
#### To load a numpy array into ```Dataset```:
#### To load a numpy array into ```Dataset```:
```
python
```
python
data
=
np
.
random
.
rand
(
500
,
10
)
# 500 entities, each contains 10 features
data
=
np
.
random
.
rand
(
500
,
10
)
# 500 entities, each contains 10 features
label
=
np
.
random
.
randint
(
2
,
size
=
500
)
# binary target
label
=
np
.
random
.
randint
(
2
,
size
=
500
)
# binary target
train_data
=
lgb
.
Dataset
(
data
,
label
=
label
)
train_data
=
lgb
.
Dataset
(
data
,
label
=
label
)
```
```
#### To load a scpiy.sparse.csr_matrix array into ```Dataset```:
#### To load a scpiy.sparse.csr_matrix array into ```Dataset```:
```
python
```
python
...
@@ -53,7 +53,7 @@ train_data = lgb.Dataset(csr)
...
@@ -53,7 +53,7 @@ train_data = lgb.Dataset(csr)
#### Saving ```Dataset``` into a LightGBM binary file will make loading faster:
#### Saving ```Dataset``` into a LightGBM binary file will make loading faster:
```
python
```
python
train_data
=
lgb
.
Dataset
(
'train.svm.txt'
)
train_data
=
lgb
.
Dataset
(
'train.svm.txt'
)
train_data
.
save_binary
(
"
train.bin
"
)
train_data
.
save_binary
(
'
train.bin
'
)
```
```
#### Create validation data
#### Create validation data
```
python
```
python
...
...
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