
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
github.com/nbwoodward/simplegradient
Do you have a mostly continuous numerical model with:
You're in luck! To maximize or minimize your model all you need is:
float64
s that covers your parameter space.float64
.Maximize
or Minimize
Example Usage:
package main
import (
"fmt"
"math"
simplegradient "github.com/nbwoodward/simplegradient"
)
// All the params we think might be optimal for our function
var paramSpace = [][]float64{
{-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3}, // X
{-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3}, // Y
{-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3}, // Z
}
// x^2 + 2
var parabola = func(x float64) float64 {
return math.Pow(x, 2) + 2
}
func main() {
// A simple model that
model := func(xyz []float64) float64 {
x := xyz[0]
y := xyz[1]
z := xyz[2]
return parabola(x) + parabola(y) + parabola(z)
}
cfg := simplegradient.Config{
Model: model,
Params: paramSpace,
NumTests: 10,
}
bestParams, bestAnswer := simplegradient.Minimize(cfg)
fmt.Println(bestParams, bestAnswer)
// Prints: 6, [0, 0, 0]
// Solve again with verbose mode on
cfg.NumTests = 1
simplegradient.Verbose = true
bestParams, bestAnswer := simplegradient.Minimize(cfg)
}
The solver takes the standard numerical model approach of:
NumTests
)Each of the N tests runs on its own goroutine for efficent use of system resources.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.