r/learnmachinelearning • • 2d ago

Help Struggling to validate my Knowledge Graph dataset & negative sampling strategy for Drug–Food Interaction prediction

2 Upvotes

Hi everyone,

I'm working on a Drug–Food Interaction (DFI) prediction project using a Knowledge Graph + R-GCN with Cross-Attention. Since this is my first time working with graph-based link prediction (instead of standard tabular feature-label datasets), I'm still unsure whether my dataset setup and negative sampling strategy are methodologically sound.

My current setup:

Knowledge Graph: Built from DrugBank (drug entities and their biomedical relations) and FooDB (food entities and their constituent chemical compounds).

Ground Truth (Positive Labels): Known drug–food interaction pairs from DDID (positive-only pairs—there are no explicit "non-interacting" labels).

Model: R-GCN encoder on the KG + Cross-Attention between drug and food representations for binary link prediction.

What I'm unsure about:

  1. Dataset construction & leakage: Aside from ensuring no validation/test DDID pairs (or overlapping DrugBank food-interaction edges) leak into the KG before message passing, are there other subtle data leakage or entity-alignment pitfalls when mapping DDID onto a DrugBank + FooDB graph?
  2. Negative sampling under Open-World Assumption: Right now I'm considering 1:1 random negative sampling (type-constrained to drug–food pairs not in DDID). Since an unobserved pair doesn't necessarily mean "safe / no interaction," how risky is random negative sampling in practice for this kind of biomedical KG?
  3. Better alternatives: Would it make sense to compare random negative sampling against hard negative sampling, degree-based sampling, or Positive-Unlabeled (PU) learning? Or is 1:1 filtered random sampling already acceptable as a baseline if evaluated across multiple random seeds?

r/learnmachinelearning • • 2d ago

Interactive Machine Learning Course

Thumbnail reddit.com
0 Upvotes

r/learnmachinelearning • • 2d ago

Trained an image classifier in Module 8 of #mlzoomcamp.

1 Upvotes

Fixed the seed and evaluation transform
Recorded baseline loss and accuracy
Compared training with data augmentation

My repo: https://github.com/huyyhoangtr-boop/ML_zoomcamp_homework/tree/main/Homework8


r/learnmachinelearning • • 2d ago

Discussion Knowledge Distillation

1 Upvotes

Knowledge Distillation: Can smaller AI models learn from larger ones?

I have been exploring Knowledge Distillation, an interesting technique in machine learning.

The basic idea is that a smaller model learns from a larger, more powerful model by learning from its predictions and outputs.

Instead of relying only on traditional learning signals.

why is this interesting?

- Reduced computational requirements.

- Faster inference.

- Lower memory usage.

- More efficient model deployment.

- Potentially retaining much of the teacher's performance.

I find this approach interesting because building better AI systems is not always about increasing models size . Sometimes, transferring knowledge into smaller models can be a more practical solution.

I am curious: Have you experimented with Knowledge Distillation? What approaches or frameworks have you used?


r/learnmachinelearning • • 2d ago

Seeking arXiv endorsement (cs.LG) — Undergraduate ML researcher

Thumbnail
reddit.com
1 Upvotes

r/learnmachinelearning • • 2d ago

Can anyone share Build a Reasoning Model (From Scratch) pdf

1 Upvotes

Build a Reasoning Model (From Scratch) book is very expensive in India (2x price). It would be helpful if anyone can share the pdf of the book.


r/learnmachinelearning • • 3d ago

K-means on 140k IPL deliveries, no labels: here's what it found

10 Upvotes

I've been revising ML by applying it to cricket ball-tracking data (pitch length, line, speed and so on), and I tried a simple experiment: drop all labels and see whether unsupervised clustering finds structure on its own.

What came out:

  • K = 4 groups that each mean something in cricket, such as short, good length and full.
  • One group was 74% left-handers, against about 27% for the dataset as a whole. The reason is that line is measured from the pitch, not from the batter, so the same delivery to a left-hander lands on the "other side." When I mirrored line for left-handers, that cluster disappeared.
  • The scorecard's own bowler-type labels turned out to be wrong in places, with right-armers tagged as left-arm seam.

I made a faceless, beginner-friendly walkthrough of it covering what clustering is, how K-means works, and doing it in a few lines of scikit-learn. Watch from the link! and like, share, subscribe.

▶ Lesson 01, linear regression with cricket: https://www.youtube.com/watch?v=NVM3Tp4SeQU
▶ Lesson 02, logistic regression: https://youtu.be/YWVC9VCIP18
💻 Code and notebook: https://github.com/kishan19/ds-with-cricket-basic-ML
📊 Data: Hawk-Eye ball tracking via https://github.com/alittlefitness/HawkeyeStats
Coming up in Part 2: all 140,233 IPL deliveries. How many types of delivery are there, and does K-means rediscover pace and spin on its own?


🐦 X: https://x.com/kishan_skb
💼 LinkedIn: https://www.linkedin.com/in/kishanbs/

r/learnmachinelearning • • 2d ago

I wrote Dense, Mixture-of-Experts (MoE), and Looped Transformers from scratch in PyTorch so you can compare how they work side-by-side

2 Upvotes

If you're learning how modern LLMs actually work under the hood beyond high-level libraries, I put together `Spell-Talker` a clean, from-scratch PyTorch repository implementing three architectures side-by-side:

  1. Dense Transformer (`41.8M` params): Standard GPT-style decoder with RMSNorm, SwiGLU, and weight tying.
  2. Mixture-of-Experts (`117.3M` total / `67.0M` active): Shows how Top-2 router gating, 4 parallel SwiGLU experts, and auxiliary load-balancing loss work in code.
  3. Looped Transformer (`20.3M` params): Uses a single shared layer looped 8 times with truncated BPTT (`bptt_steps=8`) to trade extra compute for half the parameter footprint.

You can inspect the full model definitions, train your own on TinyStories, or download my pretrained checkpoints directly from Hugging Face (`BitGeek29`).

Repo: https://github.com/BitGeek29/spell-talker


r/learnmachinelearning • • 2d ago

Project Share: AI System for Ripeness Classification and Disease Detection in Agricultural Products Running Directly on the ESP32-S3

Thumbnail
github.com
1 Upvotes

Hello all Bro on Reddit and all the AI & Embedded Systems engineers out there.

I'm just getting my feet wet with AI training and embedded ML, and I'd love any advice on TFLite Micro optimization or dataset auto-labeling!

I have just completed and open-sourced the code for the KHKT (Vietnam Science and Engineering Fair), project an edge AI vision system for classifying agricultural products and detecting pests and diseases which runs independently on an ESP32-S3 without requiring a computer or an internet connection during operation.

Currently, the model focuses on agricultural products specific to Vietnam, and in the future, I plan to expand into the international market and standardize it into a general-purpose model for a wide variety of agricultural products worldwide.

How It Works: On-chip vision: The OV2640 camera captures images directly and runs the YOLOv8n model, with INT8 TFLite quantization (~3.3 MB), right on the ESP32-S3 (8 MB OPI PSRAM).

15-class recognition: Classifies the ripeness of mangoes, dragon fruit, durian, tomatoes, guava, and bananas, along with 4 common diseases (anthracnose, leaf spot, pink mold, and downy mildew).

Automatic sorting: Controls a servo to divert products at three corresponding angles: Unripe (45°), Ripe (90°), and Diseased (135°).

Would love any feedback on optimizing TFLite Micro op usage/memory on the ESP32-S3 or improving the auto-labeling pipeline!

If this sparks any ideas for your own builds, toss a STAR into the repo to help light up the constellation and feel free to drop an issue or PR if you spot ways to push it further.


r/learnmachinelearning • • 2d ago

Walter's perfect speech, mathematically derived: Adversarial Prompting

Thumbnail
youtube.com
0 Upvotes

r/learnmachinelearning • • 2d ago

A 4-week plan for going from zero Python to a small GenAI project (20 sessions, free to copy)

0 Upvotes

I help run beginner AI/ML batches in Bengaluru. Beginners keep asking "where do I even start", so here's the 20-session plan we use. You can follow it on your own with free resources.

Week 1: Python basics

  1. Install Python, variables, data types. Write your first program.
  2. Operators, input/output, if-else. Build a calculator.
  3. for and while loops. Print multiplication tables.
  4. Lists, tuples, dicts, sets. Build a student records program.
  5. Functions and file handling. Save and load data from a file.

Week 2: Data and ML basics

6. NumPy arrays and math operations

7. Pandas: load a CSV, clean it, explore it

8. Matplotlib charts. Look for patterns in the data.

9. Features vs labels, train/test split

10. Supervised vs unsupervised learning. Match some sample problems to the right type.

Week 3: Your first models (scikit-learn)

11. Linear regression. Predict house prices.

12. Classification

13. Clustering. Group customers into segments.

14. Accuracy, precision, recall, and reading the errors

15. Mini project on a real dataset

Week 4: Generative AI

16. How LLMs work, in plain terms

17. Prompt structure and using AI responsibly

18. Build a simple assistant with an API or a no-code tool

19–20. Build a capstone project and present it What helps most: Code for an hour every session.

Watching videos without typing along feels like progress, but it isn't. Use Google Colab. No install problems, and it runs on any laptop. Finish one small project you can explain. That's worth more than five half-finished tutorials. To be honest, 4 weeks gets you a foundation, not a job. ML engineer roles need a lot more practice after this. Happy to answer questions about any week. E-kody


r/learnmachinelearning • • 2d ago

TIL Knowledge Distillation isn't just for shrinking AI models—researchers use past versions of an AI as a "teacher" to stop newer versions from forgetting what they already learned.

Post image
1 Upvotes

Most of us think of Knowledge Distillation (KD) strictly as a compression trick, shrinking a massive teacher model down into a fast, lightweight student model for edge devices.

However, at its core, KD is just teaching one model using another instead of training from scratch, regardless of model size. I recently wrote a breakdown of a clever AAAI paper (TrustAL) that flips the script on KD by using it to solve Example Forgetting in Active Learning.

The Problem:
In Active Learning, an AI model is trained in multiple rounds. This means training on a small batch of data, asking humans to label the most confusing edge cases, and retraining. The assumption is that every round makes the model strictly smarter. In reality, updating weights on new, complex edge cases often overwrites previously mastered patterns. It’s like learning to drive a manual car: you master clutch control on empty roads (Round 1), then stall out in heavy city traffic (Round 2) because you’re overwhelmed by new stimuli.

How TrustAL Fixes It:
Instead of just training on the new batch of human labels, TrustAL adds a "look-back" step:

  1. Score Past Versions: It evaluates saved checkpoints from earlier rounds using a consistency score to find the past model that held onto its correct predictions most reliably without flipping.
  2. Dual-Train: It uses that consistent past version as a "teacher" alongside the fresh human labels to train the newest model.

Why it matters:

  • Stops catastrophic/example forgetting: The past teacher anchors the model's foundational knowledge while it learns new patterns.
  • Better data selection: Because the model remembers what it already knows, it picks genuinely novel/confusing examples for humans to label next.
  • Noise resilience: Humans make labelling mistakes when tired; a steady past teacher acts as a buffer against noisy labels.

I put together a quick, beginner-friendly visual breakdown of how this loop works (using the manual driving analogy) if anyone wants to read the full piece: Why Smarter AI Models Still “Forget” — And How Looking Back Fixes It

Hope you love it. 🙂


r/learnmachinelearning • • 2d ago

Project uilt a 100% real-telemetry PyTorch Transformer (ctx768) + SmolLM2-135M pure-PyTorch LoRA + SQLite FTS5 RAG workbench that trains continuously on curated web streams – looking for testers & feedback!

Thumbnail
gallery
0 Upvotes

Hi everyone — I built an open-source local ML workbench (WebNet v2) and just pushed the full codebase + build log to GitHub. Looking for honest testing, architecture critiques, and feature suggestions!

GitHub: https://github.com/Rishisharma029/live-internet-neural-net

What it actually runs (CPU-friendly, zero simulated metrics)

  1. Continuous From-Scratch Transformer (InternetNetV2):

    - 96d · 4h · 10L · ctx768 (`1,117,344` params, Pre-RMSNorm, SwiGLU, NTK RoPE `base=100,000`, decoupled AdamW, Softmax Z-Loss `1e-4`, EMA shadow weights).

    - Feeds 24/7 on 8 curated sources(`arXiv`, `OpenAlex`, `Europe PMC`, `Wikipedia`, `StackOverflow`, `GitHub ML READMEs`, `Project Gutenberg`, `News RSS`) with SHA-256 + 5-word Jaccard deduplication.

    - Migrated seamlessly from `ctx96` → `ctx768` at step 22.9k without losing weights.

  2. Real-Time Mechanistic Observatory (`/ws`):

    - Live 23-column network graph across all 21 hidden layers (real OV circuit edges, autograd gradient norms, AdamW second-moment RMS).

    - Logit Lens (Emb → Block 1..10 → Final target probability, rank, entropy collapse).

    - 2D SVD Token Embeddings live projection and 40 attention head telemetry.

  3. 4 Applied Local Utilities:

    - Pure-PyTorch LoRA (SmolLM2-135M-Instruct + RAG) zero `peft` dependency, online training + cited RAG Q&A.

    - Permanent SQLite WAL + FTS5 Archive BM25 + TF-IDF hybrid search across 964+ crawled docs.

    - Cross-Entropy Anomaly Scorer: flags corrupted/gibberish lines (8.7–9.4 bpc anomalies vs 1.6–3.7 bpc clean prose).

    - Safe Local Code/Notes Indexer + Ghost Editor: Tab autocomplete over your local files.

Quantitative Check (step 23,455)

- Val Loss: `1.424` (best: `1.115`, 58.7%

accuracy, 18.3M tokens seen)
- Shuffled-Char Probe: real prose `1.138` loss vs shuffled chars `5.415` — confirming structure learning beyond letter frequencies.

 What I'd love feedback on
- Does `python server_v2.py` work cleanly across Linux/macOS/Windows?
- What architectural tweaks would make `InternetNetV2` learn longer contexts faster on CPU?
- What tools would you add on top of the FTS5 + LoRA pipeline?

r/learnmachinelearning • • 2d ago

अभी क्लर्क प्रेडिक्शन जितना चल रहा है मुझे सर का सारा चाहिए 10कम से कम

0 Upvotes

r/learnmachinelearning • • 2d ago

Project [Update] Follow-up: you can now study the free AI book from your own Claude chat

Post image
1 Upvotes

Original Post: https://www.reddit.com/r/learnmachinelearning/comments/1y1th63/i_wrote_a_free_interactive_book_that_goes_from/

A short follow-up for anyone who read the earlier posts about Zero to Frontier, the free interactive book on AI I've been writing.

The new part is Learn in Claude. You connect your own Claude to the book once, and then you can ask it anything about the material in your usual Claude chat. It searches the book, answers from it, and links to the exact section and heading it used, so you can jump straight to the full explanation, the math, and the code.

- It runs on your own Claude plan, any plan including Free. No API key needed.

- Setup takes a minute. Sign in on the site with Google, press Learn in Claude, add it in Claude, and approve.

- Every section has the button too. It opens Claude with a message asking for a summary of that page with links to its parts, which you can edit before sending.

- It is read only. Claude sees what any visitor sees (the text, code, problems, and interview questions), never your notes or account, and you can disconnect it from your account page.

The interview chapters from the last post are still there and free: Classical ML, ML System Design, and LLM System Design, with coding exercises that have hidden tests and interview questions you can open. A good way to use the two together is to ask Claude to walk you through a design question from the book, then open the problem on the site to write and test your code.

https://zerotofrontier.app

Reading and running code is still free. If you try Learn in Claude, I'd love to hear where its answers were wrong or its links went to the wrong place, and what you'd want it to do next.


r/learnmachinelearning • • 3d ago

Help Best AI and ML resources

30 Upvotes

So I am currently planning to learn AI and ML is there any free resources available other than youtube videos,can you share the resources link, my preferences are structured resources with basic to advanced and having good examples, videos are not necessary


r/learnmachinelearning • • 3d ago

Discussion CUDA

6 Upvotes

I have been learning more about GPU computing recently, and CUDA caught my attention.

I knew GPUs were important for deep learning, but i wanted to understand what actually allows frameworks like PyTorch to use their processing power.

This is CUDA comes in.

NVIDIA developed CUDA to let developers run parallel computations on GPUs. This is especially usefull for operations like matrix multiplication and neural network traning.

Something i find intersting is that when we write just a few lines of PyTorch code, there is a lot happening underneath to make those computations run efficiently.

I am corious about one thing:

For those who worked with CUDA, did you start with the CUDA C++ directly, or learn it through PyTorch first?


r/learnmachinelearning • • 4d ago Bravo

Project Neural Canvas , CNN Visualization

410 Upvotes

Neural Canvas , CNN Visualization

Neural Canvas can now recognize basic shapes like apples, moons, cars, and more using Google's Quick, Draw! dataset.

20 classes with 1,000 samples per class

2 convolutional layers with 16 and 32 filters

2 fully connected layers with 60 and 40 neurons

91% test accuracy

Trained using JAX on Google Colab

Neural Canvas can also visualize CNN feature maps in real time while drawing, showing how convolutional layers extract features from input images.

GitHub: https://github.com/MuhammadEssa2002/neural_canvas

Live demo: https://muhammadessa2002.github.io/neural_canvas/


r/learnmachinelearning • • 3d ago

Project 🚀 Project Showcase Day

2 Upvotes

Welcome to Project Showcase Day! This is a weekly thread where community members can share and discuss personal projects of any size or complexity.

Whether you've built a small script, a web application, a game, or anything in between, we encourage you to:

  • Share what you've created
  • Explain the technologies/concepts used
  • Discuss challenges you faced and how you overcame them
  • Ask for specific feedback or suggestions

Projects at all stages are welcome - from works in progress to completed builds. This is a supportive space to celebrate your work and learn from each other.

Share your creations in the comments below!


r/learnmachinelearning • • 3d ago

Learned basic CNNs and UNet. Now what?

12 Upvotes

I have been learning the basics of CNN and UNet, understood the codes of CNN and basic UNet. Built a brain tumor segmentation model with Ai. What will be the best thing for me to do next?


r/learnmachinelearning • • 3d ago

2022 CSE grad, stuck in non-IT support roles, and faked my way through an AI bootcamp. I’m broke and overwhelmed—can I realistically land an AI/ML job in 2027? (Need a brutal reality check)

Thumbnail reddit.com
1 Upvotes

r/learnmachinelearning • • 3d ago

2022 CSE grad, stuck in non-IT support roles, and faked my way through an AI bootcamp. I’m broke and overwhelmed—can I realistically land an AI/ML job in 2027? (Need a brutal reality check)

1 Upvotes

I need a brutally honest reality check from people actually working in the industry. I am at a crossroads, completely broke, and about to take another non-IT customer support job just to survive—while trying to figure out if I still have a shot at breaking into AI/ML in 2027.

My Background:

Education: B.E. in CSE (2022 grad).

Work Experience: ~8 months total in non-IT customer support/field roles (Teleperformance & a smaller firm between 2024–2025).

Upskilling: Currently finishing a Data Science/ML/AI course (Datamites). It covered basics up to CNNs, though nothing modern like RAG, LLMs, or Agentic AI.

My Honest Confession (Where I actually stand):

Right now, I am stuck in "tutorial/reading hell."

Python/Data: I understand functions (def), NumPy, and Pandas when I read them. I get basic feature engineering concepts, though I struggle to create new features from scratch.

ML & Deep Learning: I grasp the high-level concepts (backprop, weights, activation functions), and I can read existing code and understand what it’s doing. However, my ability to write code from a blank screen is practically zero. I wouldn't know which activation function or architecture to pick on my own.

Math: My stats are okay-ish, statistical tests are vague, and I’ve forgotten most of my calculus.

The Projects: For my course, I submitted 4 projects (Customer Transaction Prediction, Advanced House Price Prediction, NBA Shot Selection, and Rice Leaf Disease using CNN) and got B/C grades. The truth is, I just pulled the .ipynb files from GitHub and submitted them. I didn't build them myself. I still have one "client project" left for my internship phase.

My Dilemma:

I genuinely enjoy AI, and I want to learn it properly. But every time I look at job descriptions and interview difficulty, I get completely overwhelmed. Worse, I have zero money right now and am about to join another non-IT support job just to pay the bills.

What I need help with:

  1. The Immediate Choice: Should I take this non-IT support job to survive and study on the side, or is taking another support role going to permanently ruin my resume for tech?
  2. The 2027 Timeline: Starting from "can read code, can't write it," is landing an entry-level AI/ML or Data role in 2027 realistic? How long does it actually take to become job-ready?
  3. The Roadmap & Practice: What exact skills should I focus on (do I pivot to LLM/RAG engineering or stick to classical ML?), what free resources should I use, and how do I transition from reading code to writing it myself?
  4. The Math: How much calculus and stats do I actually need to relearn to pass interviews and do the job?

Don't sugarcoat it. Tell me what’s at stake, what I’m doing wrong, and how to fix it if I only have a few hours a day. Thanks in advance.


r/learnmachinelearning • • 3d ago

We built an open-source platform for the entire Data Science and AI workflow — running on your own machine

0 Upvotes

Hi everyone!

I want to share a project we've been working on at the University of Chile: DashAI.

The motivation behind it is relatively simple: AI tools are becoming increasingly powerful, but working with data and building AI applications often means juggling multiple platforms, paying for cloud services, sharing your data with external providers, or writing quite a bit of code.

We wanted to explore a different approach.

DashAI is an open-source, low-code platform that brings together traditional Machine Learning and Generative AI in one place.

Rather than focusing on just one particular model or AI technique, we're trying to cover much more of the actual workflow.

What can you do with DashAI?

1. Data exploration and Machine Learning

  • Upload and explore your own datasets.
  • Clean, transform and select features.
  • Train machine learning models for classification and regression.
  • Optimize hyperparameters.
  • Evaluate and interpret model predictions.

For example, you could upload a customer dataset, prepare the data, train a model to predict customer churn, and explore which features explain its predictions.

2. Generative AI

  • Work with locally hosted language models.
  • Upload your own documents.
  • Build RAG workflows to ask questions about your documents.
  • Experiment with generative AI without having to build everything from scratch.

3. Local-first architecture

This is one of the things we care most about.

DashAI has a web interface that runs in your browser, but its backend runs on your own computer or server.

This means you can use a familiar web interface while keeping your data and processing under your control. You don't need to upload your datasets or documents to our servers, and you can deploy it on infrastructure you control.

We believe this is particularly important for universities, public institutions, companies and anyone working with sensitive data.

Why are we building this?

DashAI is not a weekend project or an AI wrapper built around an API.

It's an academic and engineering project with around five years of development, involving researchers and software engineers, developed at the University of Chile, with an associated technology company and an emerging open-source community.

We're building it in Latin America because we believe that developing our own AI infrastructure and tools matters. We shouldn't have to depend entirely on a handful of platforms elsewhere in the world to experiment with, develop and deploy AI.

We're also actively working on expanding the platform, including more advanced capabilities for working with and fine-tuning language models.

We'd love your feedback!

We're still developing DashAI, and we'd genuinely appreciate feedback from the open-source community.

  • What features would make a platform like this useful to you?
  • Do you see value in having traditional ML and Generative AI workflows together?
  • What would you improve in our architecture or developer experience?
  • Would you consider deploying something like this on your own infrastructure?

Try it out:

Contributions, issues, suggestions and honest criticism are very welcome.

Thanks for taking a look!