AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Skill 050

skill-legendtkl-agentic-skill-router-skill-050 · by legendtkl

Explore advanced optimization techniques for machine learning models using JAX. Includes gradient descent variants, adaptive methods, and optimization utilities.

No reviews yet
0 installs
23 views
0.0% view→install

Install

$ agentstack add skill-legendtkl-agentic-skill-router-skill-050

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-legendtkl-agentic-skill-router-skill-050)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Skill 050? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Requirements for Outputs

General Guidelines

Optimization

  • All optimization routines MUST support JAX-compatible parameters and gradients.
  • Ensure numerical stability and convergence for all optimization methods.
  • Provide informative error messages for invalid inputs or configurations.

JAX Optimization Techniques

1. Gradient Descent

gradient_descent(fn, init_params, learning_rate, num_steps)

Description: Perform gradient descent optimization on a loss function. Parameters:

  • fn (callable): The loss function to minimize.
  • init_params (array): Initial parameters for optimization.
  • learning_rate (float): Step size for each iteration.
  • num_steps (int): Number of optimization steps.

Returns: Optimized parameters after the specified number of steps.

import jax
import jax.numpy as jnp
from jax import grad
import jax_optimization_techniques as jx

# Define a simple quadratic loss function
def loss_fn(params):
    return jnp.sum((params - 3) ** 2)

# Perform optimization
optimized_params = jx.gradient_descent(loss_fn, jnp.array([0.0]), learning_rate=0.1, num_steps=100)

2. Adam Optimizer

adam_optimizer(fn, init_params, learning_rate, num_steps)

Description: Optimize a loss function using the Adam optimization algorithm. Parameters:

  • fn (callable): The loss function to minimize.
  • init_params (array): Initial parameters for optimization.
  • learning_rate (float): Step size for each iteration.
  • num_steps (int): Number of optimization steps.

Returns: Optimized parameters after the specified number of steps.

# Initialize Adam optimizer
def adam_optimizer(fn, init_params, learning_rate=0.001, num_steps=100):
    params = init_params
    m = jax.numpy.zeros_like(params)
    v = jax.numpy.zeros_like(params)
    beta1 = 0.9
    beta2 = 0.999
    epsilon = 1e-8

    for t in range(1, num_steps + 1):
        g = grad(fn)(params)
        m = beta1 * m + (1 - beta1) * g
        v = beta2 * v + (1 - beta2) * (g ** 2)
        m_hat = m / (1 - beta1 ** t)
        v_hat = v / (1 - beta2 ** t)
        params -= learning_rate * m_hat / (jnp.sqrt(v_hat) + epsilon)
    return params

optimized_params = adam_optimizer(loss_fn, jnp.array([0.0]), learning_rate=0.01, num_steps=100)

3. Learning Rate Schedulers

exponential_decay(initial_lr, global_step, decay_steps, decay_rate)

Description: Calculate the learning rate at a given step using exponential decay. Parameters:

  • initial_lr (float): Initial learning rate.
  • global_step (int): Current training step.
  • decay_steps (int): Step interval for decay.
  • decay_rate (float): Rate of decay.

Returns: Adjusted learning rate.

def exponential_decay(initial_lr, global_step, decay_steps, decay_rate):
    return initial_lr * (decay_rate ** (global_step // decay_steps))

current_lr = exponential_decay(0.1, 50, 10, 0.96)

4. Hyperparameter Tuning

hyperparameter_tuning(fn, param_grid)

Description: Perform hyperparameter tuning to find optimal parameters for a model. Parameters:

  • fn (callable): The model training function that takes hyperparameters as input.
  • param_grid (dict): Dictionary of hyperparameters and their corresponding list of values to test.

Returns: Best parameters based on validation performance.

from sklearn.model_selection import ParameterGrid

def tune_hyperparameters(fn, param_grid):
    best_score = float('inf')
    best_params = None
    for params in ParameterGrid(param_grid):
        score = fn(**params)
        if score < best_score:
            best_score = score
            best_params = params
    return best_params

best_params = tune_hyperparameters(train_model, {'learning_rate': [0.01, 0.1], 'batch_size': [32, 64]})

Notes:

  • Ensure that the loss function and tuning parameters are well-defined.
  • Use cross-validation for better evaluation of model performance.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.