Sektion 1. Kapitel 5
single
Challenge: Predicting Flight Delays
Stryg for at vise menuen
Opgave
Swipe to start coding
You are given a flights dataset as a list of rows. Load it into a DataFrame using createDataFrame and train a binary classification model to predict whether a flight is delayed (Delay == 1). Complete all steps and store results in the specified variables:
- Fill nulls in
DelayandLengthwith0; - Add a
LABELcolumn –1.0ifDelay == 1, otherwise0.0; - Add
IS_WEEKEND–1ifDayOfWeek >= 6, otherwise0; - Split into train (80%) and test (20%) with
seed=42; - Build a Pipeline with
StringIndexeronAirline,VectorAssembleron["Length", "Time", "IS_WEEKEND", "AIRLINE_IDX"], andRandomForestClassifierwithnumTrees=10,maxDepth=3,seed=42; - Fit the pipeline and generate predictions on the test set – store in
predictions; - Compute AUC-ROC – store in
auc_roc(rounded to 4 decimal places); - Compute accuracy – store in
accuracy(rounded to 4 decimal places).
Print both metrics.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 5
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat