Agent skill

numpy-statistics

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/numpy-statistics

SKILL.md

Overview

NumPy provides a suite of statistical functions for summarizing data. Key capabilities include calculating central tendencies, dispersion, and relationships between variables, with specific handling for missing values (NaNs).

When to Use

  • Summarizing experimental data (mean, median, standard deviation).
  • Visualizing data distributions via histogram counts and binning.
  • Identifying relationships between multiple variables using correlation matrices.
  • Analyzing datasets with missing values where standard aggregations would fail.

Decision Tree

  1. Does your data contain NaN?
    • Yes: Use nan prefixed functions (e.g., np.nanmean).
    • No: Use standard functions (e.g., np.mean).
  2. Creating a histogram?
    • Need normalized area? Set density=True.
    • Fixed bin widths? Provide an integer for bins or an array for custom edges.
  3. Checking correlation?
    • Use np.corrcoef. Note: output may require clipping if float errors occur.

Workflows

  1. Robust Mean Calculation

    • Identify an array with potential missing values (NaNs).
    • Calculate the mean using np.nanmean(arr).
    • Optionally use np.nanstd(arr) to find the standard deviation of the valid subset.
  2. Custom Histogram Creation

    • Define a set of non-uniform bin edges [0, 5, 10, 50, 100].
    • Pass the data and edges to np.histogram(data, bins=edges).
    • Retrieve the counts and the validated edges for plotting.
  3. Inter-Variable Correlation Analysis

    • Stack multiple data variables into a 2D array (rows as variables).
    • Execute np.corrcoef(data).
    • Inspect the off-diagonal elements for Pearson correlation strengths.

Non-Obvious Insights

  • NaN Sensitivity: Standard statistical functions return NaN if even one element is missing; the nan versions are essential for real-world messy data.
  • Histogram Density: The density=True flag ensures the integral over the histogram is 1, not that the sum of the counts is 1 (unless bin widths are 1).
  • Precision Clipping: Correlation coefficients can occasionally drift outside [-1, 1] due to floating-point rounding; NumPy automatically mitigates this in corrcoef results.

Evidence

  • "nanmean... Compute the arithmetic mean along the specified axis, ignoring NaNs." Source
  • "Note that the sum of the histogram values will not be equal to 1 unless bins of unity width are chosen; it is not a probability mass function." Source

Scripts

  • scripts/numpy-statistics_tool.py: Computes robust statistics and custom histograms.
  • scripts/numpy-statistics_tool.js: Basic mean calculator.

Dependencies

  • numpy (Python)

References

  • references/README.md

Expand your agent's capabilities with these related and highly-rated skills.

cuba6112/skillfactory

prompt-engineering

Comprehensive prompt engineering techniques for Claude models. Use this skill when crafting, optimizing, or debugging prompts for Claude API, Claude Code, or any Claude-powered application. Covers system prompts, role prompting, multishot examples, chain of thought, XML structuring, long context handling, extended thinking, prompt chaining, Claude 4.x-specific best practices, and agentic orchestration including subagents, agent loops, skills, MCP integration, and multi-agent workflows.

0 0
Explore
cuba6112/skillfactory

adk-rag-agent

Build RAG (Retrieval-Augmented Generation) agents with Google ADK and Vertex AI RAG Engine. Use when implementing document Q&A, knowledge base search, or citation-backed responses. Covers VertexAiRagRetrieval tool, corpus setup, and citation formatting.

0 0
Explore
cuba6112/skillfactory

headless-cli-agents

Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.

0 0
Explore
cuba6112/skillfactory

notion-knowledge-capture

Capture conversations and decisions into structured Notion pages; use when turning chats/notes into wiki entries, how-tos, decisions, or FAQs with proper linking.

0 0
Explore
cuba6112/skillfactory

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

0 0
Explore
cuba6112/skillfactory

gh-fix-ci

Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.

0 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results