A library to perform function approximation.
Implementation of Function.prototype.bind
Set a function's length property
Determine if a function is a native generator function.
Set a function's name property
Determine if a function is a native async function.
Callback wrapping utility
Apply ES2015 function.name semantics to all functions
Helper to wrap functions inside a function call.
Run a function exactly one time
A cross browser microtask library
A function that returns the normally hidden `AsyncFunction` constructor
simplified stream construction
A function that returns the normally hidden `GeneratorFunction` constructor
The Node.js `util.deprecate()` function with browser support
A small polyfill for Object.setprototypeof
Rename destructuring parameter to workaround https://bugs.webkit.org/show_bug.cgi?id=220517
AST utils for webassemblyjs
random bytes from browserify stand alone
Helper function to change the property 'name' of every function
process.nextTick but always with args
Use node's fs.realpath, but fall back to the JS implementation if the native one fails
Resolve any installed ES6 compatible promise
Get callsites from the V8 stack trace API
Newton's method works best when you have a reasonable first guess, while bisection is a better choice when your first guess may be far away (or near a zero slope).
AgNet is a 2 Layer feed forward neural network with backpropogation for training. Can be used to approximate many functions and is useful for classification tasks such as character recognition.
Computes approximation within a given error_limit to the values of a root of an arbitrary function f(x) or to the value of inverse function g(y) = x. Uses Newton-Raphson or Secant methods. Requires one (Newton-Raphson) or two (Secant) estimates of the target value. Raises NoConvergenceError when it does not converge within the set error_limit, on set number of iterations.
DEPRECATED: The MyWeather2 API that this gem depends on has been shut down since approximately 2020. All API calls will fail. This gem is no longer functional. Please migrate to one of these actively maintained alternatives: - open-meteo (https://open-meteo.com/) — free, no API key required - openweathermap (https://openweathermap.org/) — free tier available The gem will emit a deprecation warning on each use. Original purpose: fetched current weather conditions and multi-day forecasts by geographic coordinates (latitude/longitude) using the MyWeather2 API, for overlay alongside Google Maps in Rails applications.
== DESCRIPTION: Charlie is a library for genetic algorithms (GA) and genetic programming (GP). == FEATURES: - Quickly develop GAs by combining several parts (genotype, selection, crossover, mutation) provided by the library. - Sensible defaults are provided with any genotype, so often you only need to define a fitness function. - Easily replace any of the parts by your own code. - Test different strategies in GA, and generate reports comparing them. Example report: http://charlie.rubyforge.org/example_report.html == INSTALL: * sudo gem install charlie == EXAMPLES: This example solves a TSP problem (also quiz #142): N=5 CITIES = (0...N).map{|i| (0...N).map{|j| [i,j] } }.inject{|a,b|a+b} class TSP < PermutationGenotype(CITIES.size) def fitness d=0 (genes + [genes[0]]).each_cons(2){|a,b| a,b=CITIES[a],CITIES[b] d += Math.sqrt( (a[0]-b[0])**2 + (a[1]-b[1])**2 ) } -d # lower distance -> higher fitness. end use EdgeRecombinationCrossover, InversionMutator end Population.new(TSP,20).evolve_on_console(50) This example finds a polynomial which approximates cos(x) class Cos < TreeGenotype([proc{3*rand-1.5},:x], [:-@], [:+,:*,:-]) def fitness -[0,0.33,0.66,1].map{|x| (eval_genes(:x=>x) - Math.cos(x)).abs }.max end use TournamentSelection(4) end Population.new(Cos).evolve_on_console(500)