# Why doesn't Logloss match Similarity score in this xgboost example?

I am trying to get direct connection between Gain and Logloss for XGBoost. It looks to me that in Xgboost paper formula 6: for a model with depth 1 and number of trees=1 this formula contains Similarity score for the node. On the other hand formula 6 approximates minimum loss and should be equal to logloss value of the model.

However when I calculate by hands at google spreadsheet these two values are different. Please have a look at:

1. sheet "One tree depth2"
2. Logloss in Cell K47=0,30 (which matches python code below)
3. Similarity score for the node Cell O47=0,05 - these values doesn't match.

df = pd.read_excel('Xgboost calculation.xlsx', sheet_name='raw_data')
x=df[[0,1]].values
y=df['TARGET'].values
model = xgb.XGBClassifier(verbosity = 0,n_estimators=1,max_depth=1,learning_rate=1,reg_alpha=0,reg_lambda=0,subsample=1,
min_child_weight=0)
model.fit(x, y,eval_set=[(x, y)])


My question is why doesnt Logloss match Similarity score in this example? Is it due to taylor's approximation?

• Please edit your title and post to contain a question. As it stands, it's hard to know exactly what you want to know.
– Sycorax
Jan 30 at 13:34
• Thanks for editing to include a question. This is very helpful. But it looks like some of the hyperlinks were broken when you made the last edit.
– Sycorax
Jan 30 at 14:16
• +1 as this question clearly is showing research effort but... right now it seems you are asking some stranger to: 1. do some data loading from a spreadsheet on the Internet, 2. code a tiny modelling script up, 3. extract the intermediate/diagnostic values, 4. validate those values against your raw results stored in a different sheet, 5. validate then the calculations you have on this new sheet are correct, and then 6. explain why something happens (assuming they know what is going on). You have a higher opinion about strangers on the Internet than me... Google "min reproducible example SO". :) Jan 30 at 14:19
• Actually I thought that formula would be sufficient. Anyway If i find the answer I will post it here. Jan 30 at 14:25
• Please do! I will happily upvote that too! Jan 30 at 14:26