本文へスキップ
Skillpedia
機械学習48k · #5180

mathguard

できること

このツールは、特に大量のデータを扱う複雑な計算問題を解くために、高度な数学的手法を選ぶ手助けをします。従来の方法よりも効率的な代替案を提案し、小さな誤差を許容できる場合には、その前提で提案することもあります。

使う場面

  • ✓何百万件ものデータの中から似たものを素早く見つけたいとき。
  • ✓信号や画像を処理していて、高速な計算が必要なとき。
  • ✓一般的なアルゴリズムでも十分速いが、さらに良い解法が必要で、小さな誤差を許容できるとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/mathguard/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/mathguard/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“1,000万枚の画像データセットから重複を見つける必要がありますが、いくつかの誤検出は許容できます。どの数学的手法を使えますか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、問題を、大量のデータに対してより効率的であることが知られている数学的手法と照らし合わせます。厳密な答えが必要か、それとも誤差が分かっている近似で十分かも確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

mathguard — Math-Heavy Optimization for AI Code

lemmaly makes you pick the right classical algorithm. mathguard kicks in when the classical algorithm is already optimal but mathematics gives a better bound — usually by accepting bounded approximation, exploiting structure, or moving to a smarter algebraic space.

The model knows these techniques. It almost never proposes them spontaneously. mathguard fixes that.

Violating the letter of these rules is violating the spirit of the skill. A Bloom filter where the caller assumed exact answers is a production incident, not an optimization.

When to Use This Skill

Use mathguard when:

  • Working with large-scale data (n ≥ 10⁶): similarity search, deduplication, top-K / heavy-hitters, streaming analytics, cardinality estimation, embeddings, recommender systems.
  • Doing signal/image processing, polynomial or big-integer arithmetic, convolution, graph distance, computational geometry, randomized algorithms.
  • The classical O(n log n) is already the floor and you need an asymptotic win (Bloom filter, HyperLogLog, Count-Min Sketch, MinHash/LSH, FFT/NTT, Johnson-Lindenstrauss projection, sweep line, kd-tree/BVH, fast exponentiation, monoid parallel reduction, amortized potential method).
  • Loaded after lemmaly has confirmed the classical answer is not enough.

Do not use mathguard when:

  • The caller needs exact answers (auth, billing, dedup-for-correctness, primary keys).
  • n is small (n < 10⁴) and the path is not hot.
  • The bottleneck is I/O, not CPU/memory.

The Iron Law

NO APPROXIMATE STRUCTURE WITHOUT WRITTEN ε/δ AND EXPLICIT CALLER ACCEPTANCE

Probabilistic data structures (Bloom, HyperLogLog, Count-Min, MinHash/LSH, t-digest), randomized projections (JL), and lossy transforms (floating FFT) all change the answer's meaning. Before proposing one:

  1. Write the error parameter the caller will see (false-positive rate, relative error, distortion bound).
  2. Identify the caller and state, in one sentence, that they tolerate this kind of wrong answer.
  3. If you cannot identify the caller, or they need exact (auth checks, billing, dedup keys, deduplication for correctness, anything that flows into a primary key), DO NOT propose the approximate structure. Keep classical, or escalate to a sharded/streaming exact design.

This rule has saved more incidents than any other in this skill. Do not soften it.

Non-negotiable rules

  1. Declare exact vs approximate up front. Before suggesting a math-level technique, state:

    • mode: exact or mode: approximate
    • If approximate: the error parameter (ε, δ, false-positive rate) and a sentence on whether the caller can tolerate it.
    • If the caller needs exact and there is no exact win, say so and stop — do not silently degrade to approximate.
  2. Cite the technique by name. Never describe a probabilistic or numerical trick in vague terms. Name it: Bloom filter, HyperLogLog, Count-Min Sketch, MinHash + LSH, Johnson–Lindenstrauss projection, FFT, NTT, fast exponentiation, Karatsuba, Strassen, sweep line, kd-tree, BVH, union-find with path compression, Floyd's cycle detection, Boyer-Moore majority, reservoir sampling, Knuth shuffle, Aho-Corasick, suffix automaton, segment tree with lazy propagation, Fenwick tree, monoid scan / parallel prefix. A named technique is auditable; "a smart approximation" is not.

  3. State the trade you are making. Every math-level optimization buys something at a cost. In one line:

    • Buys: space, time, wall-clock, parallelism.
    • Costs: accuracy ε=?, code complexity, dependency, non-determinism, numerical stability.
    • If the cost is invisible to the caller, write "callers see no change".
  4. Justify the asymptotic win. Do not propose a math technique without a one-line bound argument:

    • "HyperLogLog: count uniques in O(log log n) bits at standard error 1.04/√m."
    • "FFT: polynomial multiplication O(n log n) vs schoolbook O(n²)."
    • "JL projection: preserves pairwise distances within (1±ε) using O(log n / ε²) dimensions."
    • "Sweep line: rectangle overlap from O(n²) pair checks to O(n log n) events." No bound, no proposal.
  5. Forbid math cargo-culting. Do not introduce these techniques when:

    • n is small enough that a linear scan finishes in microseconds (n < ~10⁴ unless it is a hot path).

…

よくある質問

「既知の誤差を持つ近似」とはどういう意味ですか?

答えが100%正確とは限りませんが、誤差は小さく、予測できるものです(例:1%の確率で間違う)。そのため計算をずっと速くできます。

このツールを使うべきでないのはどんなときですか?

金融取引のように正確さが何より重要な場合や、データ量が少ない(1万件未満)場合は、単純な方法でも十分にうまくいくため、使わないでください。

どのような手法を提案することがありますか?

問題に応じて、ブルームフィルタ、HyperLogLog、Count-Min Sketch、MinHash、高速フーリエ変換(FFT)などを提案することがあります。

詳細

作者による元の説明

Math-heavy escalation for n >= 10^6 — Bloom, HyperLogLog, Count-Min, MinHash/LSH, FFT, JL projection, sweep line. Use when classical O(n log n) is the floor and approximate or math wins.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5180
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル