Секція 1. Розділ 9
single
Challenge: Preparing a Dataset for Machine Learning
Свайпніть щоб показати меню
Завдання
Проведіть, щоб почати кодувати
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 9
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат