MCPcopy Create free account

hub / github.com/rohitg00/ai-engineering-from-scratch / functions

Functions8,347 in github.com/rohitg00/ai-engineering-from-scratch

↓ 1 callersFunctioncosine
(a, b)
phases/06-speech-and-audio/03-audio-classification/code/main.py:112
↓ 1 callersFunctioncosine
(a, b)
phases/06-speech-and-audio/17-audio-evaluation-metrics/code/main.py:55
↓ 1 callersFunctioncosine
(a, b)
phases/05-nlp-foundations-to-advanced/22-embedding-models-deep-dive/code/main.py:28
↓ 1 callersFunctioncosine
(a: list[float], b: list[float])
phases/19-capstone-projects/67-query-rewriting-hyde/code/main.py:51
↓ 1 callersFunctioncosine
(a: list[float], b: list[float])
phases/19-capstone-projects/69-end-to-end-rag-system/code/main.py:79
↓ 1 callersFunctioncosine
(a: list[float], b: list[float])
phases/19-capstone-projects/66-reranker-cross-encoder/code/main.py:191
↓ 1 callersFunctioncosine
(a: list[float], b: list[float])
phases/19-capstone-projects/65-hybrid-retrieval-bm25-dense/code/main.py:120
↓ 1 callersFunctioncosine
(a: list[float], b: list[float])
phases/19-capstone-projects/02-rag-over-codebase/code/main.py:76
↓ 1 callersFunctioncosine_similarity
(a, b)
phases/05-nlp-foundations-to-advanced/02-bag-of-words-tfidf/code/main.py:63
↓ 1 callersFunctioncosine_similarity
(a, b)
phases/11-llm-engineering/13-production-app/code/production_app.py:183
↓ 1 callersFunctioncosine_similarity
(a, b)
phases/11-llm-engineering/11-caching-cost/code/caching_cost.py:107
↓ 1 callersFunctioncosine_similarity
(a, b)
phases/11-llm-engineering/07-advanced-rag/code/main.py:47
↓ 1 callersFunctioncostBatch
( docs: number, prefixTokens: number, perDocTokens: number, outTokens: number, )
phases/17-infrastructure-and-production/15-batch-apis/code/main.ts:215
↓ 1 callersFunctioncostBatchCache
( docs: number, prefixTokens: number, perDocTokens: number, outTokens: number, )
phases/17-infrastructure-and-production/15-batch-apis/code/main.ts:224
↓ 1 callersFunctioncost_batch
(docs: int, prefix_tokens: int, per_doc_tokens: int, out_tokens: int)
phases/17-infrastructure-and-production/15-batch-apis/code/main.py:39
↓ 1 callersFunctioncost_batch_cache
(docs: int, prefix_tokens: int, per_doc_tokens: int, out_tokens: int)
phases/17-infrastructure-and-production/15-batch-apis/code/main.py:43
↓ 1 callersFunctioncost_per_million_tokens
(active_b: float, stack: Stack)
phases/17-infrastructure-and-production/07-tensorrt-llm-blackwell/code/main.py:60
↓ 1 callersMethodcount
(self)
phases/14-agent-engineering/07-memory-virtual-context-memgpt/code/main.py:82
↓ 1 callersFunctioncountTokens
(toks)
site/figures-transformers.js:279
↓ 1 callersFunctioncount_full_attention
(N: int)
phases/10-llms-from-scratch/17-native-sparse-attention/code/main.py:144
↓ 1 callersFunctioncount_nonmasked
(M)
phases/07-transformers-deep-dive/15-attention-variants/code/main.py:41
↓ 1 callersFunctioncount_parameters
(vocab: int, hidden: int, ff: int, n_layers: int, D: int)
phases/10-llms-from-scratch/18-multi-token-prediction/code/main.py:176
↓ 1 callersMethodcount_parameters
(self)
phases/03-deep-learning-core/10-mini-framework/code/main.py:241
↓ 1 callersFunctioncount_tokens
(T, H, W, p_t=2, p_h=8, p_w=8)
phases/04-computer-vision/28-world-models-video-diffusion/code/main.py:64
↓ 1 callersFunctioncount_vectorize
(documents)
phases/02-ml-fundamentals/08-feature-engineering/code/features.py:90
↓ 1 callersMethodcounter
(self, name: str)
phases/19-capstone-projects/29-end-to-end-coding-task-demo/code/main.py:387
↓ 1 callersFunctioncovariance_matrix
(data)
phases/01-math-foundations/15-statistics-for-ml/code/statistics.py:101
↓ 1 callersMethodcovs
(self)
phases/04-computer-vision/22-3d-gaussian-splatting/code/main.py:57
↓ 1 callersFunctioncp_wbft
(votes: list[Vote], threshold: float = 0.5)
phases/16-multi-agent-and-swarms/14-consensus-and-bft/code/main.py:36
↓ 1 callersMethodcrash_recover
(self)
phases/13-tools-and-protocols/13-mcp-async-tasks/code/main.py:60
↓ 1 callersFunctioncreateMessage
( role: MessageRole, parts: MessagePart[], replyTo?: string )
phases/16-multi-agent-and-swarms/03-communication-protocols/code/main.ts:27
↓ 1 callersFunctioncreatePaletteDOM
()
site/cmdpalette.js:219
↓ 1 callersFunctioncreate_demo_data
(n_samples=500, d_model=256, n_classes=10)
phases/11-llm-engineering/08-fine-tuning-lora/code/lora.py:188
↓ 1 callersFunctioncreate_loaders
(train_images, train_labels, test_images, test_labels, batch_size=64)
phases/03-deep-learning-core/11-intro-to-pytorch/code/pytorch_intro.py:124
↓ 1 callersFunctioncreate_parent_child_chunks
(text, parent_size=200, child_size=50)
phases/11-llm-engineering/07-advanced-rag/code/main.py:202
↓ 1 callersFunctioncritique
Identify tokens that violate the sampled principle.
phases/18-ethics-safety-alignment/05-constitutional-ai-rlaif/code/main.py:64
↓ 1 callersFunctioncritique
(response: str, principle: str)
phases/10-llms-from-scratch/09-constitutional-ai-self-improvement/code/main.py:26
↓ 1 callersFunctioncross_entropy
(logits: List[float], target: int)
phases/10-llms-from-scratch/18-multi-token-prediction/code/main.py:132
↓ 1 callersFunctioncross_entropy_loss
(logits, target_index)
phases/01-math-foundations/06-probability-and-distributions/code/probability.py:104
↓ 1 callersFunctioncross_entropy_loss
(logits, targets)
phases/10-llms-from-scratch/04-pre-training-mini-gpt/code/main.py:120
↓ 1 callersFunctioncross_entropy_toy
(prob: float)
phases/12-multimodal-ai/13-transfusion-autoregressive-diffusion/code/main.py:84
↓ 1 callersFunctioncross_modal_error_rate
(image_emb, text_emb, text_confidence, sim_threshold=0.25, conf_threshold=0.8)
phases/04-computer-vision/25-vision-language-models/code/main.py:31
↓ 1 callersFunctionctc_loss
(log_probs, targets, input_lengths, target_lengths, blank=0)
phases/04-computer-vision/19-ocr-document-understanding/code/main.py:10
↓ 1 callersFunctioncurriculum_map
(concepts: list[Concept])
phases/19-capstone-projects/17-personal-ai-tutor/code/main.py:68
↓ 1 callersFunctioncurriculum_stages
(mix: dict)
phases/12-multimodal-ai/08-llava-onevision-single-multi-video/code/main.py:104
↓ 1 callersFunctioncustom_domain_rules
Example: financial-advice disclaimer rule.
phases/18-ethics-safety-alignment/29-moderation-systems-openai-perspective-llamaguard/code/main.py:56
↓ 1 callersFunctiondPerLayer
()
site/figures-dl.js:135
↓ 1 callersFunctiondata_scale_table
()
phases/12-multimodal-ai/15-janus-pro-decoupled-encoders/code/main.py:110
↓ 1 callersFunctiondataframe_display
()
phases/00-setup-and-tooling/05-jupyter-notebooks/code/notebook_tips.py:52
↓ 1 callersFunctiondatasheet
()
phases/18-ethics-safety-alignment/26-model-system-dataset-cards/code/main.py:57
↓ 1 callersFunctiondct
Naive type-II DCT.
phases/12-multimodal-ai/21-embodied-vlas-openvla-pi0-groot/code/main.py:29
↓ 1 callersFunctiondct_ii
(x, n_coeffs)
phases/06-speech-and-audio/02-spectrograms-mel-features/code/main.py:104
↓ 1 callersFunctiondct_ii
(x, n_coeffs)
phases/06-speech-and-audio/03-audio-classification/code/main.py:89
↓ 1 callersFunctiondct_ii
(x, n_coeffs)
phases/06-speech-and-audio/06-speaker-recognition-verification/code/main.py:90
↓ 1 callersFunctiondead_neuron_detector
(n_inputs=5, hidden_size=20, n_samples=1000)
phases/03-deep-learning-core/04-activation-functions/code/main.py:96
↓ 1 callersFunctiondebias
Crude debias: project out the gender direction (axis 1 minus axis 0).
phases/18-ethics-safety-alignment/20-bias-representational-harm/code/main.py:59
↓ 1 callersFunctiondecentllms
Score proposals 0-1 via evaluator agents, pick geometric-median cluster. Simplified: evaluator is the aggregator itself, scoring = confidence. Th
phases/16-multi-agent-and-swarms/14-consensus-and-bft/code/main.py:50
↓ 1 callersFunctiondeceptive_policy
(ex: Example, mesa_goal: int = 0)
phases/18-ethics-safety-alignment/06-mesa-optimization-deceptive-alignment/code/main.py:53
↓ 1 callersMethoddecide
(self, text: str, verdicts: list[ClassifierVerdict])
phases/19-capstone-projects/85-content-classifier-integration/code/main.py:67
↓ 1 callersMethoddecide
(self, trace: list[Span])
phases/19-capstone-projects/11-llm-observability-dashboard/code/main.py:51
↓ 1 callersFunctiondecide_next_category
Read the shared cache. With probability coordination_weight, switch to the least-filled work category (noticing redundancy). Otherwise stay on
phases/10-llms-from-scratch/22-async-hogwild-inference/code/main.py:47
↓ 1 callersFunctiondecode
(z)
phases/08-generative-ai/07-latent-diffusion-stable-diffusion/code/main.py:119
↓ 1 callersFunctiondecode
(tx_ty_tw_th, cell_x, cell_y, stride, anchor_wh)
phases/04-computer-vision/06-object-detection-yolo/code/main.py:60
↓ 1 callersMethoddecode
(self, tokens)
phases/10-llms-from-scratch/01-tokenizers/code/main.py:8
↓ 1 callersFunctiondecode_cached
KV cache: each new step appends one K,V and queries against the cache.
phases/07-transformers-deep-dive/12-kv-cache-flash-attention/code/main.py:87
↓ 1 callersFunctiondecode_naive
Recompute attention over the full prefix at every step. Returns list of outputs, one per generated token. Op count = 1+2+...+N = N(N+1)/2.
phases/07-transformers-deep-dive/12-kv-cache-flash-attention/code/main.py:72
↓ 1 callersMethoddecode_response
(self, ids: Sequence[int])
phases/19-capstone-projects/41-eval-pipeline/code/main.py:69
↓ 1 callersFunctiondecode_to_str
(ids)
phases/04-computer-vision/19-ocr-document-understanding/code/main.py:78
↓ 1 callersFunctiondecoder_block
(x, enc_out, p)
phases/07-transformers-deep-dive/05-full-transformer/code/main.py:198
↓ 1 callersMethoddecompose
(self, task: str, state: set[str])
phases/14-agent-engineering/11-planning-htn-and-evolutionary/code/main.py:52
↓ 1 callersFunctiondeduplicate
(documents, threshold=0.8, num_hashes=128, bands=16)
phases/10-llms-from-scratch/03-data-pipelines/code/main.py:61
↓ 1 callersFunctiondeepstack_features
Simulate DeepStack: per_layer_features is list of (N_patches, d) tensors from multiple ViT depths. Stack along channel dim and project.
phases/04-computer-vision/25-vision-language-models/code/main.py:40
↓ 1 callersFunctiondefault_classifiers
(system_prompt: str | None = None)
phases/19-capstone-projects/85-content-classifier-integration/code/classifiers.py:208
↓ 1 callersMethoddegree_matrix
(self)
phases/01-math-foundations/21-graph-theory/code/graph_theory.py:32
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/84-refusal-evaluation/code/main.py:155
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/36-training-loop-eval/code/main.py:385
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/86-constitutional-rules-engine/code/main.py:254
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/73-perplexity-calibration/code/main.py:234
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/70-task-spec-format/code/main.py:391
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/85-content-classifier-integration/code/main.py:120
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/82-jailbreak-taxonomy/code/main.py:179
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/56-iteration-scheduler/code/main.py:348
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/37-loading-pretrained-weights/code/main.py:345
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/72-code-exec-metric/code/main.py:321
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/75-end-to-end-eval-runner/code/main.py:349
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/57-end-to-end-research-demo/code/main.py:266
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/34-transformer-block/code/main.py:200
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/35-gpt-model-assembly/code/main.py:228
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/83-prompt-injection-detector/code/main.py:231
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/71-classical-metrics/code/main.py:214
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/74-leaderboard-aggregation/code/main.py:280
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/87-end-to-end-safety-gate/code/main.py:52
↓ 1 callersFunctiondemo
()
phases/19-capstone-projects/55-critic-loop/code/main.py:357
↓ 1 callersFunctiondemo
()
phases/13-tools-and-protocols/23-capstone-tool-ecosystem/code/main.py:178
↓ 1 callersFunctiondemo
()
phases/13-tools-and-protocols/18-mcp-auth-production/code/main.py:325
↓ 1 callersFunctiondemo
()
phases/13-tools-and-protocols/12-mcp-roots-and-elicitation/code/main.py:121
↓ 1 callersFunctiondemo
()
phases/13-tools-and-protocols/07-building-an-mcp-server/code/main.ts:297
↓ 1 callersFunctiondemo
()
phases/13-tools-and-protocols/07-building-an-mcp-server/code/main.py:245
↓ 1 callersFunctiondemo
()
phases/13-tools-and-protocols/10-mcp-resources-and-prompts/code/main.py:153
↓ 1 callersFunctiondemo
()
phases/13-tools-and-protocols/21-llm-routing-layer/code/main.py:111
← previousnext →3,101–3,200 of 8,347, ranked by callers