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

single

Challenge: Preparing a Dataset for Machine Learning

Veeg om het menu te tonen

Taak

Veeg om te beginnen met coderen

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 9
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt