Quipu, a simple Nelder Mead solver in F#
Mathias Brandewinder Blog
by Mathias Brandewinder
1M ago
Some time back, I wrote a small post digging into the mechanics behind the Nelder Mead solver. As it turns out, I had a use for it recently, and after copy-pasting my own code a few times, I figured it would make my life easier to turn that into a NuGet package, Quipu. So what does it do, and why might you care? A code example might be the quickest explanation here. Suppose that, for whatever reason, you were interested in the function f(x) = x ^ 2, and wanted to know for what value of x this function reaches its minimum. That is easy to solve with the Quipu Nelder-Mead solver: open Quipu op ..read more
Visit website
Simulating the Wrapinator 5000
Mathias Brandewinder Blog
by Mathias Brandewinder
6M ago
It is that time of the year again! The holidays are approaching, and the F# Advent calendar is in full swing. My contribution this year might not be for the broadest audience, sorry about that :) But if you are into F#, probability theory, and numeric optimization, this post is for you - hope you enjoy it! And big shout out to Sergey Tihon for making this happen once again. You can find the full code for this post here on GitHub. With the Holidays approaching, Santa Claus, CEO of the Santa Corp, was worried. In preparation for the season’s spike in activity, Santa had invested in the top-o ..read more
Visit website
The Elves Factory
Mathias Brandewinder Blog
by Mathias Brandewinder
6M ago
It is that time of the year again! The holidays are approaching, and the F# Advent calendar is in full swing. My contribution this year might not be for the broadest audience, sorry about that :) But if you are into F#, probability theory, and numeric optimization, this post is for you - hope you enjoy it! And big shout out to Sergey Tihon for making this happen once again. You can find the full code for this post here on GitHub. With the Holidays approaching, Santa Claus, CEO of the Santa Corp, was worried. In preparation for the season’s spike in activity, Santa had invested in the top-o ..read more
Visit website
Maximum Likelihood Estimation of Weibull reliability with DiffSharp
Mathias Brandewinder Blog
by Mathias Brandewinder
9M ago
This post is a continuation of my exploration of DiffSharp, an F# Automatic Differentiation library. In the previous post, I covered some introductory elements of Maximum Likelihood Estimation, through a toy problem, estimating the likelihood that a sequence of heads and tails had been generated by a fair coin. In this post, I will begin diving into the real-world problem that motivated my interest. The general question I am interested in is about reliability. Imagine that you have a piece of equipment, and that from time to time, a component of that piece of equipment experiences failures. Wh ..read more
Visit website
First look at the new DiffSharp
Mathias Brandewinder Blog
by Mathias Brandewinder
10M ago
This post is intended as an exploration of DiffSharp, an Automatic Differentiation, or autodiff F# library. In a nutshell, autodiff allows you to take a function expressed in code - in our case, in F# - and convert it in an F# function that can be differentiated with respect to some parameters. For a certain niche population, people who care about computing gradients, this is very powerful. Basically, you get gradient descent, a cornerstone of machine learning, for free. DiffSharp has been around for a while, but has undergone a major overhaul in the recent months. I hadn’t had time to check i ..read more
Visit website
Breaking down the Nelder Mead algorithm
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
The Nelder-Mead algorithm is a classic numerical method for function minimization. The goal of function minimization is to find parameter values that minimize the value of some function. That description might sound abstract, but it deals with a very practical and common problem. For the Excel fans out there, the Goal Seek function is a concrete example of what function minimization is about. You want Excel to find values that make another cell equal to some value. This is a minimization problem: you are trying to make the difference between the calculated value and the target value as small a ..read more
Visit website
5 obscure charting tips with Plotly.NET
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
For the longest time, my go-to charting library for data exploration in F# was XPlot. It did what I wanted, mostly: create “standard” charts using Plotly to visualize data and explore possible interesting patterns. However, from time to time, I would hit limitations, preventing me from using some of the more advanced features available in Plotly. Fortunately, there is a new game in town with Plotly.NET. Thanks to the wonderful work of @kMutagene and contributors, we can now create a very wide range of charts in .NET, via Plotly.js. At that point, I have made the switch to Plotly.NET. In this p ..read more
Visit website
Picking from Random Tables
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
Once again, I started a weekend project on a minor problem that ended up being more involved than expected. This time, the topic is random tables. Random tables are used often in role playing games, to create random items or ideas on the fly, based on a dice roll. The process of rolling physical dice is fun, but can be slow, so I started coding some of these random tables to help me keep the flow going during games. As an example, this page creates “random citizens” you might encounter in the fictional city of Doskvol. Every roll will produce a new citizen, like this one for instance: In gene ..read more
Visit website
Playing Audio with an F# Discord bot
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
This post is a follow up to that one. As mentioned earlier, my overarching goal is to build a Discord bot to help play “atmosphere” soundtracks during D&D games. Last time, we went over creating a simple Discord bot in F# to support basic text commands. This time, we’ll add sound. How it works overall Our application builds on what we did last time. We will use DSharpPlus to create a console application that exposes commands we can trigger from a Discord server. The part we need to add is a way to stream sound to Discord. To do that, we will use Lavalink, a java program that supports searc ..read more
Visit website
Create a basic Discord bot in F#
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
I have been using Discord a lot lately, mainly because I needed a space to meet for role-playing games remotely during the Black Plague. One nice perk of Discord is its support for bots. In particular, I used a bot called Groovy, which allowed streaming music from various sources like YouTube during games, and was great to set the tone for epic moments in a campaign. Unfortunately, Groovy wasn’t complying with the YouTube terms of service, and fell to the ban hammer. No more epic music for my epic D&D encounters :( As the proverb goes, “necessity is the mother of invention”. If there is no ..read more
Visit website

Follow Mathias Brandewinder Blog on Feedspot

Continue with Google
Continue with Apple
OR