Ritchie Vink
https://www.ritchievink.com/
Recent content on Ritchie VinkHugo -- gohugo.ioen-ENritchie46@gmail.com (Ritchie Vink)ritchie46@gmail.com (Ritchie Vink)(c) 2019 Ritchie Vink.Mon, 10 Jun 2019 00:00:00 +0000Bayesian inference; How we are able to chase the Posterior
https://www.ritchievink.com/blog/2019/06/10/bayesian-inference-how-we-are-able-to-chase-the-posterior/
Mon, 10 Jun 2019 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2019/06/10/bayesian-inference-how-we-are-able-to-chase-the-posterior/Bayesian modeling! Every introduction on that topic starts with a quick conclusion that finding the posterior distribution often is computationally intractable. Last post I looked at Expectation Maximization, which is a solution of this computational intractability for a set of models. However, for most models, it isn’t. This post I will take a formal definition of the problem (As I’ve skipped that in the Expectation Maximization post) and we’ll look at two solutions that help us tackle this problem; Markov Chain Monte Carlo and Variational Inference.Algorithm Breakdown: Expectation Maximization
https://www.ritchievink.com/blog/2019/05/24/algorithm-breakdown-expectation-maximization/
Fri, 24 May 2019 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2019/05/24/algorithm-breakdown-expectation-maximization/I wanted to learn something about variational inference, a technique used to approximate the posterior distribution in Bayesian modeling. However, during my research, I bounced on quite some mathematics that led me to another optimization technique called Expectation Maximization. I believe the theory behind this algorithm is a stepping stone to the mathematics behind variational inference. So we tackle the problems one problem at a time!Fully automated soil classification with a Convolutional Neural Network and Location embeddings
https://www.ritchievink.com/blog/2019/04/02/fully-automated-soil-classification-with-a-convolutional-neural-network-and-location-embeddings/
Tue, 02 Apr 2019 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2019/04/02/fully-automated-soil-classification-with-a-convolutional-neural-network-and-location-embeddings/Soil classification is, in practice, a human process. A geotechnical engineer interprets results from a Cone Penetration Test and comes up with a plausible depiction of the existing soil layers. These interpretations will often be used throughout a project and are input for many following calculations.
Just as the poliovirus, the process of manually mapping data from $x$ to $y$, belongs to the list of things that humanity tries to eradicate from earth.Save some time: Embedding jupyter notebook in an iframe and serve as a reverse proxy behind NGINX
https://www.ritchievink.com/blog/2019/03/17/save-some-time-embedding-jupyter-notebook-in-an-iframe-and-serve-as-a-reverse-proxy-behind-nginx/
Sun, 17 Mar 2019 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2019/03/17/save-some-time-embedding-jupyter-notebook-in-an-iframe-and-serve-as-a-reverse-proxy-behind-nginx/Embedding Jupyter notebook/ lab on your website can be done by embedding it in an iframe. However, it takes some configurational quirks to get it done. For my purpose, I also needed to offload validation to another service on the backend. Both the validation server as the jupyter notebook server were proxied behind an NGINX server. Here is the configuration.
NGINX setup In the configuration, we set two upstream servers.An intuitive introduction to Gaussian processes
https://www.ritchievink.com/blog/2019/02/01/an-intuitive-introduction-to-gaussian-processes/
Fri, 01 Feb 2019 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2019/02/01/an-intuitive-introduction-to-gaussian-processes/Christopher Fonnesbeck did a talk about Bayesian Non-parametric Models for Data Science using PyMC3 on PyCon 2018. In this talk, he glanced over Bayes’ modeling, the neat properties of Gaussian distributions and then quickly turned to the application of Gaussian Processes, a distribution over infinite functions. Wait, but what?! How does a Gaussian represent a function? I did not understand how, but the promise of what these Gaussian Processes representing a distribution over nonlinear and nonparametric functions really intrigued me and therefore turned into a new subject for a post.Algorithm breakdown: Why do we call it Gradient Boosting?
https://www.ritchievink.com/blog/2018/11/19/algorithm-breakdown-why-do-we-call-it-gradient-boosting/
Mon, 19 Nov 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/11/19/algorithm-breakdown-why-do-we-call-it-gradient-boosting/We were making a training at work about ensemble models. When we were discussing different techniques like bagging, boosting, and stacking, we also came on the subject of gradient boosting. Intuitively, gradient boosting, by training on the residuals made sense. However, the name gradient boosting did not right away. This post we are exploring the name of gradient boosting and of course also the model itself!Build Facebook's Prophet in PyMC3; Bayesian time series analyis with Generalized Additive Models
https://www.ritchievink.com/blog/2018/10/09/build-facebooks-prophet-in-pymc3-bayesian-time-series-analyis-with-generalized-additive-models/
Tue, 09 Oct 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/10/09/build-facebooks-prophet-in-pymc3-bayesian-time-series-analyis-with-generalized-additive-models/Last Algorithm Breakdown we build an ARIMA model from scratch and discussed the use cases of that kind of models. ARIMA models are great when you have got stationary data and when you want to predict a few time steps into the future. A lot of business data, being generated by human processes, have got weekly and yearly seasonalities (we for instance, seem work to less in weekends and holidays) and show peaks at certain events.Algorithm Breakdown: AR, MA and ARIMA models
https://www.ritchievink.com/blog/2018/09/26/algorithm-breakdown-ar-ma-and-arima-models/
Wed, 26 Sep 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/09/26/algorithm-breakdown-ar-ma-and-arima-models/Time series are a quite unique topic within machine learning. In a lot of problems the dependent variable $y$, i.e. the thing we want to predict is dependent on very clear inputs, such as pixels of an image, words in a sentence, the properties of a persons buying behavior, etc. In time series these indepent variables are often not known. For instance, in stock markets, we don’t have a clear independent set of variables where we can fit a model on.Deploy any machine learning model serverless in AWS
https://www.ritchievink.com/blog/2018/09/16/deploy-any-machine-learning-model-serverless-in-aws/
Sun, 16 Sep 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/09/16/deploy-any-machine-learning-model-serverless-in-aws/When a machine learning model goes into production, it is very likely to be idle most of the time. There are a lot of use cases, where a model only needs to run inference when new data is available. If we do have such a use case and we deploy a model on a server, it will eagerly be checking for new data, only to be disappointed for most of its lifetime and meanwhile you pay for the live time of the server.Generative Adversarial Networks in Pytorch: The distribution of Art
https://www.ritchievink.com/blog/2018/07/16/generative-adversarial-networks-in-pytorch-the-distribution-of-art/
Mon, 16 Jul 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/07/16/generative-adversarial-networks-in-pytorch-the-distribution-of-art/Generative adversarial networks seem to be able to generate amazing stuff. I wanted to do a small project with GANs and in the process create something fancy for on the wall. Therefore I tried to train a GAN on a dataset of art paintings. This post I’ll explore if I’ll succeed in getting a full hd new Picasso on the wall. The pictures above give you a glimplse of some of the results from the model.Clustering data with Dirichlet Mixtures in Edward and Pymc3
https://www.ritchievink.com/blog/2018/06/05/clustering-data-with-dirichlet-mixtures-in-edward-and-pymc3/
Tue, 05 Jun 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/06/05/clustering-data-with-dirichlet-mixtures-in-edward-and-pymc3/Last post I’ve described the Affinity Propagation algorithm. The reason why I wrote about this algorithm was because I was interested in clustering data points without specifying k, i.e. the number of clusters present in the data.
This post continues with the same fascination, however now we take a generative approach. In other words, we are going to examine which models could have generated the observed data. Through bayesian inference we hope to find the hidden (latent) distributions that most likely generated the data points.Algorithm Breakdown: Affinity Propagation
https://www.ritchievink.com/blog/2018/05/18/algorithm-breakdown-affinity-propagation/
Fri, 18 May 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/05/18/algorithm-breakdown-affinity-propagation/On a project I worked on at the ANWB (Dutch road side assistence company) we mined driving behavior data. We wanted to know how many persons were likely to drive a certain vehicle on a regular basis. Naturally k-means clustering came to mind. The k-means algorithm finds clusters with the least inertia for a given k.
A drawback is that often, k is not known. For the question about the numbers of persons driving a car, this isn’t that big of a problem as we have a good estimate of what k should be.Transfer learning with Pytorch: Assessing road safety with computer vision
https://www.ritchievink.com/blog/2018/04/12/transfer-learning-with-pytorch-assessing-road-safety-with-computer-vision/
Thu, 12 Apr 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/04/12/transfer-learning-with-pytorch-assessing-road-safety-with-computer-vision/For a project at Xomnia, I had the oppertunity to do a cool computer vision assignment. We tried to predict the input of a road safety model. Eurorap is such a model. In short, it works something like this. You take some cars, mount them with cameras and drive around the road you’re interested in. The ‘Google Streetview’ like material you’ve collected is sent to a crowdsourced workforce (at Amazon they are called Mechanical Turks) to manually label the footage.Computer build me a bridge
https://www.ritchievink.com/blog/2018/01/14/computer-build-me-a-bridge/
Sun, 14 Jan 2018 00:00:00 +0000ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2018/01/14/computer-build-me-a-bridge/In earlier posts I’ve analyzed simple structures with a Python fem package called anaStruct. And in this post I’ve used anaStruct to analyze a very non linear roof ponding problem.
Modelling a structure in Python may seem cumbersome in relation to some programs that offer a graphical user interface. For simple structures this may well be the case. However now we’ve got a simple way to programmatically model 2D structures, I was wondering if we could let a computer model these structures for us.Implementing a Support Vector Machine in Scala
https://www.ritchievink.com/blog/2017/11/27/implementing-a-support-vector-machine-in-scala/
Mon, 27 Nov 2017 16:14:21 +0100ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/11/27/implementing-a-support-vector-machine-in-scala/This post describes the implementation of a linear support vector machine classifier (SVM) in Scala. Scala is a functional programming language that supports functional programming to a far extend. Because I am exploring Scala at the moment and I like the challenge of functional programming, the SVM will be implemented in a functional manner. We are going to test the SVM on two classes from the Iris dataset.A nonlinear water accumulation analysis in Python
https://www.ritchievink.com/blog/2017/08/23/a-nonlinear-water-accumulation-analysis-in-python/
Wed, 23 Aug 2017 13:07:00 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/08/23/a-nonlinear-water-accumulation-analysis-in-python/Frames One of my first packages in Python is a program for analysing 2D Frames called anaStruct. I wrote this in the summer of 2016 and learned a lot by doing so. When it was ‘finished’ I was really enthusiastic and eager to give it some purpose in the ‘real’ engineering world.
My enthusiasm wasn’t for long though. I wrote a fem package that can compute linear force lines. The real world however isn’t so linear.Programming a neural network from scratch
https://www.ritchievink.com/blog/2017/07/10/programming-a-neural-network-from-scratch/
Mon, 10 Jul 2017 12:11:12 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/07/10/programming-a-neural-network-from-scratch/Intro At the moment of writing this post it has been a few months since I’ve lost myself in the concept of machine learning. I have been using packages like TensorFlow, Keras and Scikit-learn to build a high conceptual understanding of the subject. I did understand intuitively what the backpropagation algorithm and the idea of minimizing costs does, but I hadn’t programmed it myself. Tensorflow is regarded as quite a low level machine learning package, but it still abstracts the backpropagation algorithm for you.Deep learning music classifier part 2. Computer says no!
https://www.ritchievink.com/blog/2017/06/04/deep-learning-music-classifier-part-2.-computer-says-no/
Sun, 04 Jun 2017 14:08:34 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/06/04/deep-learning-music-classifier-part-2.-computer-says-no/Recap Last post I described what my motivations were to start building a music classifier, or at least attempt to build one. The post also described how I collected a dataset, extracted important features and clustered the data based on their variance. You can read the previous post here.
This post describes how I got my feet wet with classifying music. Spotify kind of sorted the data I’ve downloaded by genre.Deep learning music classifier part 1. 30 seconds disco!
https://www.ritchievink.com/blog/2017/05/12/deep-learning-music-classifier-part-1.-30-seconds-disco/
Fri, 12 May 2017 16:34:27 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/05/12/deep-learning-music-classifier-part-1.-30-seconds-disco/Introduction As a nerd I am fascinated by the deep learning hype. Out of interest I have been following some courses, reading blogs and watched youtube video’s about the topic. Before diving into the content, I really thought this was something solely for the great internet companies and that it was not a subject us mortals could understand.
While reading and learning more about it I’ve come to the insight that making use of deep learning techniques is not only something the internet giants and scientists can do.What should be explained in the Dutch SBR-B Guideline!
https://www.ritchievink.com/blog/2017/05/07/what-should-be-explained-in-the-dutch-sbr-b-guideline/
Sun, 07 May 2017 20:27:28 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/05/07/what-should-be-explained-in-the-dutch-sbr-b-guideline/The Dutch SBR guideline is intended to help you process vibration data and help you determine when a vibration signal can cause discomfort to persons. It seems to me however, that the SBR-B guideline does not have the intention to be understood. They seem to help you by making a super abstract of scientific papers and by giving you a few keywords so you can Google it yourself.
This post will elaborate on two formula’s given in the guideline.Understanding the Fourier Transform by example
https://www.ritchievink.com/blog/2017/04/23/understanding-the-fourier-transform-by-example/
Sun, 23 Apr 2017 13:07:00 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/04/23/understanding-the-fourier-transform-by-example/In the last couple of weeks I have been playing with the results of the Fourier Transform and it has quite some interesting properties that initially were not clear to me. In this post I summarize the things I found interesting and the things I’ve learned about the Fourier Transform.
Application The Fourier Transformation is applied in engineering to determine the dominant frequencies in a vibration signal. When the dominant frequency of a signal corresponds with the natural frequency of a structure, the occurring vibrations can get amplified due to resonance.Writing a fourth order Runga Kutta solver for a vibrations problem in Python (Part 1)
https://www.ritchievink.com/blog/2017/04/13/writing-a-fourth-order-runga-kutta-solver-for-a-vibrations-problem-in-python-part-1/
Thu, 13 Apr 2017 13:02:56 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/04/13/writing-a-fourth-order-runga-kutta-solver-for-a-vibrations-problem-in-python-part-1/Problem If you want to solve a vibrations problem with a force acting on the system you often need to find the solution in nummerical algorithms. Say you have got a single degree of freedom mass spring system as shown in the figure below.
SDOF damped mass spring system
The differential equation of this system is:
\[ mu'' + cu' + ku = F\] When the force that acts on the system is a function, this problem can be solved with symbolical maths by solving the differential equation.Writing a fourth order Runga Kutta solver for a vibrations problem in Python (Part 2)
https://www.ritchievink.com/blog/2017/04/13/writing-a-fourth-order-runga-kutta-solver-for-a-vibrations-problem-in-python-part-2/
Thu, 13 Apr 2017 13:02:56 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/04/13/writing-a-fourth-order-runga-kutta-solver-for-a-vibrations-problem-in-python-part-2/This post continues where part 1 ended. In order to increase the accuracy of our function solver we are going to use a 4th order Runga Kutta algorithm. The basics are the same as with the Euler method. However the dy part of the 4th order method is more accurately computed.
Definition The incremental values of this method are defined as:
\[ y_{n+1} = y_{n} + \frac{h}{6}(k_{1} + 2k_{2} +2k_{3} + k_{4})\] \[ t_{n+1} = t_{n} + h \] With the factors k1 - k4 being:Writing a fourth order Runga Kutta solver for a vibrations problem in Python (Part 3)
https://www.ritchievink.com/blog/2017/04/13/writing-a-fourth-order-runga-kutta-solver-for-a-vibrations-problem-in-python-part-3/
Thu, 13 Apr 2017 13:02:56 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/04/13/writing-a-fourth-order-runga-kutta-solver-for-a-vibrations-problem-in-python-part-3/This post continues where part 2 ended. The Runga Kutta algorithm described in last post is only able to solve first order differential equations.
The differential equation (de) for a single mass spring vibrations problem is a second order de.
\[ mu'' + cu' + ku = F\] Note that in this equation:
u” = acceleration a
u’ = velocity v
u = displacement
Before we can solve it with a Runga Kutta algorithm we must rewrite the base equation to a system of two first order ode’s.Python 1D FEM Example 3
https://www.ritchievink.com/blog/2017/03/12/python-1d-fem-example-3/
Sun, 12 Mar 2017 21:35:33 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/03/12/python-1d-fem-example-3/Python 1D FEM Example 3. Simple code example for anaStruct.
# if using ipython notebook %matplotlib inline from anastruct.fem.system import SystemElements # Create a new system object. ss = SystemElements(EA=15000, EI=5000) # Add beams to the system. ss.add_element(location=[[0, 0], [0, 5]]) ss.add_element(location=[[0, 5], [5, 5]]) ss.add_element(location=[[5, 5], [5, 0]]) # Add a fixed support at node 1. ss.add_support_fixed(node_id=1) # Add a rotational spring at node 4. ss.add_support_spring(node_id=4, translation=3, k=4000) # Add loads.Python 1D FEM Example 2
https://www.ritchievink.com/blog/2017/02/12/python-1d-fem-example-2/
Sun, 12 Feb 2017 21:35:33 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/02/12/python-1d-fem-example-2/Example 2: Truss framework Simple code example for anaStruct.
# if using ipython notebook %matplotlib inline import math from anastruct.fem.system import SystemElements # Create a new system object. ss = SystemElements(EA=5000) # Add beams to the system. ss.add_truss_element(location=[[0, 0], [0, 5]]) ss.add_truss_element(location=[[0, 5], [5, 5]]) ss.add_truss_element(location=[[5, 5], [5, 0]]) ss.add_truss_element(location=[[0, 0], [5, 5]], EA=5000 * math.sqrt(2)) # get a visual of the element ID's and the node ID's ss.show_structure() # add hinged supports at node ID 1 and node ID 2 ss.Python 1D FEM Example 1
https://www.ritchievink.com/blog/2017/01/12/python-1d-fem-example-1/
Thu, 12 Jan 2017 21:35:33 +0200ritchie46@gmail.com (Ritchie Vink)https://www.ritchievink.com/blog/2017/01/12/python-1d-fem-example-1/Example 1: Framework Simple code example for anaStruct.
# if using ipython notebook %matplotlib inline from anastruct.fem.system import SystemElements # Create a new system object. ss = SystemElements() # Add beams to the system. ss.add_element(location=[[0, 0], [3, 4]], EA=5e9, EI=8000) ss.add_element(location=[[3, 4], [8, 4]], EA=5e9, EI=4000) # get a visual of the element IDs and the node IDs ss.show_structure() # add loads to the element ID 2 ss.q_load(element_id=2, q=-10) # add hinged support to node ID 1 ss.