Skip to content

Commit 74296b5

Browse files
committed
fix examples
1 parent b2ee921 commit 74296b5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

examples/basic/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn main() {
9797
let mut data = Vec::new();
9898

9999
let reader = BufReader::new(File::open("../../xgboost-sys/xgboost/demo/data/agaricus.txt.train").unwrap());
100-
let mut current_row = 0;
100+
let mut current_row: u64 = 0;
101101
for line in reader.lines() {
102102
let line = line.unwrap();
103103
let sample: Vec<&str> = line.split_whitespace().collect();
@@ -106,16 +106,16 @@ fn main() {
106106
for entry in &sample[1..] {
107107
let pair: Vec<&str> = entry.split(':').collect();
108108
rows.push(current_row);
109-
cols.push(pair[0].parse::<usize>().unwrap());
109+
cols.push(pair[0].parse::<u64>().unwrap());
110110
data.push(pair[1].parse::<f32>().unwrap());
111111
}
112112

113113
current_row += 1;
114114
}
115115

116116
// work out size of sparse matrix from max row/col values
117-
let shape = (*rows.iter().max().unwrap() + 1 as usize,
118-
*cols.iter().max().unwrap() + 1 as usize);
117+
let shape = ((*rows.iter().max().unwrap() + 1) as usize,
118+
(*cols.iter().max().unwrap() + 1) as usize);
119119
let triplet_mat = sprs::TriMatBase::from_triplets(shape, rows, cols, data);
120120
let csr_mat = triplet_mat.to_csr();
121121

examples/multiclass_classification/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ publish = false
88
xgboost = { path = "../../" }
99
log = "0.4"
1010
env_logger = "0.5"
11-
reqwest = "0.8"
11+
reqwest = { version = "0.11", features = ["blocking"] }

examples/multiclass_classification/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn download_dataset<P: AsRef<Path>>(dst: P) {
7373
}
7474

7575
debug!("Fetching training dataset from {}", url);
76-
let mut response = reqwest::get(url).expect("failed to download training set data");
76+
let mut response = reqwest::blocking::get(url).expect("failed to download training set data");
7777

7878
let file = File::create(dst).expect(&format!("failed to create file {}", dst.display()));
7979
let mut writer = BufWriter::new(file);

0 commit comments

Comments
 (0)