<jupyter_start><jupyter_text>Create your own XGBoost modelsBefore proceeding, confirm that you have done the `Feature Sets and Logging Lab`Our goal here to pick up the training data we generated for the `Title` judgments and use it to train an xgboost model.We have an example set of features logged out for you in `data/title_features.csv`. But you are encouraged to you the features you created in `Feature Sets and Logging Lab`. To save your own features out to disk in that notebook, run: `df.to_csv('data/title_features.csv', index=False)`<jupyter_code>import pandas as pd
df = pd.read_csv('data/title_features.csv')
df
import xgboost as xgb

# Set up the DM matrix for XGBoost from df using all of the logged features

# Define required params for your ranking model

# Train your ranking model

# Evaluate the performance of you model
print(___your_model____.eval(___your_data_____))<jupyter_output><empty_output><jupyter_text>Optional: Modify your feature setCreate a new feature (or two) and re-log the feature values to `title_features.csv`. The goal here is to train a new model and see if it have a higher eval metric than your originalYou might want to plot you models to see how and where new features are getting used<jupyter_code># plot your model to see the splits<jupyter_output><empty_output><jupyter_text>Create your own Ranklib modelsAgain we will use the `Title` judgments to experiment with different rankers and objectives.Our goal here is to show how good `LambdaMart` is for ranking tasks.Because Ranklib supports a range of models and objective metrics, this is the easier tool to use compared to XGBoost.<jupyter_code># log features

import ltr
from ltr.client import _____
from ltr.log import FeatureLogger
from ltr.judgments import judgments_open
from itertools import groupby

# Set up your engine
client = ______

ftr_logger=FeatureLogger(client, index='tmdb' , feature_set= ____ )


with judgments_open('data/title_judgments.txt') as judgment_list:
    for qid, query_judgments in groupby(judgment_list, key=lambda j: j.qid):
        ftr_logger.log_for_qid(judgments=query_judgments, 
                               qid=qid,
                               keywords=judgment_list.keywords(qid))
# use this to grab the raw ranklib command
from ltr.ranklib import train

train(client, training_set=ftr_logger.logged, 
      index='tmdb', featureSet= ____, modelName= _____)

# raw command looks like:
# java -jar /var/folders/7_/cvjz84n54vx7zv_pw3gmdqr00000gn/T/RankyMcRankFace.jar -ranker 6 -shrinkage 0.1 -metric2t DCG@10 -tree 50 -bag 1 -leaf 10 -frate 1.0 -srate 1.0 -train /var/folders/7_/cvjz84n54vx7zv_pw3gmdqr00000gn/T/training.txt -save data/tates_model.txt
# Run the raw command, remember to pre-pend with a bang (!)


# Set -tree to 1


# Set -metric2t to NDCG@10


# Set -ranker to 9 (Linear Regression)


# Set -ranker to 8 (Random Forest)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0673076923076923, 'fraction_numerical': 0.015453296703296704, 'mean_word_length': 4.444859813084112, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '523074', 'license': 'Apache-2.0', 'n_tokens_mistral': 948, 'n_tokens_neox': 885, 'n_words': 348, 'path': 'notebooks/exercises/Models and More Models.ipynb', 'repo_name': 'risdenk/hello-ltr', 'size': '2912'}