DS Analogue of Card Deck: Feature Bundle Generator

Intermediate Data Science Engineering
Created by Pavel · 12.03.2026 at 06:08 UTC · 1 completed

A domain-specific analogue to card dealing for Data Scientists:

Instead of suits and ranks, we have a feature bank and we draw feature bundles for model experiments.

Use case:
- Given candidate features, sample k distinct features for one experiment run.
- Track runs as objects (Feature, ExperimentRun, FeaturePool) for reproducibility.

This mirrors the card example:
- deck -> feature pool
- card -> feature
- deal(n) -> sample_features(n)

It is simple but practical for quick baseline model comparisons and ablation studies.

University approvals: 0
Related cards
Related Playing Cards with OOP: Card and Deck · Python OOP Inheritance
Tasks
Question 1

Which mapping is the best DS analogue of card dealing without replacement?

Hint

Think unique combinations and design-space exploration.

Question 2

Code task: implement FeaturePool.sample_features(k).

import random

class FeaturePool:
    def __init__(self, features):
        self.features = list(features)

    def sample_features(self, k):
        # TODO
        pass

Return k unique names. Raise ValueError for invalid k.

Hint

Same pattern as Deck.deal.

Starter code is prefilled; replace TODO blocks with your solution.
2 test cases will be used for grading
Run checks runtime behavior only. Final correctness is evaluated when you submit.
Question 3

Why is object modeling useful for experiment configurations?

Hint

Think traceability: feature set, seed, score, timestamp.

Question 4

Code task: implement count_feature_combinations(n_features, k) using itertools.combinations.

It should return n choose k.

Hint

Count the generated tuples from combinations(range(n_features), k).

Starter code is prefilled; replace TODO blocks with your solution.
2 test cases will be used for grading
Run checks runtime behavior only. Final correctness is evaluated when you submit.
Card Info
  • Topic: Data Science Engineering
  • Difficulty: Intermediate
  • Completed: 1 users
Creator
Pavel
Pavel