セクション 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
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください