r/learnmachinelearning • • 10h ago

Same DistilBERT predictions on SST-2: F1 = 0.914 in sklearn, torchmetrics and torcheval, 0.675 in Keras. I built a tool that finds out why, and proves it

Post image
1 Upvotes

GitHub: https://github.com/DadCoder001/metric-diff (pip install metric-diff)

Update on metric-diff, which I posted here last week: version 0.2 adds multilabel, MCC, kappa, log loss and calibration error (ECE), and it's now been tested on real public models.

If you're learning ML, this one bites quietly: the number you compare against a tutorial or a paper depends on the library's defaults, not just your model. metric-diff computes a metric in every installed library (scikit-learn, torchmetrics, torcheval, Keras, Hugging Face evaluate, MONAI, sacrebleu, nltk, rouge-score, trec_eval, uncertainty-calibration). When they disagree, it re-runs all of them with one setting aligned, and only calls a cause confirmed if they then agree.

What it found on public models and datasets:

  • DistilBERT, SST-2: Keras F1Score() gives 0.675 vs 0.914 elsewhere, because it has no threshold by default (the image above).
  • SegFormer, ADE20K: Dice is 0.284 (pixels pooled), 0.388 (per image) or 0.538 (MONAI's ignore_empty=True default) on the same masks.
  • Multilabel: accuracy is 0.785 or 0.919 on the same predictions: subset accuracy (sklearn, torcheval, evaluate) vs per-label accuracy (torchmetrics, Keras).
  • Hugging Face evaluate's ROUGE defaults to a bootstrap estimate (use_aggregator=True, unseeded resampling), not the mean, so it's slightly off and can change between runs.
  • Retrieval (BEIR SciFact): sklearn, torchmetrics, torcheval and trec_eval agree, except when scores tie or are ≤ 0 (torchmetrics treats those as not retrieved, torchmetrics#3518).

It also checks whether a metric averaged over batches matches the whole-dataset value (ECE on SST-2: 0.095 vs 0.080), and it has pytest assertions and a GitHub Action, so a library upgrade can't silently change your numbers.

What's the most confusing metric mismatch you've run into? If metric-diff says "no known cause" on your data, I'd like to see it: https://github.com/DadCoder001/metric-diff/discussions/1


r/learnmachinelearning • • 1d ago

Discussion What counts as yesterday when you batch glucose-monitor data?

Post image
22 Upvotes

TER, Figure 2. Daily CGM representations and supported multi-day history.

Shuffle a set of daily glucose records and yesterday’s row might belong to another person. LingSante-Pulse’s released glucose-monitoring pipeline takes the subject ID and actual window start time alongside each day of readings. It can also take an episode ID to keep separate recording periods apart. The subject ID groups history; it doesn’t become a numeric feature.

For each day, the pipeline can draw on up to seven days of causal context. The extractor returns a history_days count with the embedding. Give it a day with no usable earlier window and it falls back to that day alone.

If you process one file per day, inspect that count before trusting a longitudinal experiment. A folder can contain months of data while each individual extraction sees just one day.


r/learnmachinelearning • • 11h ago

Tutorial I packaged ISLP Chapter 10 data as a private Kaggle Dataset and ran into three non-obvious Kaggle/ISLP issues

1 Upvotes

I’m working through An Introduction to Statistical Learning with Applications in Python (ISLP), Chapter 10. I wanted to keep the chapter’s data and a ResNet50 checkpoint in a private Kaggle Dataset so I wouldn’t have to download everything again in each Notebook session

The process exposed a few issues that were not obvious from the local ZIP structure

1. The Dataset upload failed because Kaggle unpacked a nested archive

My ZIP contained both:

data/cifar-100-python/
data/cifar-100-python.tar.gz

Kaggle Support checked the failed uploads and confirmed this backend error:

Directory already exists: cifar-100-python

Kaggle unpacks uploaded archives server-side. The existing directory and the directory created by extracting the .tar.gz collided. Kaggle removed the incomplete Dataset after processing failed, which is why it never appeared in my Dataset list. Support also confirmed that my intended Dataset slug was not reserved

The fix was to keep the already-extracted cifar-100-python/{train,test,meta} directory in the Kaggle-specific ZIP and exclude the duplicate tar archive

I also checked eight other .gz files by comparing the SHA256 and byte size of their decompressed contents with existing sibling files. Those pairs were identical, so I omitted the redundant compressed copies from this upload package

The rebuilt ZIP had 29 entries, was 315.35 MiB, used POSIX / paths, and passed the ZIP CRC test

2. Creating a Dataset did not attach it to my existing Notebook

After the Dataset was created, /kaggle/input was still empty in my Notebook because I had not attached the Dataset

I had to use Add Input → Your Datasets

After attaching it, the actual path in my Notebook was:

/kaggle/input/datasets/<owner>/<dataset-slug>/

I have replaced the owner and slug with placeholders because the Dataset is private. The important point is that the actual mount path included an additional datasets/<owner>/ level. I now enumerate /kaggle/input instead of assuming the path is simply /kaggle/input/<slug>

3. ISLP’s IMDB loader expected .tensor.gz, but Kaggle Input is read-only

I had kept the decompressed IMDB files, such as IMDB_X_test.tensor, but omitted the byte-identical .tensor.gz copy

ISLP 0.5.0 still looked for IMDB_X_test.tensor.gz. When it did not find that filename, it tried to download the file and write it under the supplied root directory. Since that directory was under /kaggle/input, it failed with:

OSError: [Errno 30] Read-only file system

The data itself was present; the loader did not automatically treat the uncompressed sibling as an equivalent file

As a temporary Notebook-side workaround, I patched the module’s _get_imdb() lookup for the current session: when a requested .tensor.gz is absent but the corresponding .tensor exists, return the .tensor path; otherwise call the original function. I restore the original function in a finally block

The following is a minimal version of the workaround. It assumes ISLP==0.5.0 is installed and the Dataset is already attached. Replace <owner> and <dataset-slug> with your actual mount path:

from pathlib import Path
import ISLP.torch.imdb as imdb

IMDB_DIR = Path(
    "/kaggle/input/datasets/<owner>/<dataset-slug>/data/IMDB"
)

_original_get_imdb = imdb._get_imdb

def _get_imdb_kaggle(
    imdb_file,
    outdir,
    urlbase="http://imdb.jtaylor.su.domains/jtaylor/data/"
):
    requested = Path(outdir) / imdb_file

    if requested.name.endswith(".tensor.gz"):
        plain = requested.with_suffix("")
        if not requested.exists() and plain.is_file():
            return str(plain)

    return _original_get_imdb(imdb_file, outdir, urlbase)

imdb._get_imdb = _get_imdb_kaggle

try:
    imdb_train, imdb_test = imdb.load_tensor(root=str(IMDB_DIR))
    seq_train, seq_test = imdb.load_sequential(root=str(IMDB_DIR))
    lookup = imdb.load_lookup(root=str(IMDB_DIR))
finally:
    imdb._get_imdb = _original_get_imdb

print("Tensor:", len(imdb_train), len(imdb_test))
print("Sequential:", len(seq_train), len(seq_test))
print("Vocabulary entries:", len(lookup))

This modifies an internal helper only for the current Python process. It is a practical workaround, not a documented public ISLP API. A kernel restart removes the patch, so the cell must be rerun before loading IMDB again. It does not modify the Dataset

What I verified

My Kaggle runtime was Python 3.13, PyTorch 2.11.0+cpu, torchvision 0.26.0+cpu, and ISLP 0.5.0

  • MNIST: 60,000 train / 10,000 test, loaded with download=False
  • CIFAR-100: 50,000 train / 10,000 test, loaded with download=False
  • IMDB Tensor and Sequential: 25,000 train / 25,000 test each; load_lookup() returned 88,587 entries
  • ResNet50: local checkpoint SHA256 matched its filename prefix; load_state_dict(strict=True) matched all keys; a CPU forward pass on a zero tensor returned shape (1, 1000)

I have not run the full Chapter 10 Notebook or training, and the ResNet50 test was only a dummy-input forward pass, not real-image classification

Questions

  1. Is there a cleaner supported way to point ISLP 0.5.0’s IMDB loader at already-decompressed local .tensor files, or to separate its download/cache location from the read-only data root, without monkey-patching the private _get_imdb() helper?
  2. When preparing Kaggle Datasets, do you generally avoid including both an extracted directory and its source archive, given Kaggle’s server-side archive extraction?

I’m sharing this as a debugging/learning note in case the same combination of Kaggle archive processing and package-specific data loaders trips up someone else. I’d appreciate suggestions.

References:

  • Kaggle Datasets documentation: https://www.kaggle.com/docs/datasets
  • Kaggle Notebooks documentation: https://www.kaggle.com/docs/notebooks
  • ISLP Chapter 10 lab: https://intro-stat-learning.github.io/ISLP/labs/Ch10-deeplearning-lab.html
  • ISLP 0.5.0 on PyPI: https://pypi.org/project/ISLP/0.5.0/

r/learnmachinelearning • • 11h ago

opensource interview prep

1 Upvotes

Hi, i created this study guide for learning and interview prep. let me know what you think

https://tattoosbyhannah-cmyk.github.io/interviewprep/


r/learnmachinelearning • • 12h ago

Constellation Institute. Reputable? Anyone know?

1 Upvotes

They're an organization in AI safety. Do you think they'd be a good company to have on your resume for future jobs in AI related companies or frontier labs in non AI-safety roles?


r/learnmachinelearning • • 1d ago

You can’t debug a bad health-assistant call with a single star rating

31 Upvotes

Imagine a caller who asks a question three times and finally gets a sensible answer. What goes in the bug report: conversation failure, answer-quality failure, or both?

LingSante-Live’s launch study split the review work. Participants who role-played the calls rated the experience. Physicians assessed medical quality. The team published aggregate results; those averages can’t reveal whether a good answer and a frustrating experience came from the same call.

For an evaluation harness, I’d put a shared call ID on the two forms. Hand a reviewer a mismatched pair and the job becomes specific: listen for where the caller struggled, then inspect the answer that finally came back. The fix might belong in the interaction loop even when the answer itself holds up.


r/learnmachinelearning • • 1d ago

Discussion For LingSante-Pulse, 0.97 and 97 land in very different places

34 Upvotes

A loader that expresses oxygen saturation as a fraction can quietly break a LingSante-Pulse experiment. The open preprocessing code expects the SpO₂ channel in percent. It subtracts 95, divides by 5 and clips the result to the interval from −10 to 10. An input of 97 becomes 0.4. An input of 0.97 hits the lower clip limit.

It’s an easy mistake to miss because the same encoder handles ECG waveforms. Those are standardized using observed samples in each window. Numeric channels such as oxygen saturation keep a fixed physical scale instead.

One small regression test would catch it: send the loader a known 97% reading, then assert that the numeric value after preprocessing is close to 0.4. A shape check won’t tell you the units changed.


r/learnmachinelearning • • 14h ago

A free first-week plan for people who want to learn AI but don't code

1 Upvotes

A lot of "learn AI" advice jumps straight into Python and math. That's the right path if you want to build AI. It is not the only path, and it scares off a lot of beginners who actually just want to use AI well.

If that's you, here is a simple first week that costs nothing and needs no coding.

Day 1. Pick one free assistant — ChatGPT, Claude, Gemini, or Microsoft Copilot — and ask it to "explain AI to me like I'm new to computers."

Day 2. Read that tool's official getting-started page (OpenAI, Anthropic, Google, and Microsoft all have one).

Days 3–5. Take one short, free intro course. Good options:

  • Elements of AI: Introduction to AI, from MinnaLearn and the University of Helsinki (their page says no complicated math or programming is required)
  • Introduction to Generative AI on Google Skills (they list it at about 45 minutes)
  • Microsoft Learn's AI Fluency path (seven short beginner modules)
  • AI for Everyone by Andrew Ng / DeepLearning.AI (the videos are free to watch; a certificate is a paid option, so check the course page)

You only need one of these, not all of them.

Day 6. Practice on something from your real life: a grocery list, a polite email, or a summary of a long article. Leave out passwords, account numbers, and anything else you wouldn't want stored online.

Day 7. Practice writing a clearer prompt. A simple recipe is: who it's for, the task, the context, and the format you want (bullets, a table, a word limit). If the first answer is off, tell the tool what to change.

Two things I wish someone had told me earlier:

  • "Learning AI" can mean building models, or it can mean using the tools well. The second kind needs no coding.
  • AI can sound very sure of itself and still be wrong. Double-check anything important, especially health, money, or legal questions.

I made a free beginner site called Pluto's Place (it's mine) that points to official courses, tools, and a few plain-English guides. The first-week plan above is also written up here, with the official links: https://plutosplace.com/guides/start-learning-ai-free

Happy to answer questions if you're stuck on where to start.


r/learnmachinelearning • • 15h ago

Request Japan's largest power company JERA hacked, operations unaffected

1 Upvotes

Japan's largest power company JERA confirmed a breach last week. Operations were unaffected. The compromised system belonged to a third-party vendor, not JERA's own infrastructure.

That detail is the whole story. JERA's perimeter held. A vendor holding their data did not.

Third-party vendor incidents now account for the majority of critical-infrastructure data exposures. The primary organization often has no technical visibility into what form their data exists in once it has moved to a vendor environment. If that vendor is breached, the exposure depends entirely on decisions the vendor made, not the data owner.

The uncomfortable part: the breach path here was a sanctioned, authorized relationship. The vendor had the data because they were supposed to. The attacker exploited legitimate access, not a hole in JERA's own systems. That makes the standard perimeter-hardening conversation mostly irrelevant to this class of incident.

For people working in OT security, third-party risk, or data governance: once sensitive data leaves your environment for a vendor, what actually governs its exposure surface on the other side? And how do you know?


r/learnmachinelearning • • 19h ago

Project Final year project is a mess and I genuinely don't know what to do anymore

2 Upvotes

I'm a final-year B.Tech student working on Human Activity Recognition using deep learning. My group members barely communicate, don't reply to messages and are always unavailable. Most of their work is AI-generated code that they barely understand.

Our mentor doesn't prefer meeting individual members, and because of the constant coordination issues, we haven't met her in two months. I know I should have contacted her earlier, and I genuinely regret that. I finally reached out today, but she said she's busy and will discuss the work in January. Our presentation is on 10th December, and she'll be evaluating us.

I've been working on my part, but I have several doubts regarding the research methodology and have no one to guide me. I also have semester exams and can't possibly handle the entire project alone.

If anyone has experience with HAR, deep learning or ML research and could help me clarify a few doubts, I'd genuinely appreciate it. I'm not asking anyone to do my project, I just need some guidance because I feel completely lost.


r/learnmachinelearning • • 8h ago

We're entering an era where everything has a spark of intelligence

Thumbnail
gallery
0 Upvotes

r/learnmachinelearning • • 16h ago

Career I wrote a practical study guide for AI/ML Engineer interviews in FinTech — RAG, agents, LLMOps, and production AI Spoiler

1 Upvotes

Hi everyone,

I’m Camila Chica, an AI/ML and cloud technology professional, and I recently published a technical interview study guide called Cracking the AI/ML Engineer Interview in FinTech.

I wrote it for engineers preparing for roles such as AI Engineer, Machine Learning Engineer, GenAI Engineer, Senior AI/ML Engineer, or AI/ML Engineering Lead—especially in banks, payment processors, insurers, and FinTech platforms.

The focus is on the engineering work behind production AI systems, not just model demos.
The guide follows the enterprise GenAI lifecycle and covers:

RAG: ingestion, chunking, embeddings, retrieval, and context management

Agentic AI: planning, memory, tool use, and multi-agent design

LLM orchestration and enterprise API integration
Evaluation, groundedness, and hallucination control

Security, governance, access control, and auditability
Cloud deployment, monitoring, MLOps, and LLMOps

Technical interview questions, model answers, knowledge checks, and a rapid-review checklist

It includes 25 chapters and is organized around the kinds of architecture decisions and trade-offs engineers need to explain in interviews.

I created it because preparing for these interviews can be difficult when learning materials are scattered across documentation, tutorials, and system-design discussions. I wanted to put the major concepts into one structured study resource.

If you’re preparing for an AI/ML or GenAI role in financial services, I’d appreciate you taking a look.

Book: Cracking the AI/ML Engineer Interview in FinTech
Author: Camila Chica
Amazon: https://link.amazon/B04DOF7LX

I’m especially interested in feedback from engineers working on production RAG, agentic workflows, or AI systems in regulated environments. What topics do you think are most important for candidates to understand today?

Thanks for reading.


r/learnmachinelearning • • 19h ago

Question Can models(LLMs or VLMs) understand / feel time deltas?

2 Upvotes

Is it possible for a model to understand time? and have time be a factor in its output?

time as in time delta change from getting input to giving output...

example a migration script that should run a few seconds was hung for 10 min after i killed it,
in this case i would expect a llm to have a timeout set before running, but that gave me this question in general do models understand time change and have duration expectations

humans have a biological tick-rate, OSs have it, could it be possible for a model to also have it while reasoning?


r/learnmachinelearning • • 16h ago

We built 100 free interactive browser labs + single-page architecture diagrams explaining different AI concepts

Post image
1 Upvotes

Hey everyone,

Over the past few months, my co-author (Mohammad Javad Najafi) and I have been working on breaking down 100 core AI/ML concepts into single-page visual plates—one concept per page, one clean architectural diagram, no heavy math walls, and no lock-in to a specific library.

The image above shows four of the later diagrams covering Latent Diffusion, Vision-Language Models, Adversarial Examples, and Benchmark Contamination.

If you'd like to inspect the full layout and text behind these four chapters, I uploaded a free 4-chapter PDF preview on Zenodo:

https://zenodo.org/records/24718068

(They're part of a 100-chapter visual AI project called "The Shape of Intelligence: 100 Visual Experiments in AI".)

Would really appreciate any feedback on the diagrams or labs—especially if anything feels unclear ...

Regards.


r/learnmachinelearning • • 16h ago

Tutorial We built 100 free interactive browser labs + single-page architecture diagrams explaining different AI concepts

Post image
1 Upvotes

Hey everyone,

Over the past few months, my co-author (Mohammad Javad Najafi) and I have been working on breaking down 100 core AI/ML concepts into single-page visual plates—one concept per page, one clean architectural diagram, no heavy math walls, and no lock-in to a specific library.

The image above shows four of the later diagrams covering Latent Diffusion, Vision-Language Models, Adversarial Examples, and Benchmark Contamination.

If you'd like to inspect the full layout and text behind these four chapters, I uploaded a free 4-chapter PDF preview on Zenodo:

https://zenodo.org/records/24718068

(They're part of a 100-chapter visual AI project called "The Shape of Intelligence: 100 Visual Experiments in AI".)

Would really appreciate any feedback on the diagrams or labs—especially if anything feels unclear ...

Regards.


r/learnmachinelearning • • 18h ago

[Project] How I caught two major dataset leaks (http:// shortcut & www. skew) while training an XGBoost phishing detector on 235K URLs

1 Upvotes

While building TrustLink (an end-to-end phishing URL detector using Python, XGBoost, and FastAPI), my initial model hit 99% accuracy on a 235K+ URL dataset—and completely failed on basic real-world test links.

How I built it & what went wrong (Data Leakage & Bias)

  1. The http:// shortcut (99% → 90% accuracy): In the combined dataset (built primarily from PhiUSIIL + Malicious URLs), virtually zero legitimate URLs used http://. XGBoost learned a trivial shortcut split (starts_with_http == True -> Phishing). Once I stripped protocol-level features out, validation accuracy dropped from 99% to 90%, forcing the tree splits to actually rely on lexical structure, TLD entropy, subdomain depth, and brand similarity.
  2. The www. apex-domain bias: All ~134,850 legitimate URLs in PhiUSIIL begin with www., which causes false positives on legitimate bare apex domains (e.g., github.com) or non-www subdomains (docs.python.org).

Pipeline & Next Engineering Sprint

• Current Stack: Custom URL lexical/structural feature extractor -> XGBoost classifier -> FastAPI inference endpoint with three-tier thresholding (Genuine, Suspicious, Phishing).

• Next up in the loop:

- Normalizing leading www. and augmenting legitimate training samples with bare apex domains (e.g., Tranco top domains).

- Adding Punycode (xn--) & mixed-script Unicode homograph detection before running brand Levenshtein similarity.

- Production hardening: structured API logging, rate limiting, and Docker deployment.

For anyone who has worked with URL classification datasets: how do you usually balance lexical features against domain-reputation biases without leaking collection artifacts?

Full code, EDA notebooks, and dataset bias notes are in the repo: https://github.com/Abijith-RA/TrustLink


r/learnmachinelearning • • 1d ago

Help Started my journey

Post image
225 Upvotes

I am on a scratch level and currenty started my ml journey with this book Hands on machine learning with scikit learn and pytorch
Got the whole book printed out
What should i do along side or with it ? At what point should i start building ??
Is it a good start ??
Would love advices and corrections


r/learnmachinelearning • • 18h ago

learning to make models from scratch, anything else to try and learn?

Thumbnail reddit.com
1 Upvotes

r/learnmachinelearning • • 18h ago

Complete Beginner

Thumbnail reddit.com
1 Upvotes

r/learnmachinelearning • • 23h ago

YOLO26 / YOLOE in cpp. CPU with GPU offloading

Thumbnail
github.com
2 Upvotes

The app is actually with my own pure C system. This one is built on top of ggml / llama.cpp. It's better on PC plus it has the llama.cpp GPU offloading ( all GPUs ) . I need to fix some threading issues then I'll upload the app using this system to the repo.

https://www.youtube.com/shorts/LdhYoXquvbY


r/learnmachinelearning • • 19h ago

Help Question about Ai intelligence and ideas - Models training

1 Upvotes

Hi folks, I'm using AI since the very first weeks and i'm in the online world for many years now.

I'm not a newbie but I think I'm missing a piece. Maybe someone can help me.

We all know AI is not intelligent but somehow I think it should "know" how to do what we ask it.
Yes, what goes in, comes out. Agree, we have to be able to frame the request in the correct way but I'm finding a bottleneck very often.

For example I'm trying to create a specific image uspcaler for my needs.
I have tried any angle it came to my mind but Claude or Codex, never create something really on point. They do a bit, they do the 40% but never bring it to the next level as requested.

I find my self doing the research as the old times and than feed it to the AI instead the AI telling me what would be the best approach. Ai fails almost on every try.

The upscaler example is just an example but I could tell many many others.

Is there somethig I'm missing about how to prompt Codex or Claude? I tried all the models, in my case I mostrly use Codex: i've tried, Sol, Astra, all of them. No serius results but poor ones.

So the question is maybe: when we have a great idea, but we don't know how to create it. Can Ai really help?


r/learnmachinelearning • • 19h ago

Meme Adam

1 Upvotes

r/learnmachinelearning • • 1d ago

Tutorial Your GPU Kernel Compute-Bound or Memory-Bound? | Kernel Engineering | Session 4

Thumbnail
youtu.be
2 Upvotes

r/learnmachinelearning • • 21h ago

Project How $0.02 slices from existing robot demos took a 27B VLM from 119.7 mm to 51.6 mm 3D gripper error

Thumbnail
gallery
1 Upvotes

I ran a quick 1280x960 test-tube rack check on stock Qwen3.8-27B in llama.cpp and its 2D hole coordinates were within 3 pixels, while on 374 recorded RoboDojo arm moves its 3D gripper targets miss by 203.5 mm median (7.8% within 50 mm).

Pulled the ablation numbers from SenseNova-RoboRSI-27B at https://github.com/OpenSenseNova/SenseNova-RoboRSI to see how they got the 3D error down without collecting everything through long rollouts at ~$0.50 per target. Long rollouts alone left the 27B finetune at 119.7 mm. Slicing existing robot demos at velocity and gripper changes gave them single-move 3D endpoint pairs for about $0.02 each, which cut median error to 51.6 mm and tripled 5 mm hits from 4.3% to 15.5%. Adding a 4-step VLA review gate also lifted 42-task completion from 3/42 open-loop VLA up to 21/42. Has anyone tried similar move-level slicing on teleop datasets?