Last checked
Make a free Kaggle account, join the Titanic starter competition, open a notebook from its Code tab, train a small random forest on train.csv, write a submission.csv with PassengerId and Survived and press Submit. Then improve one thing at a time and keep notes.
McTaba runs coding and data bootcamps in Kenya. This guide is written to be useful whether or not you ever join one.
Kaggle is a website where people share datasets, run code in a browser notebook and enter prediction contests. You need only a laptop and internet. Our own labs run on Google Colab and Kaggle too. This tutorial is a project on our data science career map.
Most beginners enter the starter competition called Titanic - Machine Learning from Disaster (checked on 3 November 2026). You get a file of passengers with a known outcome, and a second file where the outcome is hidden. You predict the hidden column and upload your guesses.
The data is old and not Kenyan, but that is the point. Thousands of walkthroughs exist, the rules are simple and a wrong answer costs you nothing. Once you know the routine, move to local data, such as the sets in our list of Kenyan open datasets.
| Stage | What you do |
|---|---|
| 1. Join | Create an account, open the competition, accept the rules |
| 2. Notebook | Start a notebook from the Code tab |
| 3. Baseline | Clean five columns, train one model |
| 4. Submit | Write submission.csv and press Submit |
| 5. Improve | Change one thing, score again, note the result |
Our Data Science to AI Engineering programme runs its labs on Google Colab and Kaggle, so this routine carries straight over.
Open the competition, click Code, then New Notebook. Kaggle attaches the competition files for you. Check the path printed on the Data panel, since it is usually under /kaggle/input/.
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score
D = "/kaggle/input/titanic/"
train = pd.read_csv(D + "train.csv")
test = pd.read_csv(D + "test.csv")
def prepare(df):
return pd.DataFrame({
"Pclass": df["Pclass"],
"female": (df["Sex"] == "female").astype(int),
"Age": df["Age"].fillna(30),
"Fare": df["Fare"].fillna(14),
"family": df["SibSp"] + df["Parch"],
})
X, y = prepare(train), train["Survived"]
model = RandomForestClassifier(
n_estimators=200, max_depth=5, random_state=0)
print(cross_val_score(model, X, y, cv=5).mean())
This keeps five simple columns, fills blank ages and fares with a plain number, and scores the model with five-fold cross-validation: the training file is split five ways, and each part takes a turn as the test. That score is your honest estimate before you submit.
If you have not used pandas before, read the pandas tutorial on a shop's sales first. The filling of blanks above is the same idea.
Get weekly developer tips
Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.
No spam. Unsubscribe anytime.
model.fit(X, y)
sub = pd.DataFrame({
"PassengerId": test["PassengerId"],
"Survived": model.predict(prepare(test)),
})
sub.to_csv("submission.csv", index=False)
Check the competition's Data tab for the exact columns it wants. For Titanic that is passenger id and survived. In the notebook, use Save Version, wait for it to finish, then submit the output file from the notebook's Output section or the competition's Submit button. Your score appears on the leaderboard in a short time.
Do not worry about your rank on a first try. The aim is a complete loop: data in, model, file out, score back.
Next, try a project where the metric is money, as in mobile money fraud detection. When a model works, learn to ship it by deploying it as an API with FastAPI. For the bigger picture of what to build, see data science portfolio projects.
If you want mentors, deadlines and a capstone, see the Data Science to AI Engineering programme: 5 months full time or 8 months part time, KES 140,000, starting 11 January 2027.
KES 140,000
Data Science to AI Engineering: 5 months full time or 8 months part time, hybrid in Nairobi. Fraud, credit and M-Pesa data from Week 1, and every model deployed. Starts 11 January 2027.
See the Data Science programme