Section 1. Chapitre 9
single
Challenge: Preparing a Dataset for Machine Learning
Glissez pour afficher le menu
Tâche
Glissez pour commencer à coder
You are given a flights dataset as a list of rows. Load it into a DataFrame using createDataFrame and prepare it for a binary classification task – predicting whether a flight is delayed (Delay == 1). Complete all steps and store results in the specified variables:
- Fill nulls in
DelayandLengthwith0; - Add a binary label column
LABEL–1ifDelay == 1, otherwise0; - Add
IS_WEEKEND–1ifDayOfWeek >= 6, otherwise0; - Apply
StringIndexertoAirline→AIRLINE_IDX; - Assemble
Length,Time,IS_WEEKEND, andAIRLINE_IDXinto a vector columnFEATURES; - Store the final DataFrame in
ml_dfand count its rows inml_count.
Print ml_count and show all rows of LABEL, AIRLINE_IDX, FEATURES.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 9
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion