We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bfed6ba + 0149b07 commit ae7df90Copy full SHA for ae7df90
.github/workflows/test.yml
@@ -0,0 +1,39 @@
1
+name: test
2
+
3
+on: [push, pull_request]
4
5
+jobs:
6
+ build:
7
+ name: Rust ${{ matrix.os }} ${{ matrix.rust }}
8
+ runs-on: ${{ matrix.os }}
9
+ strategy:
10
+ matrix:
11
+ rust:
12
+ - stable
13
+ - beta
14
+ - nightly
15
+ os: [ubuntu-latest, macos-latest]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ with:
19
+ submodules: true
20
+ - name: Setup Rust
21
+ uses: actions-rs/toolchain@v1
22
23
+ profile: minimal
24
+ toolchain: ${{ matrix.rust }}
25
+ override: true
26
+ - name: Build for OS X
27
+ if: matrix.os == 'macos-latest'
28
+ run: |
29
+ brew install cmake
30
+ brew install libomp
31
+ cargo build
32
+ - name: Build for ubuntu
33
+ if: matrix.os == 'ubuntu-latest'
34
35
+ sudo apt-get install -y cmake libclang-dev libc++-dev gcc-multilib
36
37
+ - name: Run tests
38
+ run: cargo test
39
+ continue-on-error: ${{ matrix.rust == 'nightly' }}
README.md
@@ -15,13 +15,36 @@ brew install cmake libomp
```
Please see below for details.
-https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html
+- [LightGBM Installation-Guide](https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html)
# Usage
-Please see `./examples`.
+Example LightGBM train.
+```
+extern crate serde_json;
+use lightgbm::{Dataset, Booster};
+use serde_json::json;
+let data = vec![vec![1.0, 0.1, 0.2, 0.1],
+ vec![0.7, 0.4, 0.5, 0.1],
+ vec![0.9, 0.8, 0.5, 0.1],
+ vec![0.2, 0.2, 0.8, 0.7],
+ vec![0.1, 0.7, 1.0, 0.9]];
+let label = vec![0.0, 0.0, 0.0, 1.0, 1.0];
+let dataset = Dataset::from_mat(data, label).unwrap();
+let params = json!{
+ {
+ "num_iterations": 3,
40
+ "objective": "binary",
41
+ "metric": "auc"
42
+ }
43
+};
44
+let bst = Booster::train(dataset, ¶ms).unwrap();
45
46
47
+Please see the `./examples` for details.
48
49
|example|link|
50
|---|---|
src/booster.rs
@@ -164,8 +164,8 @@ mod tests {
164
let feature = vec![vec![0.5; 28], vec![0.0; 28], vec![0.9; 28]];
165
let result = bst.predict(feature).unwrap();
166
let mut normalized_result = Vec::new();
167
- for r in result[0]{
168
- if r > 0.5{
+ for r in &result[0]{
+ if r > &0.5{
169
normalized_result.push(1);
170
} else {
171
normalized_result.push(0);
0 commit comments