HackIndia Logo
HackathonsNewsSkillsGrowth
HackIndia LogoContact: +91 9910125804

General

  • Companies
  • Colleges
  • Board of Advisors
  • Brand Ambassadors
  • FAQ
  • Contact
  • Report a Bug

Hackathons

  • Upcoming Hackathons
  • Judges
  • Mentors
  • Partners
  • Participating Colleges
  • Testimonials

Resources

  • About Us
  • Branding
  • Latest News
  • Growth
  • Skills
  • Builders
  • Ecosystem
  • Forum
  • Ideas
  • Prompt Optimizer
  • Games

© 2026 HackIndia. All rights reserved.

Privacy PolicyTerms of ServiceCode of ConductSitemap

Build 2.139 · 05 Nov 2026, 10:27 UTC

    HackIndia
    HackathonsNewsInternshipsSkillsGrowthPro Perks
    ← Ship your first ML repo

    All the reading

    Machine Learning

    7 lessons, about 30 minutes. The check's questions come from these.

    Contents
    Framing the ML problem
    1. 1. ML in builder terms
    2. 2. Pick the right problem
    Preparing data and splits
    1. 3. Prepare features and labels
    2. 4. Split data and test honestly
    Picking models and reading code
    1. 5. Choose common model families
    2. 6. Read scikit-learn code
    Shipping the repo
    1. 7. Ship the ML repo

    Framing the ML problem

    1. ML in builder terms

    4 min

    In 30 seconds
    • Explain ML as learning a rule from examples, not magic.
    • Name the parts of a basic ML project repo.
    • Create a tiny scikit-learn starter file you can build on.
    Key point

    The core idea

    Machine learning is code that learns a pattern from examples, then uses that pattern on new inputs.

    In a project repo, your job is to make this learning process visible: data source, inputs, target, model, test result, and run steps.

    Builder translation

    Normal code follows rules you write. ML code finds a rule from data you give it.

    Example: for a UPI spend tracker, normal code can total expenses. ML could learn from past labelled spends and predict if a new transaction is food, travel, shopping, or bills.

    What a model is

    A model is a saved pattern. It is trained on examples with known answers, then tested on examples it has not seen.

    In scikit-learn, training usually means calling fit(). Predicting usually means calling predict().

    Example

    Tiny ML shape

    This is not your final repo. It shows the basic shape you will see again in this track: examples in, model trained, predictions out, score printed.

    from sklearn.tree import DecisionTreeClassifier
    
    # Inputs: hours studied, classes attended
    X = [
        [1, 3],
        [2, 4],
        [6, 8],
        [7, 9]
    ]
    
    # Labels: 0 = needs help, 1 = likely okay
    y = [0, 0, 1, 1]
    
    model = DecisionTreeClassifier(random_state=42)
    model.fit(X, y)
    
    new_student = [[3, 5]]
    prediction = model.predict(new_student)
    
    print("Prediction:", prediction[0])
    Common mistake

    2. Pick the right problem

    4 min

    In 30 seconds
    • Turn a vague ML idea into a clear prediction task.
    • Choose classification or regression before choosing a model.
    • Write a problem card your future repo can include.
    Key point

    Start with the output

    A good starter ML problem has a clear input and one target output. If you cannot write the target in one sentence, the repo will become confusing fast.

    Before you think about algorithms, decide what the model must predict: a category, a number, or something you should not model yet.

    Two starter shapes

    Most first scikit-learn projects fit one of two shapes. Classification predicts a category, like spam or not spam, pass or fail, high risk or low risk.

    Regression predicts a number, like house rent in rupees, delivery time in minutes, or marks from study hours. Both are valid. Pick the one that matches your target.

    Common mistake

    Avoid vague goals

    “Use ML for healthcare” is too broad. “Predict if a patient record is high diabetes risk from basic measurements” is clearer.

    Preparing data and splits

    3. Prepare features and labels

    4 min

    In 30 seconds
    • Separate inputs (features) from the answer you want to predict (label).
    • Clean basic tabular data so scikit-learn can read it.
    • Create X and y in code without leaking the answer into the features.
    Key point

    One split matters

    Your model learns from features and tries to predict one label. In scikit-learn code, features are usually named X and the label is usually named y.

    X must not contain the answer column. If it does, your model may look perfect in college demo day and fail on real data.

    Features and label

    A feature is an input column. Example: hours_studied, attendance_percent, past_score. A label is the target column. Example: pass_fail.

    For a builder project, write this clearly in your README later: “I used these columns as features, and this column as the label.”

    Your to-do

    Prepare the table

    Picking models and reading code

    5. Choose common model families

    4 min

    In 30 seconds
    • Pick a simple model family based on your label and data shape.
    • Use baselines before trying bigger models.
    • Record your model choice so your repo looks honest and readable.
    Key point

    One idea

    Choose the simplest model that can answer your problem well enough. Your first ML repo is judged more on clear choices and honest testing than on a fancy algorithm.

    Model families

    A model family is a type of method, not one exact model. In scikit-learn, examples are LinearRegression, LogisticRegression, DecisionTreeClassifier, RandomForestClassifier, and KNeighborsClassifier.

    Your choice starts with the label. If the label is a number, it is usually regression. If the label is a category like pass/fail, spam/not spam, or high/low, it is classification.

    Your to-do

    Pick by task

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    Shipping the repo

    7. Ship the ML repo

    5 min

    In 30 seconds
    • Turn your ML notebook into a public repo that someone else can run.
    • Include dataset source, split, model, metric, and exact run steps.
    • Submit a HackIndia project link that proves you trained and evaluated a model.
    Key point

    Proof beats claims

    Your repo is your proof. A recruiter or hackathon reviewer should open it and see what data you used, how you split it, what model you trained, and what result you got.

    Do not just upload a notebook called final.ipynb. Ship a small project that runs from clean steps.

    What your repo needs

    Keep it boring and clear. A simple scikit-learn model with honest evaluation is better than a messy deep learning repo that nobody can run.

    Your repo must answer five questions: Where is the dataset from? What is the target? How did you split train and test? Which model did you choose? What metric did it score on test data?

    Your to-do

    Use this structure

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    10 questions, 7 to pass.

    Sign in to take the test

    Do not overclaim

    A model is not correct because it prints an answer. It is useful only if you test it honestly on data it did not train on.

    Later lessons cover the train/test split and evaluation. For now, remember this rule: no test result, no ML project claim.

    Your to-do

    Repo parts

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Tip

    Use AI carefully

    You can ask ChatGPT, Gemini, or Claude to explain an ML idea or draft a README. Do not paste code blindly into your repo.

    Check that the answer names the dataset source, features, label, model, split, metric, and run command. If any part is missing, your repo will feel unfinished.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Also avoid goals where the answer needs private data, live scraping, or expert judgement you cannot verify. For your first repo, choose a dataset with a known target column.

    Your to-do

    Check the fit

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Tip

    Use AI safely

    You can ask ChatGPT, Gemini, or Claude to turn your idea into ML problem statements. Do not accept the first answer.

    Check three things yourself: is there a real dataset, is the target column present, and would the inputs be available before the prediction is made?

    Example

    Problem card example

    Add a small problem card to your repo notes now. Later, it can become part of your README.

    This example is for a classification project using a public tabular dataset.

    Project: Iris flower species classifier
    Dataset source: scikit-learn built-in Iris dataset
    Rows: Iris flower samples
    Inputs: sepal length, sepal width, petal length, petal width
    Target: species
    Problem type: classification
    Prediction: Given four flower measurements, predict the iris species
    Why this fits: target is known, dataset source is clear, task is small enough for a first repo
    Example

    Bad to better

    A small rewrite can turn a hackathon idea into a trainable ML task.

    Notice how the better version says what the rows, inputs, and target are.

    Bad: Predict student success using AI
    
    Better: Predict whether a student will pass or fail a course
    Rows: Past student records
    Inputs: attendance percentage, internal marks, assignment submission count
    Target: pass_or_fail
    Problem type: classification
    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Common mistake

    Avoid label leakage

    Label leakage means the features include information you would not have when making a real prediction.

    Example: predicting loan default using a column called final_recovery_amount is leakage, because that value is only known after the loan goes bad.

    Example

    Create X and y

    This example uses a small student dataset. It predicts pass_fail from study and attendance columns.

    Keep the target out of X. Drop ID-like columns unless they contain real signal you can explain.

    import pandas as pd
    
    # Load data
    df = pd.read_csv("data/students.csv")
    
    # Quick check
    print(df.head())
    print(df.isna().sum())
    
    # Simple cleanup
    # Fill missing numeric values with the column median
    df["hours_studied"] = df["hours_studied"].fillna(df["hours_studied"].median())
    df["attendance_percent"] = df["attendance_percent"].fillna(df["attendance_percent"].median())
    
    # Convert a text category into numbers
    # yes -> 1, no -> 0
    df["has_internet"] = df["has_internet"].map({"yes": 1, "no": 0})
    
    # Choose label
    y = df["pass_fail"]
    
    # Choose features
    X = df.drop(columns=["pass_fail", "student_id", "final_marks"])
    
    print("Feature columns:", list(X.columns))
    print("Label column: pass_fail")
    print("X shape:", X.shape)
    print("y shape:", y.shape)
    Tip

    Use AI carefully

    You can ask ChatGPT or Gemini: “Given these columns, which should be features and which should be the label for predicting pass_fail?” Paste only column names, not private student data.

    Check the answer yourself. Remove columns that reveal the result, IDs, names, phone numbers, emails, and anything collected after the prediction moment.

    Write choices down

    Good ML repos explain boring choices. That is what makes them internship-ready.

    Add a short note in your notebook or README draft: dataset source, label column, feature columns, removed columns, and missing-value handling.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    4. Split data and test honestly

    4 min

    In 30 seconds
    • Split data so your model is tested on rows it has not seen.
    • Avoid leakage by fitting preprocessing only on training data.
    • Report a simple, honest test score in your ML repo.
    Key point

    One honest rule

    Your test set is for the final check. The model must not learn from it in any way before evaluation.

    If your score is only good because the model saw the answers, your repo will look weak in review.

    Why split data

    When you train a model, it can memorise patterns from the data. A train/test split checks if it can work on new rows.

    Think of it like exam prep. Practice questions are training data. The exam paper is test data. You should not peek at the exam before studying.

    Your to-do

    Basic split flow

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Example

    scikit-learn split

    Use train_test_split for most starter projects. Keep random_state fixed so someone else can reproduce your result from the repo.

    For classification, stratify keeps class balance similar in train and test. This helps when labels are uneven, like pass/fail, fraud/not fraud, or churn/stay.

    from sklearn.model_selection import train_test_split
    from sklearn.metrics import accuracy_score
    from sklearn.linear_model import LogisticRegression
    
    X = df[["study_hours", "attendance", "past_score"]]
    y = df["passed"]
    
    X_train, X_test, y_train, y_test = train_test_split(
        X,
        y,
        test_size=0.2,
        random_state=42,
        stratify=y
    )
    
    model = LogisticRegression(max_iter=1000)
    model.fit(X_train, y_train)
    
    predictions = model.predict(X_test)
    score = accuracy_score(y_test, predictions)
    
    print("Test accuracy:", round(score, 3))
    Common mistake

    Avoid data leakage

    Leakage means information from the test set enters training. It makes scores look better than they really are.

    Common leakage: scaling the full dataset before splitting, filling missing values using the full dataset average, or creating features using the label.

    Example

    Safer preprocessing

    If you scale or fill values, fit the preprocessing on training data only. The simplest way is a scikit-learn Pipeline.

    The pipeline learns the scaler from X_train, then applies the same scaler to X_test during prediction.

    from sklearn.pipeline import Pipeline
    from sklearn.preprocessing import StandardScaler
    from sklearn.linear_model import LogisticRegression
    from sklearn.metrics import accuracy_score
    
    pipeline = Pipeline([
        ("scaler", StandardScaler()),
        ("model", LogisticRegression(max_iter=1000))
    ])
    
    pipeline.fit(X_train, y_train)
    predictions = pipeline.predict(X_test)
    
    print("Test accuracy:", round(accuracy_score(y_test, predictions), 3))
    Tip

    What to report

    In your README, write the split, metric, and result. Do not only show the best number from many tries.

    Example: Dataset split: 80 percent train, 20 percent test, random_state=42. Metric: accuracy. Test accuracy: 0.83.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    0 of 5 done

    Common mistake

    Common mistake

    Do not start with the most complex model because it sounds better. If your train score is high and test score is poor, the model may be memorising patterns instead of learning useful ones.

    Also do not compare models using different train/test splits. Keep the same split so the comparison is fair.

    Tip

    Good default path

    For an internship-ready beginner repo, train one baseline model first. Then train one slightly stronger model only if you can explain why.

    Write the reason in your README. A reviewer should know why you picked it without reading your mind.

    Example

    README model note

    This is enough for many small HackIndia projects. It says the task, the models, and the reason.

    Model choice
    
    Task: Classification. The label is whether a student is likely to pass.
    
    Baseline: LogisticRegression, because it is a simple classification model and easy to compare.
    
    Second model: RandomForestClassifier, because the dataset is tabular and may have non-linear patterns.
    
    Final model used: RandomForestClassifier, because it gave better test accuracy on the same train/test split.
    Example

    Try two models

    Use this only after your features, labels, and train/test split are ready. The important part is that both models use the same split.

    from sklearn.linear_model import LogisticRegression
    from sklearn.ensemble import RandomForestClassifier
    from sklearn.metrics import accuracy_score
    
    models = {
        "logistic_regression": LogisticRegression(max_iter=1000),
        "random_forest": RandomForestClassifier(random_state=42)
    }
    
    for name, model in models.items():
        model.fit(X_train, y_train)
        predictions = model.predict(X_test)
        score = accuracy_score(y_test, predictions)
        print(name, score)
    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    6. Read scikit-learn code

    5 min

    In 30 seconds
    • Trace a scikit-learn script from data loading to evaluation.
    • Know what fit, predict, score, Pipeline, and train_test_split are doing.
    • Read an ML repo and check if its result is honest enough to trust.
    Key point

    One mental model

    Most scikit-learn projects follow one path: load data, split data, prepare features, create a model, fit on train, predict on test, evaluate on test.

    When you read code, do not start with the model name. First find where the data comes from, where the split happens, and what metric is printed.

    Words you will see

    fit means the model learns from data. predict means it uses what it learned to make outputs for new rows. score is a shortcut metric, but you should still check what metric it uses.

    For classification, you often see accuracy_score, precision_score, recall_score, f1_score, or classification_report. For regression, you may see mean_absolute_error, mean_squared_error, or r2_score.

    Example

    Read this script

    This is a small, normal scikit-learn script. Read it top to bottom. The comments show the purpose of each block.

    Your repo does not need fancy code. It needs code that someone else can run and understand.

    import pandas as pd
    from sklearn.model_selection import train_test_split
    from sklearn.pipeline import Pipeline
    from sklearn.preprocessing import StandardScaler
    from sklearn.linear_model import LogisticRegression
    from sklearn.metrics import accuracy_score, classification_report
    
    # 1. Load dataset
    # Example: CSV has columns: hours_studied, attendance, past_score, passed
    df = pd.read_csv("data/student_pass.csv")
    
    # 2. Separate features and label
    X = df[["hours_studied", "attendance", "past_score"]]
    y = df["passed"]
    
    # 3. Split before training
    X_train, X_test, y_train, y_test = train_test_split(
        X, y, test_size=0.2, random_state=42, stratify=y
    )
    
    # 4. Build preprocessing + model together
    model = Pipeline([
        ("scaler", StandardScaler()),
        ("classifier", LogisticRegression(max_iter=1000))
    ])
    
    # 5. Learn only from training data
    model.fit(X_train, y_train)
    
    # 6. Test on unseen data
    y_pred = model.predict(X_test)
    
    # 7. Print evaluation
    print("Accuracy:", accuracy_score(y_test, y_pred))
    print(classification_report(y_test, y_pred))
    Your to-do

    Trace any repo

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Tip

    Use AI as reviewer

    You can paste a short training script into ChatGPT, Gemini, or Claude and ask: “Trace this scikit-learn code. Tell me where data is loaded, where split happens, what model is used, and whether evaluation is on test data.”

    Check the answer yourself. AI can miss leakage, wrong labels, or a metric that does not match the problem type.

    Common mistake

    Watch for leakage

    A common bug is preparing data before the split in a way that learns from the full dataset. For example, fitting a scaler on all rows before train_test_split can leak test information.

    A Pipeline helps because the scaler is fitted only on the training data when you call model.fit(X_train, y_train). This keeps your test result more honest.

    # Risky pattern
    scaler = StandardScaler()
    X_scaled = scaler.fit_transform(X)  # uses all rows, including future test rows
    X_train, X_test, y_train, y_test = train_test_split(X_scaled, y, test_size=0.2)
    
    # Better pattern
    model = Pipeline([
        ("scaler", StandardScaler()),
        ("classifier", LogisticRegression(max_iter=1000))
    ])
    model.fit(X_train, y_train)

    What to trust

    Trust code more when it has a clear dataset source, a fixed random_state, a visible train/test split, and metrics printed from y_test and y_pred.

    Be careful with repos that only print training accuracy. High training score can still fail on new data, like a college attendance model that only memorised one batch.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    0 of 5 done

    Example

    README starter

    Use this as a plain starting point. Replace the example text with your project details.

    If you use AI to draft the README, check every command, file name, metric value, and dataset link before committing it.

    # Student Placement Predictor
    
    ## Problem
    Predict whether a student gets placed using tabular student data.
    
    ## Dataset
    Source: <paste dataset link or official source here>
    Target column: placed
    Rows used: <number>
    
    ## Train/test split
    Split: 80% train, 20% test
    Random state: 42
    Test data was not used for training.
    
    ## Model
    scikit-learn LogisticRegression
    Reason: simple baseline for a binary classification problem.
    
    ## Result
    Metric: accuracy
    Test accuracy: 0.82
    
    ## How to run
    1. Clone this repo
    2. Install dependencies:
       pip install -r requirements.txt
    3. Train and evaluate:
       python train.py
    Example

    Small train file

    This is enough for a starter repo if your CSV is already cleaned. Keep names readable.

    Do not copy this blindly. Change the file name, target column, model, and metric for your own project.

    import pandas as pd
    from sklearn.model_selection import train_test_split
    from sklearn.linear_model import LogisticRegression
    from sklearn.metrics import accuracy_score
    
    DATA_PATH = "data.csv"
    TARGET = "placed"
    
     df = pd.read_csv(DATA_PATH)
    X = df.drop(columns=[TARGET])
    y = df[TARGET]
    
    X_train, X_test, y_train, y_test = train_test_split(
        X, y, test_size=0.2, random_state=42
    )
    
    model = LogisticRegression(max_iter=1000)
    model.fit(X_train, y_train)
    
    preds = model.predict(X_test)
    score = accuracy_score(y_test, preds)
    
    print(f"Test accuracy: {score:.3f}")
    Common mistake

    Do not hide data

    A common mistake is saying “dataset from Kaggle” without a link, file name, or target column. That makes your work hard to trust.

    If the dataset is too large to commit, do not upload a random sample without saying so. Put the source link and explain where to place the file before running.

    Tip

    Commit like a builder

    Make small commits with useful messages: add dataset notes, add training script, add evaluation result. This shows how you worked.

    Before submission, open your GitHub repo in an incognito window. Check that a stranger can read it without your local files.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done