बेसलाइन मॉडल

Python में Kaggle प्रतियोगिता जीतना

Yauhen Babakhin

Kaggle Grandmaster

मॉडलिंग स्टेज

 

मॉडलिंग स्टेज के घटक

Python में Kaggle प्रतियोगिता जीतना

मॉडलिंग स्टेज

 

मॉडलिंग स्टेज में बेसलाइन मॉडल

Python में Kaggle प्रतियोगिता जीतना

न्यूयॉर्क सिटी टैक्सी वैलिडेशन

# Read data
taxi_train = pd.read_csv('taxi_train.csv')
taxi_test = pd.read_csv('taxi_test.csv')
from sklearn.model_selection import train_test_split

# Create local validation
validation_train, validation_test = train_test_split(taxi_train,
                                                     test_size=0.3,
                                                     random_state=123)
Python में Kaggle प्रतियोगिता जीतना

बेसलाइन मॉडल I

import numpy as np
# Assign the mean fare amount to all the test observations
taxi_test['fare_amount'] = np.mean(taxi_train.fare_amount)

# Write predictions to the file taxi_test[['id','fare_amount']].to_csv('mean_sub.csv', index=False)
वैलिडेशन RMSE पब्लिक LB RMSE पब्लिक LB पोज़ीशन
9.986 9.409 1449 / 1500
Python में Kaggle प्रतियोगिता जीतना

बेसलाइन मॉडल II

# Calculate the mean fare amount by group
naive_prediction_groups = taxi_train.groupby('passenger_count').fare_amount.mean()
# Make predictions on the test set
taxi_test['fare_amount'] = taxi_test.passenger_count.map(naive_prediction_groups)

# Write predictions to the file taxi_test[['id','fare_amount']].to_csv('mean_group_sub.csv', index=False)
वैलिडेशन RMSE पब्लिक LB RMSE पब्लिक LB पोज़ीशन
9.978 9.407 1411 / 1500
Python में Kaggle प्रतियोगिता जीतना

बेसलाइन मॉडल III

# Select only numeric features
features = ['pickup_longitude', 'pickup_latitude',
            'dropoff_longitude', 'dropoff_latitude', 'passenger_count']
from sklearn.ensemble import GradientBoostingRegressor

# Train a Gradient Boosting model
gb = GradientBoostingRegressor()
gb.fit(taxi_train[features], taxi_train.fare_amount)

# Make predictions on the test data taxi_test['fare_amount'] = gb.predict(taxi_test[features])
Python में Kaggle प्रतियोगिता जीतना

बेसलाइन मॉडल III

# Write predictions to the file
taxi_test[['id','fare_amount']].to_csv('gb_sub.csv', index=False)
वैलिडेशन RMSE पब्लिक LB RMSE पब्लिक LB पोज़ीशन
5.996 4.595 1109 / 1500
Python में Kaggle प्रतियोगिता जीतना

इंटरमीडिएट परिणाम

 

मॉडल वैलिडेशन RMSE पब्लिक LB RMSE
सिंपल मीन 9.986 9.409
ग्रुप मीन 9.978 9.407
ग्रेडिएंट बूस्टिंग 5.996 4.595
Python में Kaggle प्रतियोगिता जीतना

पब्लिक लीडरबोर्ड के साथ सहसंबंध

 

मॉडल वैलिडेशन RMSE पब्लिक LB RMSE
मॉडल A 3.500 3.800
मॉडल B 3.300 4.100
मॉडल C 3.200 3.900

 

मॉडल वैलिडेशन RMSE पब्लिक LB RMSE
मॉडल A 3.400 3.900
मॉडल B 3.100 3.400
मॉडल C 2.900 3.300
Python में Kaggle प्रतियोगिता जीतना

अभ्यास करते हैं!

Python में Kaggle प्रतियोगिता जीतना

Preparing Video For Download...