Секція 1. Розділ 9
single
Challenge: Customer Segmentation
Свайпніть щоб показати меню
Завдання
Проведіть, щоб почати кодувати
You are given a flights dataset as a list of rows. Load it into a DataFrame using createDataFrame and segment airlines by their operational profile using K-Means clustering. Complete all steps and store results in the specified variables:
- Fill nulls in
DelayandLengthwith0; - Aggregate by
Airlineto compute:AVG_DELAY– averageDelay;AVG_LENGTH– averageLength;TOTAL_FLIGHTS– count of flights. Store the result inairline_df;
- Build a Pipeline with
VectorAssembleron["AVG_DELAY", "AVG_LENGTH", "TOTAL_FLIGHTS"]andKMeanswithk=3,seed=42,maxIter=5– no scaling needed; - Fit the pipeline and transform
airline_df– store the result inclustered_df; - Store the number of rows per cluster as a list of tuples
[(cluster_id, count), ...]sorted bycluster_idincluster_counts.
Print cluster_counts and show clustered_df sorted by prediction.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 9
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат