Skip to content

web search done right

ensemble lambdamart

Mikkel Denker5b448c3028c9
diff --git a/configs/search_server.toml b/configs/search_server.toml
index aee278bc..ed4d70f7 100644
--- a/configs/search_server.toml
+++ b/configs/search_server.toml
@@ -7,7 +7,8 @@ host_centrality_store_path = "data/centrality"
index_path = "data/index"
shard_id = 0
# linear_model_path = "data/linear_model.json"
-# lambda_model_path = "data/lambdamart.txt"
+build_spell_dictionary = false
+lambda_model_path = "data/lambdamart.txt"
[snippet]
max_considered_words = 10_000
diff --git a/core/src/ranking/models/lambdamart.rs b/core/src/ranking/models/lambdamart.rs
index c2aeefc2..b62cf9fb 100644
--- a/core/src/ranking/models/lambdamart.rs
+++ b/core/src/ranking/models/lambdamart.rs
@@ -30,6 +30,9 @@ pub enum Error {
#[error("no features found")]
NoFeatures,
+ #[error("couldn't find end of trees")]
+ NoEndOfTrees,
+
#[error("Signal error: {0}")]
Signal(#[from] signal::Error),
@@ -86,40 +89,14 @@ struct Tree {
}
impl Tree {
- fn parse(s: &str) -> Result<Self> {
- let lines: Vec<_> = s.lines().map(|s| s.to_string()).collect();
- let end_header = lines
- .iter()
- .enumerate()
- .find(|(_, line)| line.is_empty())
- .map(|(idx, _)| idx)
- .unwrap();
-
- let header: String = itertools::intersperse(
- lines[..end_header].iter().map(|s| s.to_string()),
- "\n".to_string(),
- )
- .collect();
- let header = Header::parse(&header)?;
-
- let start_tree = end_header + 1;
- let end_tree = lines
- .iter()
- .enumerate()
- .skip(start_tree)
- .find(|(_, line)| line.is_empty())
- .map(|(idx, _)| idx)
- .unwrap();
-
- let tree = &lines[start_tree..end_tree];
-
+ fn parse(s: &str, header: &Header) -> Result<Self> {
let mut split_features = Vec::new();
let mut thresholds = Vec::new();
let mut leaf_values = Vec::new();
let mut lefts = Vec::new();
let mut rights = Vec::new();
- for line in tree {
+ for line in s.lines() {
if let Some((key, value)) = line.split_once('=') {
match key {
"split_feature" => {
@@ -255,18 +232,70 @@ impl Header {
}
pub struct LambdaMART {
- tree: Tree,
+ trees: Vec<Tree>,
}
impl LambdaMART {
+ pub fn parse(s: &str) -> Result<Self> {
+ let lines: Vec<_> = s.lines().map(|s| s.to_string()).collect();
+ let end_header = lines
+ .iter()
+ .enumerate()
+ .find(|(_, line)| line.is_empty())
+ .map(|(idx, _)| idx)
+ .unwrap();
+
+ let header: String = itertools::intersperse(
+ lines[..end_header].iter().map(|s| s.to_string()),
+ "\n".to_string(),
+ )
+ .collect();
+ let header = Header::parse(&header)?;
+
+ let start_trees = end_header + 1;
+ let end_trees = lines
+ .iter()
+ .enumerate()
+ .find(|(_, line)| line.trim() == "end of trees")
+ .map(|(idx, _)| idx)
+ .ok_or(Error::NoEndOfTrees)?;
+
+ // chunk lines by empty lines
+ let mut trees = Vec::new();
+
+ let mut start_tree = start_trees;
+
+ while start_tree < end_trees {
+ let end_tree = lines
+ .iter()
+ .enumerate()
+ .skip(start_tree)
+ .find(|(_, line)| line.is_empty())
+ .map(|(idx, _)| idx)
+ .unwrap();
+
+ let tree = &lines[start_tree..end_tree];
+ let tree = Tree::parse(&tree.join("\n"), &header)?;
+ trees.push(tree);
+
+ start_tree = end_tree + 2;
+ }
+
+ Ok(Self { trees })
+ }
+
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self> {
let s = std::fs::read_to_string(path)?;
- let tree = Tree::parse(&s)?;
- Ok(Self { tree })
+
+ Self::parse(&s)
}
pub fn predict<V: AsValue>(&self, features: &EnumMap<Signal, V>) -> f64 {
- self.tree.predict(features).unwrap()
+ self.trees
+ .iter()
+ .map(|t| t.predict(features).unwrap())
+ .sum::<f64>()
+ / (self.trees.len() as f64)
}
}
@@ -276,29 +305,41 @@ mod tests {
#[test]
fn simple() {
- let tree = include_str!("../../../testcases/lambdamart.txt");
- let tree = Tree::parse(tree).unwrap();
- assert!(!tree.nodes.is_empty());
+ let model = include_str!("../../../testcases/lambdamart.txt");
+ let model = LambdaMART::parse(model).unwrap();
+ assert!(!model.trees.is_empty());
let mut features = EnumMap::new();
- features.insert(Signal::Region, 0.720491639);
- features.insert(Signal::Bm25Url, 63.6011428833);
- features.insert(Signal::Bm25StemmedTitle, 67.2495346069);
- features.insert(Signal::TrackerScore, 0.125);
- features.insert(Signal::Bm25TitleBigrams, 102.8286361694);
- features.insert(Signal::Bm25CleanBodyBigrams, 116.3994293213);
- features.insert(Signal::Bm25CleanBodyTrigrams, 114.053276062);
- features.insert(Signal::CrossEncoder, 0.0017519296);
- features.insert(Signal::Bm25Domain, 89.1253814697);
- features.insert(Signal::Bm25CleanBody, 54.1200180054);
- features.insert(Signal::FetchTimeMs, 0.0018281536);
- features.insert(Signal::Bm25AllBody, 43.6125068665);
- features.insert(Signal::Bm25Site, 87.6877670288);
- features.insert(Signal::Bm25TitleTrigrams, 86.8362731934);
- features.insert(Signal::Bm25Title, 75.2071838379);
- features.insert(Signal::HostCentrality, 0.031143193);
- features.insert(Signal::Bm25StemmedCleanBody, 52.1262779236);
-
- assert_eq!((tree.predict(&features).unwrap() * 1000.0) as u64, 1038);
+ features.insert(Signal::Bm25BacklinkText, 85.7750244140625);
+ features.insert(Signal::Bm25CleanBody, 67.41311645507812);
+ features.insert(Signal::Bm25CleanBodyBigrams, 0.0);
+ features.insert(Signal::Bm25CleanBodyTrigrams, 0.0);
+ features.insert(Signal::Bm25Domain, 43.332096099853516);
+ features.insert(Signal::Bm25DomainIfHomepage, 0.0);
+ features.insert(Signal::Bm25DomainIfHomepageNoTokenizer, 0.0);
+ features.insert(Signal::Bm25DomainNameIfHomepageNoTokenizer, 0.0);
+ features.insert(Signal::Bm25DomainNameNoTokenizer, 0.0);
+ features.insert(Signal::Bm25DomainNoTokenizer, 0.0);
+ features.insert(Signal::Bm25Site, 61.47410202026367);
+ features.insert(Signal::Bm25SiteNoTokenizer, 0.0);
+ features.insert(Signal::Bm25StemmedCleanBody, 65.94627380371094);
+ features.insert(Signal::Bm25StemmedTitle, 0.0);
+ features.insert(Signal::Bm25Title, 59.817813873291016);
+ features.insert(Signal::Bm25TitleBigrams, 0.0);
+ features.insert(Signal::Bm25TitleIfHomepage, 0.0);
+ features.insert(Signal::Bm25TitleTrigrams, 0.0);
+ features.insert(Signal::Bm25Url, 57.07925033569336);
+ features.insert(Signal::FetchTimeMs, 0.023255813953488372);
+ features.insert(Signal::HostCentrality, 0.017958538);
+ features.insert(Signal::InboundSimilarity, 0.0);
+ features.insert(Signal::IsHomepage, 0.0);
+ features.insert(Signal::PageCentrality, 0.008253236);
+ features.insert(Signal::Region, 0.16622349570454012);
+ features.insert(Signal::TrackerScore, 0.07692307692307693);
+ features.insert(Signal::UpdateTimestamp, 0.0);
+ features.insert(Signal::UrlDigits, 0.25);
+ features.insert(Signal::UrlSlashes, 0.3333333333333333);
+
+ assert_eq!((model.predict(&features) * 1000.0) as u64, 1050);
}
}
diff --git a/core/testcases/lambdamart.txt b/core/testcases/lambdamart.txt
index bb993695..1b61722e 100644
--- a/core/testcases/lambdamart.txt
+++ b/core/testcases/lambdamart.txt
@@ -5,52 +5,980 @@ num_tree_per_iteration=1
label_index=0
max_feature_idx=28
objective=lambdarank
-feature_names=bm25_clean_body_trigrams bm25_domain_name_if_homepage_no_tokenizer inbound_similarity fetch_time_ms bm25_title_bigrams bm25_domain_if_homepage_no_tokenizer is_homepage host_centrality bm25_stemmed_clean_body bm25_domain_if_homepage bm25_title bm25_title_trigrams bm25_domain_name_no_tokenizer tracker_score url_digits bm25_clean_body_bigrams page_centrality bm25_url bm25_domain bm25_site bm25_title_if_homepage url_slashes bm25_clean_body bm25_stemmed_title bm25_backlink_text update_timestamp bm25_site_no_tokenizer region bm25_domain_no_tokenizer
-feature_infos=[0:66.744026184082031] none none [0:1] [0:80.374847412109375] none [0:1] [0:0.069144523999999999] [0:74.051651000976562] [0:13.650681495666504] [0:70.605201721191406] [0:42.40814208984375] none [0.018181818181818181:1] [0.041666666666666664:1] [0:85.190345764160156] [0:0.037276589999999998] [0:59.181015014648438] [0:42.313144683837891] [0:39.355148315429688] [0:28.333169937133789] [0.16666666666666666:0.5] [0:56.155899047851562] [0:75.045997619628906] [0:91.765708923339844] none none [0:0.70508371084865562] none
-tree_sizes=871
+feature_names=bm25_backlink_text inbound_similarity bm25_clean_body_bigrams bm25_domain_if_homepage_no_tokenizer page_centrality is_homepage bm25_title_if_homepage url_slashes fetch_time_ms region tracker_score bm25_domain bm25_domain_no_tokenizer bm25_title bm25_stemmed_title bm25_domain_name_no_tokenizer host_centrality url_digits bm25_domain_name_if_homepage_no_tokenizer bm25_title_trigrams bm25_clean_body_trigrams bm25_title_bigrams bm25_stemmed_clean_body bm25_site bm25_site_no_tokenizer bm25_url bm25_domain_if_homepage update_timestamp bm25_clean_body
+feature_infos=[0:71.599037170410156] none [0:59.439960479736328] none [0:0.041696587] [0:1] [0:24.348766326904297] [0.14285714285714285:0.5] [0:0.16666666666666666] [0:0.70508371084865562] [0.009433962264150943:1] none none [6.0304698944091797:45.648475646972656] [0:44.676078796386719] none [7.6000000000000006e-08:0.045836137999999998] [0.066666666666666666:1] none none none [0:48.516033172607422] [0:40.354255676269531] [0:44.526699066162109] none [0:44.291984558105469] none none [4.4346046447753906:41.890125274658203]
+tree_sizes=1051 753 851 859 958 856 759 960 858 651 862 971 753 861 861 973 859 761 865 869 982 763 986 763 984 759 764 765 861 762 767 765 869 869 874 872 873 879 871 883 773 774 877 768 765 777 988 878 767 879
Tree=0
+num_leaves=9
+num_cat=0
+split_feature=10 21 4 4 4 0 14 2
+split_gain=3.39332 4.01009 2.7085 2.18636 1.05595 0.945094 1.70302 0.115773
+threshold=0.036472148541114066 32.145853996276863 0.019045457000000005 0.021442663500000004 0.028194855000000001 33.149501800537116 31.266446113586429 30.7970085144043
+decision_type=2 2 2 2 2 2 2 2
+left_child=-1 2 5 -4 -5 -2 7 -7
+right_child=1 -3 3 4 -6 6 -8 -9
+leaf_value=0.15073595618511473 -0.018504191979331699 0.13370349690814684 0.1356795308916417 -0.11808321116041064 0.029646285795911487 -0.1523005903697241 -0.035515642219486727 -0.19782013468506998
+leaf_weight=1.3107356280088431 1.2227705847471932 1.4219320788979528 1.1295342706143858 0.90676317177712906 1.0374053977429865 1.1355584524571902 1.4489052165299652 1.0999752990901468
+leaf_count=9 23 12 8 24 22 25 18 17
+internal_value=0 -0.0210123 -0.0485774 0.0250305 -0.039255 -0.0946829 -0.119965 -0.174698
+internal_weight=0 9.40284 7.98091 3.0737 1.94417 4.90721 3.68444 2.23553
+internal_count=158 149 137 54 46 83 60 42
+is_linear=0
+shrinkage=0.1
+
+
+Tree=1
+num_leaves=6
+num_cat=0
+split_feature=9 25 16 13 8
+split_gain=12.8785 7.25585 2.61568 1.72158 1.28952
+threshold=0.12699433382430414 9.0647997856140154 0.027169252500000001 32.232547760009773 0.0025906909627839863
+decision_type=2 2 2 2 2
+left_child=-1 -2 3 -3 -4
+right_child=1 2 4 -5 -6
+leaf_value=-0.16183064798184865 -0.064982637179895442 0.053413893004185337 0.12884326281065159 -0.039307652116438108 0.059493046007224264
+leaf_weight=4.2219213154166964 6.4609012063592699 4.8470772765576857 4.7516320422291738 3.4121131226420403 6.1534549966454506
+leaf_count=21 37 35 16 17 32
+internal_value=0 0.0266627 0.0575593 0.0151079 0.0897108
+internal_weight=0 25.6252 19.1643 8.25919 10.9051
+internal_count=158 137 100 52 48
+is_linear=0
+shrinkage=0.1
+
+
+Tree=2
+num_leaves=7
+num_cat=0
+split_feature=8 28 21 25 2 0
+split_gain=4.75971 4.14464 2.03812 4.59818 2.45434 3.67102
+threshold=0.039230769230769243 9.9450259208679217 32.145853996276863 30.593762397766117 1.0000000180025095e-35 25.365817070007328
+decision_type=2 2 2 2 2 2
+left_child=1 -1 3 4 5 -3
+right_child=-2 2 -4 -5 -6 -7
+leaf_value=-0.12123920568073926 0.11107045228528784 0.039708068075549434 0.070143657223554409 -0.12036722213383949 0.07070577404920024 -0.099888660754659006
+leaf_weight=3.2416744763031664 3.3535965494811526 4.3071465902030486 3.4898544922471038 3.2423753514885894 4.659257635474205 3.3482053503394127
+leaf_count=15 14 30 12 27 37 23
+internal_value=0 -0.016712 0.001078 -0.0144153 0.0134813 -0.0213471
+internal_weight=0 22.2885 19.0468 15.557 12.3146 7.65535
+internal_count=158 144 129 117 90 53
+is_linear=0
+shrinkage=0.1
+
+
+Tree=3
+num_leaves=7
+num_cat=0
+split_feature=16 8 8 6 16 8
+split_gain=5.34965 2.90769 3.42288 3.37276 1.79001 0.105534
+threshold=0.034443664000000006 0.0025906909627839863 0.0013369199009821359 3.8250042200088505 0.025878075500000004 0.0066908342284282144
+decision_type=2 2 2 2 2 2
+left_child=1 2 -1 4 -3 -6
+right_child=-2 3 -4 -5 5 -7
+leaf_value=-0.037478438379528183 0.11624978465595306 -0.031979288535082001 0.10041260891225814 0.043762068829675836 -0.13962608532943011 -0.10985434776663752
+leaf_weight=3.7744949944317403 3.3484642691910258 3.6817504875361902 3.4416350200772285 2.7161874920129767 2.3948482647538185 2.3678860981017351
+leaf_count=27 20 34 19 18 17 23
+internal_value=0 -0.021182 0.0282868 -0.053167 -0.0843445 -0.124824
+internal_weight=0 18.3768 7.21613 11.1607 8.44448 4.76273
+internal_count=158 138 46 92 74 40
+is_linear=0
+shrinkage=0.1
+
+
+Tree=4
+num_leaves=8
+num_cat=0
+split_feature=10 21 25 16 25 14 10
+split_gain=3.57957 3.18729 2.33158 1.85734 3.1334 0.927197 0.386634
+threshold=0.04083333333333334 32.145853996276863 24.795311927795414 0.032652678500000011 9.3698225021362322 14.269944667816164 0.13392857142857145
+decision_type=2 2 2 2 2 2 2
+left_child=-1 2 3 4 -2 -6 -4
+right_child=1 -3 6 -5 5 -7 -8
+leaf_value=0.1105242022551364 -0.1224259566334161 0.082300714760983329 -0.078152702265423937 0.052286941948097646 0.047737572578502849 -0.037402229872927288 -0.14870534339077809
+leaf_weight=2.5470231771469143 2.9034225866198557 2.7309452891349784 1.6111067235469811 3.0469819344580165 2.7106851525604725 2.4219824373722076 1.4998194240033624
+leaf_count=12 31 12 23 22 21 19 18
+internal_value=0 -0.0166327 -0.0356676 -0.0141949 -0.0394023 0.00756215 -0.112167
+internal_weight=0 16.9249 14.194 11.0831 8.03609 5.13267 3.11093
+internal_count=158 146 134 93 71 40 41
+is_linear=0
+shrinkage=0.1
+
+
+Tree=5
+num_leaves=7
+num_cat=0
+split_feature=10 21 0 10 2 2
+split_gain=2.18122 1.67987 1.97648 1.48866 1.00519 1.48894
+threshold=0.04083333333333334 32.145853996276863 33.149501800537116 0.13392857142857145 1.0000000180025095e-35 32.418788909912116
+decision_type=2 2 2 2 2 2
+left_child=-1 2 3 -2 -4 -6
+right_child=1 -3 4 -5 5 -7
+leaf_value=0.091928087491562449 -0.050998619121781802 0.05936215035447754 -0.13372155830578972 0.045469513929841832 0.016798584586576952 -0.1066959341032236
+leaf_weight=2.2457786314189461 2.6257215999066812 2.6009512990713111 1.8139637373387811 4.0935984384268522 1.9947848133742812 1.9121390879154203
+leaf_count=12 28 12 17 39 25 25
+internal_value=0 -0.0137257 -0.0290066 0.00777248 -0.0722045 -0.0436425
+internal_weight=0 15.0412 12.4402 6.71932 5.72089 3.90692
+internal_count=158 146 134 67 67 50
+is_linear=0
+shrinkage=0.1
+
+
+Tree=6
+num_leaves=6
+num_cat=0
+split_feature=16 25 8 16 8
+split_gain=2.56049 1.94077 1.83439 1.09161 0.996827
+threshold=0.034443664000000006 11.198239803314211 0.0056820016142050045 0.022475994000000003 0.0045257208387942342
+decision_type=2 2 2 2 2
+left_child=1 4 3 -3 -1
+right_child=-2 2 -4 -5 -6
+leaf_value=-0.12239400626882574 0.087088870313922345 -0.016730912964701836 -0.053897553496416284 0.07018884551264018 -0.019851090836875571
+leaf_weight=2.1885567959398062 2.7933610640466204 2.2880524508655053 3.323344498872757 3.9208029992878437 1.6724371816962955
+leaf_count=22 20 21 39 32 24
+internal_value=0 -0.0181638 0.00606316 0.0381577 -0.0779763
+internal_weight=0 13.3932 9.5322 6.20886 3.86099
+internal_count=158 138 92 53 46
+is_linear=0
+shrinkage=0.1
+
+
+Tree=7
+num_leaves=8
+num_cat=0
+split_feature=16 21 28 2 4 14 21
+split_gain=1.29461 1.5566 1.6292 3.32624 1.5003 1.71539 0.507996
+threshold=0.034443664000000006 32.145853996276863 26.199076652526859 1.0000000180025095e-35 0.015958332500000002 10.135197639465334 23.527647972106937
+decision_type=2 2 2 2 2 2 2
+left_child=1 2 3 4 -1 -6 -4
+right_child=-2 -3 6 -5 5 -7 -8
+leaf_value=-0.13438549197470107 0.064281468545869427 0.065229941416282175 -0.14134630049025765 0.093617127281861556 -0.091430502226556715 0.043133602333637541 -0.054030058420679941
+leaf_weight=1.4971837606281022 2.5924925040453681 2.0935693085193625 1.3018863946199419 2.3352940492331982 1.69837346021086 2.1422730796039104 1.3648024350404737
+leaf_count=19 20 12 21 20 27 20 19
+internal_value=0 -0.0134034 -0.0293248 -0.00592398 -0.0494731 -0.016372 -0.0966581
+internal_weight=0 12.4334 10.3398 7.67312 5.33783 3.84065 2.66669
+internal_count=158 138 126 86 66 47 40
+is_linear=0
+shrinkage=0.1
+
+
+Tree=8
+num_leaves=7
+num_cat=0
+split_feature=10 21 4 10 7 8
+split_gain=1.167 1.03113 1.56743 1.5505 0.422508 0.437648
+threshold=0.04083333333333334 32.145853996276863 0.019877250000000003 0.13392857142857145 0.29166666666666669 0.0056820016142050045
+decision_type=2 2 2 2 2 2
+left_child=-1 2 4 -4 -2 -6
+right_child=1 -3 3 -5 5 -7
+leaf_value=0.074979825200474401 -0.029691744333011083 0.05339046328282851 -0.052794902759292141 0.073836536538552863 -0.12039899780652973 -0.044366737872026663
+leaf_weight=1.8000809289515025 2.6704646460711938 2.0273623615503302 1.6191946063190696 2.4002347309142351 1.5913107544183733 1.4440639056265352
+leaf_count=12 37 12 25 25 23 24
+internal_value=0 -0.0114842 -0.0250082 0.0228241 -0.0587033 -0.084227
+internal_weight=0 11.7526 9.72527 4.01943 5.70584 3.03537
+internal_count=158 146 134 50 84 47
+is_linear=0
+shrinkage=0.1
+
+
+Tree=9
+num_leaves=5
+num_cat=0
+split_feature=25 8 16 0
+split_gain=0.801545 1.66556 0.73241 0.432241
+threshold=12.433508396148683 0.0061539044156631072 0.023415235500000003 36.241176605224616
+decision_type=2 2 2 2
+left_child=1 -1 -2 -4
+right_child=2 -3 3 -5
+leaf_value=-0.09807690596302461 -0.026402170143953258 0.027042187577289808 0.0020249628821358665 0.057892967206537943
+leaf_weight=2.12584989424795 2.6171528585255128 2.1298677362501621 2.2050606720149517 3.7229711208492517
+leaf_count=30 34 32 25 37
+internal_value=0 -0.0354583 0.0176591 0.0371116
+internal_weight=0 4.25572 8.54518 5.92803
+internal_count=158 62 96 62
+is_linear=0
+shrinkage=0.1
+
+
+Tree=10
+num_leaves=7
+num_cat=0
+split_feature=10 21 4 25 25 14
+split_gain=0.822083 0.882642 1.12819 0.685099 0.490469 0.939855
+threshold=0.04083333333333334 32.145853996276863 0.019045457000000005 9.0647997856140154 14.513858318328859 26.601057052612308
+decision_type=2 2 2 2 2 2
+left_child=-1 2 4 -4 -2 -6
+right_child=1 -3 3 -5 5 -7
+leaf_value=0.065339071211773722 -0.0091070901983390882 0.053414884379312834 -0.030263955437717795 0.053507787636779228 -0.1253203280470031 -0.020226896680571295
+leaf_weight=1.6686295345425612 1.6272175814956407 1.8221023753285397 1.7310964623466136 2.2388130277395248 1.806563697755337 1.6087398696690796
+leaf_count=12 24 12 29 23 30 28
+internal_value=0 -0.0100629 -0.0228966 0.0169788 -0.0542899 -0.0758173
+internal_weight=0 10.8345 9.01243 3.96991 5.04252 3.4153
+internal_count=158 146 134 52 82 58
+is_linear=0
+shrinkage=0.1
+
+
+Tree=11
+num_leaves=8
+num_cat=0
+split_feature=10 21 4 16 13 2 2
+split_gain=0.691587 0.643386 0.804622 0.574037 0.837247 0.499893 0.712415
+threshold=0.036472148541114066 32.145853996276863 0.015958332500000002 0.024133666000000002 9.8729591369628924 1.0000000180025095e-35 32.418788909912116
+decision_type=2 2 2 2 2 2 2
+left_child=-1 2 5 -4 -5 -2 -7
+right_child=1 -3 3 4 -6 6 -8
+leaf_value=0.068241972397087916 -0.093823042139265234 0.045993459353342092 -0.043012625647528675 -0.028464701550631695 0.072762991732043245 0.031948215430161304 -0.079014778819477355
+leaf_weight=1.3220273219048984 1.6993557214736918 1.8070111125707615 1.5311429575085638 1.394726784899831 1.9727346953004596 1.1812411323189738 1.1341089643537996
+leaf_count=9 27 12 18 22 24 22 24
+internal_value=0 -0.00841558 -0.019446 0.00775387 0.0308368 -0.0526344 -0.0224039
+internal_weight=0 10.7203 8.91331 4.8986 3.36746 4.01471 2.31535
+internal_count=158 149 137 64 46 73 46
+is_linear=0
+shrinkage=0.1
+
+
+Tree=12
+num_leaves=6
+num_cat=0
+split_feature=25 25 22 0 25
+split_gain=0.628237 0.963655 1.26278 0.851331 0.396769
+threshold=18.387420654296879 24.052399635314945 28.664059638977054 25.365817070007328 9.0647997856140154
+decision_type=2 2 2 2 2
+left_child=3 -2 -3 4 -1
+right_child=1 2 -4 -5 -6
+leaf_value=-0.029821753250058449 0.087516663721594057 -0.080796049748414686 0.033534579774241284 -0.076014328478240856 0.039838723567010972
+leaf_weight=1.5741761242970826 1.6359671950340269 1.4034157134592531 3.0999280270189047 2.0334766581654549 1.7013429217040537
+leaf_count=29 15 27 36 29 22
+internal_value=0 0.021784 -0.00209526 -0.025191 0.00636071
+internal_weight=0 6.13931 4.50334 5.309 3.27552
+internal_count=158 78 63 80 51
+is_linear=0
+shrinkage=0.1
+
+
+Tree=13
+num_leaves=7
+num_cat=0
+split_feature=8 25 16 13 16 13
+split_gain=0.576652 1.05677 0.53067 0.687815 0.326212 0.190878
+threshold=0.03033088235294118 11.198239803314211 0.029257921500000002 32.668220520019538 0.028033615000000001 24.524174690246586
+decision_type=2 2 2 2 2 2
+left_child=1 4 3 5 -1 -3
+right_child=-2 2 -4 -5 -6 -7
+leaf_value=-0.10486312201490887 0.055519025251887483 0.027718816643335049 -0.034856326971235883 -0.029137752795002272 -0.030595581641991228 0.074014963718094379
+leaf_weight=1.1677708802744731 1.5982792489230639 1.7706715837121012 1.9133831225335596 1.5312401708215473 1.198334854096174 1.7917245738208292
+leaf_count=24 20 23 29 19 19 24
+internal_value=0 -0.00946695 0.0100449 0.0269117 -0.0672497 0.0510037
+internal_weight=0 9.37313 7.00702 5.09364 2.36611 3.5624
+internal_count=158 138 95 66 43 47
+is_linear=0
+shrinkage=0.1
+
+
+Tree=14
+num_leaves=7
+num_cat=0
+split_feature=16 8 25 13 14 4
+split_gain=0.576504 0.691683 1.36767 0.446901 0.214352 0.152405
+threshold=0.034443664000000006 0.0076046726810085593 11.198239803314211 32.375389099121101 14.269944667816164 0.014555615500000002
+decision_type=2 2 2 2 2 2
+left_child=1 2 -1 5 -3 -4
+right_child=-2 4 3 -5 -6 -7
+leaf_value=-0.073523067741448511 0.052804832068519651 -0.022874334466573422 0.03415195297416572 -0.0096464611011072218 -0.080658064793417722 0.078106822294692124
+leaf_weight=1.5580048449337462 1.7289823181927211 1.1963860895484688 1.576507914811373 1.534548547118902 1.3853339795023201 1.5788339488208292
+leaf_count=30 20 22 25 19 25 17
+internal_value=0 -0.01034 0.00765158 0.0346182 -0.0538807 0.0561456
+internal_weight=0 8.82962 6.2479 4.68989 2.58172 3.15534
+internal_count=158 138 91 61 47 42
+is_linear=0
+shrinkage=0.1
+
+
+Tree=15
+num_leaves=8
+num_cat=0
+split_feature=21 10 0 14 2 2 14
+split_gain=0.509802 0.621845 0.572473 0.524862 0.485597 0.630083 0.177853
+threshold=32.145853996276863 0.04083333333333334 33.149501800537116 10.135197639465334 1.0000000180025095e-35 32.418788909912116 1.0000000180025095e-35
+decision_type=2 2 2 2 2 2 2
+left_child=1 -1 3 6 -4 -6 -3
+right_child=-2 2 4 -5 5 -7 -8
+leaf_value=0.054656483237459301 0.0507302295760549 -0.0014734738835423893 -0.1061623936722898 0.044422425961571449 0.020717227927475771 -0.085620904794202257 -0.062877102083244499
+leaf_weight=1.2584426738321761 1.6521998308599002 0.97592324670404218 1.0948183145374062 1.7895161956548689 1.2934605963528159 0.97892235405743111 0.91300871316343546
+leaf_count=12 12 22 17 27 25 25 18
+internal_value=0 -0.0100934 -0.0216585 0.00561359 -0.0514516 -0.0250923 -0.0311527
+internal_weight=0 8.30409 7.04565 3.67845 3.3672 2.27238 1.88893
+internal_count=158 146 134 67 67 50 40
+is_linear=0
+shrinkage=0.1
+
+
+Tree=16
+num_leaves=7
+num_cat=0
+split_feature=16 0 21 22 4 14
+split_gain=0.435561 0.680081 0.747898 0.874427 0.390766 0.513453
+threshold=0.034443664000000006 36.241176605224616 31.004352569580082 23.634104728698734 0.014555615500000002 10.135197639465334
+decision_type=2 2 2 2 2 2
+left_child=1 4 3 -3 -1 -6
+right_child=-2 2 -4 -5 5 -7
+leaf_value=-0.082045358019735476 0.048475162039843193 0.049749802394636056 0.084082460562283315 -0.07601940512891979 -0.066369634795745161 0.016078159779213199
+leaf_weight=1.2808669563382862 1.550692670047283 1.1300628129392869 1.2877288423478601 1.0822086594998834 1.2503342386335137 1.9079540558159349
+leaf_count=24 20 15 11 31 31 26
+internal_value=0 -0.00946827 0.0234934 -0.0117745 -0.0354565 -0.0165621
+internal_weight=0 7.93916 3.5 2.21227 4.43916 3.15829
+internal_count=158 138 57 46 81 57
+is_linear=0
+shrinkage=0.1
+
+
+Tree=17
+num_leaves=6
+num_cat=0
+split_feature=25 2 2 4 14
+split_gain=0.481152 0.88937 0.709229 0.550395 0.204528
+threshold=34.859830856323249 32.418788909912116 1.0000000180025095e-35 0.028194855000000001 12.553970336914064
+decision_type=2 2 2 2 2
+left_child=1 2 3 4 -1
+right_child=-2 -3 -4 -5 -6
+leaf_value=-0.075741148450608475 0.061710622943042942 -0.079678101627199904 0.049652592919342015 0.040022049197075707 -0.020288632499704196
+leaf_weight=1.1411773571744568 1.1052951775491235 1.4412584695965049 2.435279343277216 1.1117401774972675 1.594473101198673
+leaf_count=29 12 32 35 21 29
+internal_value=0 -0.0088308 0.00742173 -0.0193091 -0.0434207
+internal_weight=0 7.72393 6.28267 3.84739 2.73565
+internal_count=158 146 114 79 58
+is_linear=0
+shrinkage=0.1
+
+
+Tree=18
+num_leaves=7
+num_cat=0
+split_feature=21 25 2 0 25 8
+split_gain=0.40068 0.751121 0.625781 0.485162 0.412373 0.253329
+threshold=32.145853996276863 30.865914344787601 1.0000000180025095e-35 25.365817070007328 22.769027709960941 0.0045257208387942342
+decision_type=2 2 2 2 2 2
+left_child=1 2 3 5 -4 -1
+right_child=-2 -3 4 -5 -6 -7
+leaf_value=-0.033434793983459984 0.05040793170152056 -0.077671759532144002 0.085907288419530423 -0.073304854907508141 0.0047982913957419398 0.033359836882248722
+leaf_weight=0.98322646226734001 1.3344190940260885 1.3138981331139801 1.2106554321944716 1.1924515422433613 1.2998475916683672 1.3439147183671591
+leaf_count=22 12 27 15 25 28 29
+internal_value=0 -0.00915923 0.00576898 -0.0214382 0.043912 0.00513884
+internal_weight=0 7.34399 6.0301 3.51959 2.5105 2.32714
+internal_count=158 146 119 76 43 51
+is_linear=0
+shrinkage=0.1
+
+
+Tree=19
+num_leaves=7
+num_cat=0
+split_feature=8 7 0 16 8 16
+split_gain=0.418029 0.662117 0.359882 0.346576 0.392537 0.28943
+threshold=0.03033088235294118 0.41666666666666669 20.919738769531254 0.032652678500000011 0.0025906909627839863 0.024133666000000002
+decision_type=2 2 2 2 2 2
+left_child=1 3 -3 4 -1 -6
+right_child=-2 2 -4 -5 5 -7
+leaf_value=0.053105890833746353 0.056931318390159594 -0.017338129563473761 -0.10415436775426903 -0.037999792062022683 0.02650361691185656 -0.052621734094994446
+leaf_weight=2.1246430780738597 1.114298168569803 0.98947699368000008 0.92278186418116093 1.1782997865229843 1.0078638978302477 0.85400051809847344
+leaf_count=30 20 24 18 24 20 22
+internal_value=0 -0.00896395 -0.0592323 0.00964779 0.0237311 -0.00978962
+internal_weight=0 7.07707 1.91226 5.16481 3.98651 1.86186
+internal_count=158 138 42 96 72 42
+is_linear=0
+shrinkage=0.1
+
+
+Tree=20
+num_leaves=8
+num_cat=0
+split_feature=8 21 10 4 8 8 8
+split_gain=0.417004 0.47794 0.557344 0.340685 0.197684 0.507819 0.111576
+threshold=0.0011330044846493898 32.145853996276863 0.04083333333333334 0.028194855000000001 0.0092167855929323837 0.0056820016142050045 0.0022421637382801702
+decision_type=2 2 2 2 2 2 2
+left_child=-1 2 -2 4 5 6 -4
+right_child=1 -3 3 -5 -6 -7 -8
+leaf_value=-0.062818507315230906 0.067009403361793271 0.070914134942507007 -0.016811998978480343 0.033628979933121486 -0.068985779830322266 0.042853630777398045 -0.065543857062594177
+leaf_weight=0.93205360881984223 0.96399419009685505 1.0404548570513723 0.78305447567254383 1.078855764120817 0.9703453155234455 0.95633318461477745 1.1746004493907092
+leaf_count=18 11 10 17 22 27 21 32
+internal_value=0 0.00840317 -0.00256998 -0.0160843 -0.0298919 -0.0168739 -0.0460513
+internal_weight=0 6.96764 5.92718 4.96319 3.88433 2.91399 1.95765
+internal_count=158 140 130 119 97 70 49
+is_linear=0
+shrinkage=0.1
+
+
+Tree=21
+num_leaves=6
+num_cat=0
+split_feature=16 7 8 16 0
+split_gain=0.28662 0.391439 0.542673 0.460523 0.33442
+threshold=0.034443664000000006 0.41666666666666669 0.0025906909627839863 0.026746364500000005 20.098207473754886
+decision_type=2 2 2 2 2
+left_child=1 2 -1 -4 -3
+right_child=-2 4 3 -5 -6
+leaf_value=0.045210399089379683 0.044904327529366711 -0.0019504101199897925 0.013089727545567498 -0.0765536251848081 -0.085298254271723176
+leaf_weight=2.0746769830584526 1.1961797997355459 0.91075746109709133 1.3486868683248761 0.99651524610817421 1.0211388906463978
+leaf_count=32 20 23 30 29 24
+internal_value=0 -0.00845648 0.00795589 -0.0250012 -0.0460054
+internal_weight=0 6.35178 4.41988 2.3452 1.9319
+internal_count=158 138 91 59 47
+is_linear=0
+shrinkage=0.1
+
+
+Tree=22
+num_leaves=8
+num_cat=0
+split_feature=8 21 10 4 25 8 5
+split_gain=0.291605 0.387392 0.446921 0.231068 0.420782 0.18917 0.139549
+threshold=0.0011330044846493898 32.145853996276863 0.04083333333333334 0.0095907840000000015 24.795311927795414 0.0037735580886324232 1.0000000180025095e-35
+decision_type=2 2 2 2 2 2 2
+left_child=-1 2 -2 4 -4 -5 -7
+right_child=1 -3 3 5 -6 6 -8
+leaf_value=-0.053838597917296498 0.064844121390086329 0.067117383806447037 -0.0019490486359513507 -0.029607267152307312 -0.11039881871590014 -0.0060045400065358761 0.048692978900316208
+leaf_weight=0.88313398882746685 0.8286428079009055 0.92997398227453221 0.84832909330725648 1.2539931214414539 0.61868639476597309 0.95862433128058888 0.90846259985119104
+leaf_count=18 11 10 19 30 23 25 22
+internal_value=0 0.00749155 -0.00274533 -0.0149525 -0.0476857 0.000433293 0.0206095
+internal_weight=0 6.34671 5.41674 4.5881 1.46702 3.12108 1.86709
+internal_count=158 140 130 119 42 77 47
+is_linear=0
+shrinkage=0.1
+
+
+Tree=23
+num_leaves=6
+num_cat=0
+split_feature=9 0 21 25 13
+split_gain=0.584267 0.211417 0.405846 0.444815 0.515713
+threshold=0.12699433382430414 45.991785049438484 13.680079460144045 17.521934509277347 14.128611087799074
+decision_type=2 2 2 2 2
+left_child=-1 2 3 4 -2
+right_child=1 -3 -4 -5 -6
+leaf_value=-0.076763256498658117 0.029931086063135767 0.037900622454161238 -0.057038846482908745 0.078295456953431958 -0.066418106142492842
+leaf_weight=0.86914830096065987 1.4664534311741597 1.9639612473547456 1.0116043370217083 0.83646825700998295 0.89433709206059564
+leaf_count=21 39 36 27 13 22
+internal_value=0 0.0108084 -0.00183344 0.0156334 -0.00656883
+internal_weight=0 6.17282 4.20886 3.19726 2.36079
+internal_count=158 137 101 74 61
+is_linear=0
+shrinkage=0.1
+
+
+Tree=24
+num_leaves=8
+num_cat=0
+split_feature=8 16 21 23 4 2 14
+split_gain=0.265661 0.296406 0.495306 0.329379 0.162214 0.370939 0.248473
+threshold=0.0011330044846493898 0.034443664000000006 32.145853996276863 10.678929328918459 0.0095907840000000015 1.0000000180025095e-35 10.135197639465334
+decision_type=2 2 2 2 2 2 2
+left_child=-1 2 3 4 -2 6 -6
+right_child=1 -3 -4 -5 5 -7 -8
+leaf_value=-0.054156122766160067 -0.06381430804410812 0.059270416922667248 0.066685531403422232 0.043017472190001287 -0.084213851937665174 0.043897675406448726 -0.0060948202223308941
+leaf_weight=0.79794196411967266 1.0038618212565782 0.92600275948643673 0.85985336452722538 0.75313391163945187 0.75594291556626581 0.72193492949008931 0.88246781378984451
+leaf_count=18 36 17 10 13 26 18 20
+internal_value=0 0.00732034 -0.00234492 -0.016761 -0.0301435 -0.0158231 -0.042138
+internal_weight=0 5.9032 4.97719 4.11734 3.36421 2.36035 1.63841
+internal_count=158 140 123 113 100 64 46
+is_linear=0
+shrinkage=0.1
+
+
+Tree=25
+num_leaves=6
+num_cat=0
+split_feature=2 2 0 14 22
+split_gain=0.208755 0.562925 0.240541 0.28573 0.226279
+threshold=1.0000000180025095e-35 23.45079326629639 33.836606979370124 10.135197639465334 28.664059638977054
+decision_type=2 2 2 2 2
+left_child=2 -2 3 -1 -3
+right_child=1 4 -4 -5 -6
+leaf_value=-0.037209864815233216 0.079112862231172421 -0.050844628854130131 -0.067991625696924782 0.033442024902838458 0.013947468824730205
+leaf_weight=1.1761631672270603 1.0214670151472094 0.85553040448576245 0.75243491958826769 1.1151076536625621 1.4569402867928145
+leaf_count=38 24 20 17 27 32
+internal_value=0 0.0172867 -0.018935 -0.00282525 -0.0100233
+internal_weight=0 3.33394 3.04371 2.29127 2.31247
+internal_count=158 76 82 65 52
+is_linear=0
+shrinkage=0.1
+
+
+Tree=26
+num_leaves=6
+num_cat=0
+split_feature=8 0 16 2 14
+split_gain=0.276019 0.308335 0.317825 0.278397 0.111587
+threshold=0.0011330044846493898 36.241176605224616 0.027501916500000004 34.072092056274421 10.135197639465334
+decision_type=2 2 2 2 2
+left_child=-1 2 -2 -3 -4
+right_child=1 3 4 -5 -6
+leaf_value=-0.052858126030529751 -0.055716905454852195 0.058724678789896081 -0.0096634271750780446 -0.010178898530984356 0.04142867531657049
+leaf_weight=0.85303359292447556 1.1196701647713783 1.6167152747511866 0.98121094144880749 0.92010438721626986 0.75746415741741657
+leaf_count=18 36 32 27 26 19
+internal_value=0 0.00835744 -0.014164 0.0337334 0.0125952
+internal_weight=0 5.39516 2.85835 2.53682 1.73868
+internal_count=158 140 82 58 46
+is_linear=0
+shrinkage=0.1
+
+
+Tree=27
+num_leaves=6
+num_cat=0
+split_feature=7 8 2 21 22
+split_gain=0.219869 0.500934 0.217307 0.424271 0.597624
+threshold=0.41666666666666669 0.0045257208387942342 1.0000000180025095e-35 14.068673610687258 29.328316688537601
+decision_type=2 2 2 2 2
+left_child=2 -2 -1 -4 -5
+right_child=1 -3 3 4 -6
+leaf_value=-0.020304112727457684 -0.096243070331800185 0.012203730620054132 0.082683704752382597 -0.052080376861973643 0.05742938875754975
+leaf_weight=1.3954699635505674 0.69064252171665419 1.1113214874640105 0.94808798842132125 1.0198747757822273 0.97450284846127022
+leaf_count=36 21 32 17 33 19
+internal_value=0 -0.0293609 0.0121964 0.0276099 0.00142884
+internal_weight=0 1.80196 4.33794 2.94247 1.99438
+internal_count=158 53 105 69 52
+is_linear=0
+shrinkage=0.1
+
+
+Tree=28
+num_leaves=7
+num_cat=0
+split_feature=25 25 21 22 0 25
+split_gain=0.155956 0.222859 0.31181 0.294026 0.21832 0.199321
+threshold=18.387420654296879 24.052399635314945 32.145853996276863 29.14628887176514 25.365817070007328 9.0647997856140154
+decision_type=2 2 2 2 2 2
+left_child=4 -2 3 -3 5 -1
+right_child=1 2 -4 -5 -6 -7
+leaf_value=-0.03282400161322991 0.058251715126107079 -0.079316090183969845 0.047738465525221235 0.010570821335719833 -0.05466218800059916 0.036765851093680552
+leaf_weight=0.76840940909460209 0.86515894904732737 0.64763051643967651 0.83147170767188061 0.83066660817712545 1.0037727048620579 0.88634402118623257
+leaf_count=29 15 29 11 23 29 22
+internal_value=0 0.0149621 -0.00125273 -0.0288079 -0.0178684 0.00445077
+internal_weight=0 3.17493 2.30977 1.4783 2.65853 1.65475
+internal_count=158 78 63 52 80 51
+is_linear=0
+shrinkage=0.1
+
+
+Tree=29
+num_leaves=6
+num_cat=0
+split_feature=2 21 22 16 14
+split_gain=0.122643 0.317586 0.382117 0.168278 0.249131
+threshold=1.0000000180025095e-35 13.680079460144045 29.328316688537601 0.027169252500000001 10.135197639465334
+decision_type=2 2 2 2 2
+left_child=3 -2 -3 -1 -5
+right_child=1 2 -4 4 -6
+leaf_value=-0.047622287952190027 0.0671655220725597 -0.047394282583864314 0.03870528877923609 -0.03534134865586578 0.039503300501810071
+leaf_weight=1.0072819441556933 0.81868823617696795 1.08333130273968 0.98334196675568808 0.85662442352622725 0.92495765350759029
+leaf_count=35 17 38 21 25 22
+internal_value=0 0.0144538 -0.00642732 -0.0149539 0.00351632
+internal_weight=0 2.88536 2.06667 2.78886 1.78158
+internal_count=158 76 59 82 47
+is_linear=0
+shrinkage=0.1
+
+
+Tree=30
+num_leaves=6
+num_cat=0
+split_feature=21 2 4 10 13
+split_gain=0.130966 0.178669 0.165008 0.146238 0.0490083
+threshold=1.0000000180025095e-35 34.072092056274421 0.028194855000000001 0.18333333333333338 18.866895675659183
+decision_type=2 2 2 2 2
+left_child=2 -2 3 4 -1
+right_child=1 -3 -4 -5 -6
+leaf_value=-0.024285708578801603 0.040692687979374344 -0.01339931783176869 0.026396659842904215 -0.061407097672796174 0.012905580129374226
+leaf_weight=0.83203521883115239 1.3955725226551297 1.0856809420511124 0.75821996293961991 0.81446801032870997 0.61709682084619999
+leaf_count=31 36 33 21 24 13
+internal_value=0 0.0170245 -0.0139791 -0.0275034 -0.00844821
+internal_weight=0 2.48125 3.02182 2.2636 1.44913
+internal_count=158 69 89 68 44
+is_linear=0
+shrinkage=0.1
+
+
+Tree=31
+num_leaves=6
+num_cat=0
+split_feature=2 21 14 0 16
+split_gain=0.15329 0.359359 0.344242 0.223895 0.106791
+threshold=1.0000000180025095e-35 13.680079460144045 31.266446113586429 17.453324317932132 0.027169252500000001
+decision_type=2 2 2 2 2
+left_child=3 -2 -3 -1 -5
+right_child=1 2 -4 4 -6
+leaf_value=0.033379193598285554 0.071781555732806618 -0.060340295080867551 0.026176354529918316 -0.063964056870762731 -0.016014193818701703
+leaf_weight=0.65585701679810915 0.82394164800643954 0.74618165567517269 1.1987160407006738 0.74411077890545119 1.2359437011182306
+leaf_count=21 17 35 24 29 32
+internal_value=0 0.0164318 -0.00701672 -0.0172604 -0.0340339
+internal_weight=0 2.76884 1.9449 2.63591 1.98005
+internal_count=158 76 59 82 61
+is_linear=0
+shrinkage=0.1
+
+
+Tree=32
+num_leaves=7
+num_cat=0
+split_feature=0 14 13 4 25 7
+split_gain=0.271285 0.449035 0.200708 0.256798 0.220007 0.194625
+threshold=55.139339447021491 32.208251953125007 20.645353317260746 0.015958332500000002 9.0647997856140154 0.29166666666666669
+decision_type=2 2 2 2 2 2
+left_child=1 2 3 -1 -5 -4
+right_child=-2 -3 5 4 -6 -7
+leaf_value=-0.070945536459790223 0.059336589205795078 -0.074467647517789531 0.067023505976673656 -0.032079181517494303 0.041368023584384739 -0.0043227287174452218
+leaf_weight=0.57003214489668685 0.6721312622539698 0.84640478715300549 0.8241191543638704 0.76685344846919157 0.87113001197576523 0.71325868554413319
+leaf_count=22 16 19 23 30 21 27
+internal_value=0 -0.00868548 0.00618034 -0.0131359 0.0069823 0.0339228
+internal_weight=0 4.5918 3.74539 2.20802 1.63798 1.53738
+internal_count=158 142 123 73 51 50
+is_linear=0
+shrinkage=0.1
+
+
+Tree=33
+num_leaves=7
+num_cat=0
+split_feature=21 25 13 4 13 7
+split_gain=0.14792 0.216874 0.170283 0.161923 0.168716 0.101297
+threshold=32.145853996276863 32.295003890991218 9.5282044410705584 0.019045457000000005 20.103829383850101 0.29166666666666669
+decision_type=2 2 2 2 2 2
+left_child=1 2 -1 4 -4 -6
+right_child=-2 -3 3 -5 5 -7
+leaf_value=-0.04798220766887068 0.040935184071763428 -0.062618694962139163 -0.046152775750403621 0.042046194091592812 0.044600337113963703 -0.010951443098909728
+leaf_weight=0.57577705802395973 0.7509779967367648 0.60581279732286919 0.68065164051950011 1.1002146452665327 0.61935027083381988 0.69838005257770419
+leaf_count=19 12 21 26 33 21 26
+internal_value=0 -0.00718226 0.00195783 0.0112376 -0.00572413 0.0151586
+internal_weight=0 4.28019 3.67437 3.0986 1.99838 1.31773
+internal_count=158 146 125 106 73 47
+is_linear=0
+shrinkage=0.1
+
+
+Tree=34
+num_leaves=7
+num_cat=0
+split_feature=21 16 8 25 0 14
+split_gain=0.110786 0.140929 0.194341 0.327893 0.132045 0.0198271
+threshold=32.145853996276863 0.034443664000000006 0.0092167855929323837 9.3698225021362322 33.836606979370124 26.601057052612308
+decision_type=2 2 2 2 2 2
+left_child=1 2 3 -1 -5 -6
+right_child=-2 -3 -4 4 5 -7
+leaf_value=-0.063002657199513173 0.035773989365640718 0.032071655959914756 -0.057705126256836818 0.052176316749237686 -0.015620152913051653 0.010903712447241101
+leaf_weight=0.64626883342862207 0.73447954282164563 0.77348623797297467 0.81646766094490875 0.74780247267335642 0.54928456619381882 0.57880384474992752
+leaf_count=26 12 20 34 23 19 24
+internal_value=0 -0.00638972 -0.0153004 -0.0015732 0.01959 -0.00201119
+internal_weight=0 4.11211 3.33863 2.52216 1.87589 1.12809
+internal_count=158 146 126 92 66 43
+is_linear=0
+shrinkage=0.1
+
+
+Tree=35
+num_leaves=7
+num_cat=0
+split_feature=25 25 16 16 13 14
+split_gain=0.098766 0.113598 0.129422 0.203384 0.130744 0.108157
+threshold=33.896535873413093 30.865914344787601 0.021582741000000003 0.034443664000000006 20.645353317260746 10.135197639465334
+decision_type=2 2 2 2 2 2
+left_child=1 2 -1 4 5 -4
+right_child=-2 -3 3 -5 -6 -7
+leaf_value=0.043223956190771677 0.037345317066841272 -0.04608152274753894 -0.06658653083036585 0.048106588983409672 0.010806254851517235 -0.01215535446824704
+leaf_weight=0.60613692272454534 0.61458056420087803 0.59375917026773084 0.7108645690605051 0.53107937797904003 0.84370453795418132 0.75042711570858955
+leaf_count=17 16 19 32 15 33 26
+internal_value=0 -0.00568678 0.00128104 -0.00768316 -0.0205373 -0.0386341
+internal_weight=0 4.03597 3.44221 2.83608 2.305 1.46129
+internal_count=158 142 123 106 91 58
+is_linear=0
+shrinkage=0.1
+
+
+Tree=36
+num_leaves=7
+num_cat=0
+split_feature=21 10 0 10 14 21
+split_gain=0.0951295 0.164771 0.155072 0.146734 0.124864 0.136524
+threshold=32.145853996276863 0.04083333333333334 33.149501800537116 0.13392857142857145 31.266446113586429 13.680079460144045
+decision_type=2 2 2 2 2 2
+left_child=1 -1 3 -3 5 -4
+right_child=-2 2 4 -5 -6 -7
+leaf_value=0.046787536894932778 0.033668524142382854 -0.032363554983676456 -0.026971833942167379 0.028091423705162745 0.0060643577414971183 -0.098515684680274052
+leaf_weight=0.50910016335547004 0.70863134413957585 0.6272796364501122 0.67865620367228963 1.1153470072895286 0.47601946350187052 0.43943204963579774
+leaf_count=12 12 28 22 39 18 27
+internal_value=0 -0.00620374 -0.0142889 0.00632992 -0.0368286 -0.0550901
+internal_weight=0 3.84583 3.33673 1.74263 1.59411 1.11809
+internal_count=158 146 134 67 67 49
+is_linear=0
+shrinkage=0.1
+
+
+Tree=37
+num_leaves=7
+num_cat=0
+split_feature=8 21 16 16 8 25
+split_gain=0.131712 0.193796 0.133064 0.132841 0.208619 0.0611588
+threshold=0.0011330044846493898 24.895499229431156 0.023415235500000003 0.029257921500000002 0.0080005120327700987 12.433508396148683
+decision_type=2 2 2 2 2 2
+left_child=-1 2 -2 5 -5 -4
+right_child=1 -3 3 4 -6 -7
+leaf_value=-0.047413748242735025 -0.04468416307900526 0.043062364195409743 0.0064910340562023038 -0.063144711459543534 0.022251514896203597 0.056423273239302942
+leaf_weight=0.51714662648737419 0.71174723096191961 1.0478782141581175 0.47537296218797598 0.53914827015250899 0.60944607295095921 0.50683303503319621
+leaf_count=18 27 26 23 20 24 20
+internal_value=0 0.00630262 -0.00724852 0.00525604 -0.0178333 0.0322568
+internal_weight=0 3.89043 2.84255 2.1308 1.14859 0.982206
+internal_count=158 140 114 87 44 43
+is_linear=0
+shrinkage=0.1
+
+
+Tree=38
+num_leaves=7
+num_cat=0
+split_feature=8 21 28 13 13 13
+split_gain=0.115188 0.15311 0.119618 0.212841 0.181561 0.175092
+threshold=0.0011330044846493898 24.895499229431156 25.719419479370121 20.645353317260746 14.128611087799074 9.8729591369628924
+decision_type=2 2 2 2 2 2
+left_child=-1 2 3 4 5 -2
+right_child=1 -3 -4 -5 -6 -7
+leaf_value=-0.044554998749652297 -0.029763496788109661 0.038891081619711526 -0.050027394559004949 0.053190380362611978 -0.058786788073812761 0.051553319199995042
+leaf_weight=0.51190251577645529 0.54385660495609156 1.0313645042479036 0.50902553042396892 0.62761719524860371 0.60621902486309398 0.5160425859503448
+leaf_count=18 23 26 29 18 25 19
+internal_value=0 0.00594864 -0.00617358 0.00355846 -0.0151376 0.00982795
+internal_weight=0 3.83413 2.80276 2.29374 1.66612 1.0599
+internal_count=158 140 114 85 67 42
+is_linear=0
+shrinkage=0.1
+
+
+Tree=39
+num_leaves=7
+num_cat=0
+split_feature=25 14 16 8 16 16
+split_gain=0.0833108 0.0974502 0.179629 0.0861303 0.150615 0.177263
+threshold=33.896535873413093 32.208251953125007 0.021582741000000003 0.021527777777777781 0.032652678500000011 0.027169252500000001
+decision_type=2 2 2 2 2 2
+left_child=1 2 -1 4 5 -4
+right_child=-2 -3 3 -5 -6 -7
+leaf_value=0.054644892638585574 0.036681786335810665 -0.040343025908078763 -0.04155818873272938 0.025151434729292634 -0.067668203917619324 0.030239079461217969
+leaf_weight=0.53608402051031667 0.53888291772454966 0.65582779143005598 0.63758438406512163 0.55811127461493004 0.48349025892093767 0.7464878698810935
+leaf_count=17 16 19 32 22 21 31
+internal_value=0 -0.00546419 0.00225909 -0.00931839 -0.0196195 -0.00283493
+internal_weight=0 3.61759 2.96176 2.42567 1.86756 1.38407
+internal_count=158 142 123 106 84 63
+is_linear=0
+shrinkage=0.1
+
+
+Tree=40
+num_leaves=6
+num_cat=0
+split_feature=4 13 2 8 2
+split_gain=0.0874825 0.223664 0.158117 0.134595 0.0754967
+threshold=0.004990254500000001 32.668220520019538 1.0000000180025095e-35 0.0045257208387942342 23.45079326629639
+decision_type=2 2 2 2 2
+left_child=4 2 3 -2 -1
+right_child=1 -3 -4 -5 -6
+leaf_value=0.048489412175688869 -0.050727395615734742 -0.068634174746295101 0.038694806097133397 0.0096801846005679718 -0.0025901527258211324
+leaf_weight=0.58473527710884787 0.63174861622974343 0.5209877025336026 0.83615491073578585 0.88633348606526852 0.57281402731314301
+leaf_count=20 28 17 31 39 23
+internal_value=0 -0.00934529 0.00377522 -0.0154584 0.0232127
+internal_weight=0 2.87522 2.35424 1.51808 1.15755
+internal_count=158 115 98 67 43
+is_linear=0
+shrinkage=0.1
+
+
+Tree=41
+num_leaves=6
+num_cat=0
+split_feature=21 16 8 25 28
+split_gain=0.0775243 0.0896366 0.180053 0.161483 0.0946686
+threshold=32.145853996276863 0.034443664000000006 0.0092167855929323837 9.3698225021362322 26.199076652526859
+decision_type=2 2 2 2 2
+left_child=1 2 3 -1 -5
+right_child=-2 -3 -4 4 -6
+leaf_value=-0.048743419517926753 0.033086384866819696 0.029465434095516448 -0.058802802465162396 0.032586444520453166 -0.020091987585103513
+leaf_weight=0.49964422872290182 0.60067240893840779 0.58998890407383431 0.66536663705483068 1.1085247891023753 0.49280600529164065
+leaf_count=26 12 20 34 39 27
+internal_value=0 -0.00592137 -0.0134685 0.000888664 0.0163748
+internal_weight=0 3.35633 2.76634 2.10098 1.60133
+internal_count=158 146 126 92 66
+is_linear=0
+shrinkage=0.1
+
+
+Tree=42
+num_leaves=7
+num_cat=0
+split_feature=8 21 16 8 7 8
+split_gain=0.0890581 0.123812 0.100911 0.115557 0.088722 0.108766
+threshold=0.0011330044846493898 32.145853996276863 0.034443664000000006 0.0092167855929323837 0.29166666666666669 0.0045257208387942342
+decision_type=2 2 2 2 2 2
+left_child=-1 2 3 4 -2 -6
+right_child=1 -3 -4 -5 5 -7
+leaf_value=-0.04170466878842926 0.03033691800504177 0.05147578616796239 0.038478836298834529 -0.047581846478432062 -0.042948580514598357 0.021159494546006435
+leaf_weight=0.45198747701942954 0.68671887973323587 0.50046246871352185 0.50019538309425104 0.6324089909903704 0.62077644467353799 0.46130934543907642
+leaf_count=18 28 10 17 34 29 22
+internal_value=0 0.00554106 -0.00238219 -0.0108939 0.00222328 -0.0156183
+internal_weight=0 3.40187 2.90141 2.40121 1.7688 1.08209
+internal_count=158 140 130 113 79 51
+is_linear=0
+shrinkage=0.1
+
+
+Tree=43
+num_leaves=6
+num_cat=0
+split_feature=0 2 2 13 4
+split_gain=0.0727374 0.0933982 0.12516 0.107071 0.0884186
+threshold=16.082396030426029 1.0000000180025095e-35 18.467117309570316 14.128611087799074 0.0097856660000000019
+decision_type=2 2 2 2 2
+left_child=-1 3 -3 -2 -4
+right_child=1 2 4 -5 -6
+leaf_value=-0.039785726440474289 0.017847946141578568 0.061647108290049768 -0.02035731825189269 -0.035843071523313619 0.032476492181317901
+leaf_weight=0.40916719194501672 0.63999430462718032 0.52084704861044873 0.70158876851201035 0.88507650187239051 0.57746530557051301
+leaf_count=19 28 15 37 39 20
+internal_value=0 0.00489599 0.0203235 -0.0133117 0.00349601
+internal_weight=0 3.32497 1.7999 1.52507 1.27905
+internal_count=158 139 72 67 57
+is_linear=0
+shrinkage=0.1
+
+
+Tree=44
+num_leaves=6
+num_cat=0
+split_feature=25 8 5 25 21
+split_gain=0.0625769 0.121466 0.142761 0.0807215 0.165353
+threshold=18.387420654296879 0.0045257208387942342 1.0000000180025095e-35 24.052399635314945 24.895499229431156
+decision_type=2 2 2 2 2
+left_child=1 -1 -3 -2 -5
+right_child=3 2 -4 4 -6
+leaf_value=-0.049379476049675804 0.046339060222216288 -0.02653364328746052 0.04607715957714819 -0.049368131253503721 0.02345719937446572
+leaf_weight=0.61799418972805176 0.51243387069553126 0.60291822254657723 0.4915185384452343 0.45913688233122207 0.97143290378153324
+leaf_count=31 15 27 22 33 30
+internal_value=0 -0.013937 0.00607633 0.0122831 8.41381e-05
+internal_weight=0 1.71243 1.09444 1.943 1.43057
+internal_count=158 80 49 78 63
+is_linear=0
+shrinkage=0.1
+
+
+Tree=45
+num_leaves=6
+num_cat=0
+split_feature=13 8 8 16 16
+split_gain=0.0917511 0.0795707 0.105024 0.0582122 0.0993795
+threshold=11.994853973388674 0.0025906909627839863 0.0012878305404078602 0.029983741000000005 0.025635084500000006
+decision_type=2 2 2 2 2
+left_child=-1 2 -2 4 -3
+right_child=1 3 -4 -5 -6
+leaf_value=-0.032154408320878812 -0.0039274428979306246 0.0043871020695700116 0.056941510205087864 0.020546395106258747 -0.054575588118598417
+leaf_weight=0.714358251076192 0.53208057489246152 0.76265780138783135 0.60665218159556389 0.59004639135673631 0.45722632389515638
+leaf_count=34 23 34 18 25 24
+internal_value=0 0.00778989 0.0285001 -0.0052401 -0.0177128
+internal_weight=0 2.94866 1.13873 1.80993 1.21988
+internal_count=158 124 41 83 58
+is_linear=0
+shrinkage=0.1
+
+
+Tree=46
+num_leaves=8
+num_cat=0
+split_feature=25 14 16 16 6 8 13
+split_gain=0.058902 0.0491965 0.0863751 0.0715479 0.0740583 0.162972 0.137908
+threshold=33.896535873413093 32.208251953125007 0.021582741000000003 0.025451007500000004 3.0947244167327885 0.0025906909627839863 20.103829383850101
+decision_type=2 2 2 2 2 2 2
+left_child=1 2 -1 -4 5 -5 -7
+right_child=-2 -3 3 4 -6 6 -8
+leaf_value=0.041792609170116179 0.034173320227839504 -0.032693992743189362 -0.047942878221942382 0.046322698496151282 0.039941735274795304 -0.07061522408179205 0.0036525653648134572
+leaf_weight=0.42872872250154737 0.44117230782285322 0.52757958276197303 0.36146174650639329 0.37570603657513846 0.38081778259947885 0.46724357921630122 0.53782805055379868
+leaf_count=17 16 19 17 17 22 23 27
+internal_value=0 -0.00489592 0.000851309 -0.00741635 0.000899289 -0.0098686 -0.0308735
+internal_weight=0 3.07937 2.55179 2.12306 1.7616 1.38078 1.00507
+internal_count=158 142 123 106 89 67 50
+is_linear=0
+shrinkage=0.1
+
+
+Tree=47
+num_leaves=7
+num_cat=0
+split_feature=21 25 2 21 4 8
+split_gain=0.0584348 0.0916013 0.10087 0.165103 0.107869 0.121627
+threshold=32.145853996276863 32.295003890991218 1.0000000180025095e-35 13.680079460144045 0.014555615500000002 0.0045257208387942342
+decision_type=2 2 2 2 2 2
+left_child=1 2 4 -4 -1 -6
+right_child=-2 -3 3 -5 5 -7
+leaf_value=-0.0629928141748681 0.031163250166351526 -0.050219702325683319 0.071325332461225494 -0.0088539015441552668 -0.038922669778865687 0.028666434408213322
+leaf_weight=0.35992987640202168 0.5114555601030587 0.39551986288279284 0.44598291162401416 0.60550577635876834 0.46071922709234037 0.63073405344039202
+leaf_count=20 12 21 14 35 25 31
+internal_value=0 -0.00549913 0.00156791 0.0251537 -0.0155193 0.000136033
+internal_weight=0 2.89839 2.50287 1.05149 1.45138 1.09145
+internal_count=158 146 125 49 76 56
+is_linear=0
+shrinkage=0.1
+
+
+Tree=48
+num_leaves=6
+num_cat=0
+split_feature=7 28 21 0 2
+split_gain=0.0806158 0.177676 0.0543632 0.12686 0.164945
+threshold=0.41666666666666669 12.234549045562746 24.895499229431156 43.64513015747071 1.0000000180025095e-35
+decision_type=2 2 2 2 2
+left_child=2 -2 3 4 -1
+right_child=1 -3 -4 -5 -6
+leaf_value=-0.017000858901476266 0.019338586219818387 -0.066361333727827682 0.029487742409491393 -0.053041932475200643 0.063014897953439647
+leaf_weight=0.63675073161721296 0.47566249617375422 0.49229605868458748 0.89145177695900191 0.36304308031685639 0.43268651887774467
+leaf_count=32 28 25 30 22 21
+internal_value=0 -0.0242477 0.0100996 -0.0019659 0.0153729
+internal_weight=0 0.967959 2.32393 1.43248 1.06944
+internal_count=158 53 105 75 53
+is_linear=0
+shrinkage=0.1
+
+
+Tree=49
num_leaves=7
num_cat=0
-split_feature=3 3 24 22 7 17
-split_gain=0.123967 0.131918 0.158743 0.1777 0.116193 0.10828
-threshold=0.018019480519480522 0.0058651530787753705 23.04527568817139 18.93778228759766 0.027130383000000004 11.632615089416506
+split_feature=7 4 0 10 21 8
+split_gain=0.0608698 0.130648 0.0561861 0.138229 0.0789288 0.096313
+threshold=0.41666666666666669 0.023314077500000006 36.241176605224616 0.15476190476190479 28.248815536499027 0.0037735580886324232
decision_type=2 2 2 2 2 2
-left_child=1 2 -1 -4 -5 -3
-right_child=-2 5 3 4 -6 -7
-leaf_value=0.010534121130993713 -0.014170690004583389 0.028615132328030597 -0.028104839097028086 0.0091416979972488207 -0.013600909116628418 0.0030381471291287114
-leaf_weight=1.7825879901647566 1.2892666812986133 0.77476169914007165 0.82290455326437983 1.2607608251273634 1.0127553343772886 0.88816887885332108
-leaf_count=33 37 15 18 37 30 27
-internal_value=0 0.00279272 -0.00135243 -0.00819543 -0.000989172 0.0149545
-internal_weight=0 6.54194 4.87901 3.09642 2.27352 1.66293
-internal_count=197 160 118 85 67 42
+left_child=2 -2 3 -1 5 -4
+right_child=1 -3 4 -5 -6 -7
+leaf_value=-0.046826184088443391 -0.068698236764030474 0.0080196379758473175 -0.031393400276308256 0.029004875380223796 0.055462334677542004 0.036404835215188655
+leaf_weight=0.48795042559504587 0.36014407733455289 0.57861005538143218 0.40028846217319347 0.47379456413909793 0.46459219232201576 0.43968251277692616
+leaf_count=26 20 33 23 20 12 24
+internal_value=0 -0.0214124 0.0088695 -0.00946873 0.0223887 0.00409556
+internal_weight=0 0.938754 2.26631 0.961745 1.30456 0.839971
+internal_count=158 53 105 46 59 47
is_linear=0
-shrinkage=0.05
+shrinkage=0.1
end of trees
feature_importances:
-bm25_stemmed_title=82
-tracker_score=77
-fetch_time_ms=75
-page_centrality=69
-bm25_clean_body=66
-host_centrality=62
-bm25_backlink_text=47
-bm25_url=46
-bm25_stemmed_clean_body=34
-bm25_title_if_homepage=26
-bm25_clean_body_bigrams=14
-bm25_title_bigrams=13
-bm25_title=12
-bm25_site=12
-url_slashes=12
-bm25_clean_body_trigrams=8
-bm25_domain=5
-bm25_domain_if_homepage=4
-bm25_title_trigrams=4
-is_homepage=1
+fetch_time_ms=40
+host_centrality=35
+bm25_title_bigrams=34
+bm25_url=33
+bm25_clean_body_bigrams=26
+bm25_backlink_text=21
+page_centrality=20
+bm25_stemmed_title=20
+bm25_title=18
+tracker_score=16
+url_slashes=9
+bm25_stemmed_clean_body=6
+bm25_clean_body=5
+is_homepage=2
+bm25_title_if_homepage=2
+region=2
+bm25_site=1
parameters:
[boosting: gbdt]
@@ -60,8 +988,8 @@ parameters:
[device_type: cpu]
[data: ]
[valid: ]
-[num_iterations: 100]
-[learning_rate: 0.05]
+[num_iterations: 50]
+[learning_rate: 0.1]
[num_leaves: 20]
[num_threads: -1]
[deterministic: 0]
@@ -150,7 +1078,7 @@ parameters:
[tweedie_variance_power: 1.5]
[lambdarank_truncation_level: 30]
[lambdarank_norm: 1]
-[label_gain: 0,1,2,3,4,5,6,7,8,9,10]
+[label_gain: 0,1,2,3,4]
[eval_at: 1,2,3,5,10]
[multi_error_top_k: 1]
[auc_mu_weights: ]
diff --git a/ltr/lambdamart.py b/ltr/lambdamart.py
index 33792c94..d19915d3 100644
--- a/ltr/lambdamart.py
+++ b/ltr/lambdamart.py
@@ -101,7 +101,7 @@ print("Train size:", len(X_train))
print("Test size:", len(X_test))
# Train model
-n_estimators = 100
+n_estimators = 50
model = lgb.LGBMRanker(
objective="lambdarank",
metric="ndcg",
@@ -109,7 +109,7 @@ model = lgb.LGBMRanker(
num_leaves=20,
n_estimators=n_estimators,
max_depth=10,
- learning_rate=0.05,
+ learning_rate=0.1,
label_gain=[i for i in range(max(y_train.max(), y_test.max()) + 1)],
)
model.fit(
@@ -123,24 +123,30 @@ model.fit(
eval_metric="ndcg",
)
-best_iteration = (
- n_estimators - 1 if model.best_iteration_ is None else model.best_iteration_
-)
-
-print("Best iteration:", best_iteration)
-
# dump model
model.booster_.save_model(
"data/lambdamart.txt",
- start_iteration=best_iteration,
- num_iteration=best_iteration,
)
# print feature importance
-pprint(
- sorted(
- [(id2feature[i], v) for i, v in enumerate(model.feature_importances_) if v > 0],
- key=lambda x: x[1],
- reverse=True,
- )
-)
+# pprint(
+# sorted(
+# [(id2feature[i], v) for i, v in enumerate(model.feature_importances_) if v > 0],
+# key=lambda x: x[1],
+# reverse=True,
+# )
+# )
+
+# verify that the saved model outputs the same scores
+# for the same input
+saved_model = lgb.Booster(model_file="data/lambdamart.txt")
+
+for i in range(len(X_test)):
+ assert model.predict(X_test[i : i + 1]) == saved_model.predict(X_test[i : i + 1])
+
+# print an example
+print("Example:")
+t = X_test[0]
+print("Features:")
+pprint({id2feature[i]: v for i, v in enumerate(t)})
+print("Score:", model.predict(t.reshape(1, -1))[0])