17 Kasım 2022 Perşembe

Creating tables for model comparison

In this post, I will compile codes to compare different models' results. The post will hopefully lengthen as I add new ones..

Here is the first one comparing a decision tree, rf, and other tuned regressors:

The code creates this table:
Code:

models_test_comp_df = pd.concat(
    [
        dt_regressor_perf_test.T,
        regressor_perf_test.T,
        bagging_estimator_perf_test.T,
        dtree_tuned_regressor_perf_test.T,
        bagging_tuned_regressor_perf_test.T,
        rf_tuned_regressor_perf_test.T
    ],
    axis=1,
)
models_test_comp_df.columns = [
    "Decision tree regressor",
    "Random Forest regressor",
    "Bagging regressor",
    "Tuned Decision Tree regressor",
    "Tuned Bagging Tree regressor",
    "Tuned Random Forest Regressor"]
print("Test performance comparison:")
models_test_comp_df


A second code to retrieve a table for a similar comparison: (table not included this time)


# defining list of models you have trained
models = [lr, dtree, ridge_model, dtree_tuned, rf_model, rf_model_tuned]
# defining empty lists to add train and test results
r2_train = []
r2_test = []
rmse_train= []
rmse_test= []
# looping through all the models to get the rmse and r2 scores
for model in models:
    # accuracy score
    j = get_model_score(model,False)
    r2_train.append(j[0])
    r2_test.append(j[1])
    rmse_train.append(j[2])
    rmse_test.append(j[3])
-------
comparison_frame = pd.DataFrame({'Model':['Linear Regression','Decision Tree','Ridge Model','Tuned Decision Tree','Random Forest','Tuned Random Forest'], 
                                          'Train_r2': r2_train,'Test_r2': r2_test,
                                          'Train_RMSE':rmse_train,'Test_RMSE':rmse_test}) 
comparison_frame

4 Kasım 2022 Cuma

Three SQL Game Web Sites

1. SQL Murder Mystery: Using SQL knowledge to find a killer in SQL city. https://mystery.knightlab.com 

2. SQL Police Department: You are joining SQLPD, and solving crimes while learning SQL. https://sqlpd.com

3. Schemaverse: A space-based strategy game implemented entirely within a PostgreSQL database. You will be commanding your fleet and competing against other players using raw SQL commands. https://schemaverse.com

2 Kasım 2022 Çarşamba

How XGBoost works

A nice diagram to understand how XGBoost works: