Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Apply Undersampling | Sampling Techniques for Large Data
Large Data Handling
セクション 2.  5
single

single

Challenge: Apply Undersampling

メニューを表示するにはスワイプしてください

In many real-world datasets, you often encounter a class imbalance problem—where one class (the majority) vastly outnumbers the other (the minority). This imbalance can bias models towards predicting the majority class, reducing predictive accuracy for the minority class. One common solution is undersampling, where you randomly reduce the number of samples in the majority class to match the count of the minority class. This challenge will give you hands-on practice with this technique. You will receive a DataFrame containing a categorical target column with two classes. Your goal is to return a new DataFrame where both classes are present in equal numbers, achieved by randomly undersampling the majority class.

タスク

スワイプしてコーディングを開始

Given a DataFrame containing a categorical target column with two classes, return a new DataFrame where both classes have the same number of samples by randomly undersampling the majority class.

  • Determine which class is the minority and which is the majority by counting the number of samples for each class.
  • Randomly select samples from the majority class so that its count matches the minority class.
  • Concatenate the randomly selected majority samples with all minority samples.
  • Shuffle the resulting DataFrame and reset the index.

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 2.  5
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt