Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Preparing a Dataset for Machine Learning | Section
Feature Engineering with PySpark
Sección 1. Capítulo 9
single

single

Challenge: Preparing a Dataset for Machine Learning

Desliza para mostrar el menú

Tarea

Desliza para comenzar a programar

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.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 9
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

some-alt