Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Preparing a Dataset for Machine Learning | Section
Feature Engineering with PySpark
Osio 1. Luku 9
single

single

Challenge: Preparing a Dataset for Machine Learning

Pyyhkäise näyttääksesi valikon

Tehtävä

Pyyhkäise aloittaaksesi koodauksen

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:

  1. Fill nulls in Delay and Length with 0;
  2. Add a binary label column LABEL1 if Delay == 1, otherwise 0;
  3. Add IS_WEEKEND1 if DayOfWeek >= 6, otherwise 0;
  4. Apply StringIndexer to AirlineAIRLINE_IDX;
  5. Assemble Length, Time, IS_WEEKEND, and AIRLINE_IDX into a vector column FEATURES;
  6. Store the final DataFrame in ml_df and count its rows in ml_count.

Print ml_count and show all rows of LABEL, AIRLINE_IDX, FEATURES.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 9
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

some-alt