Overview of Research and Development at H19

Ricardo Trindade
4 min readJul 26, 2016

My name is Ricardo Trindade, and I am part of Hole19’s product team, currently working on research and development. I’d like to tell you a bit more about our challenges in the implementation of some features, namely trendlines which we developed as part of our Hole19 premium offering, as well as Wit.ai which ended up being a discontinued feature unfortunately. Implementing features like these isn’t always easy as sometimes you don’t have access to all the libraries you need as they can be quite expensive for what starts out as experimentation, or because the implementation of such features would introduce a large burden on our backend and make the app experience for our users worse because of performance.

Using Trendlines to predict a golfer’s future:

Trendlines tries to predict your future results based on rounds you have played in the past, they’re really good on motivating you if you are getting better by the day, or they can be a training incentive if you haven’t been playing that well lately. Our goal here at Hole19 is to take the maximum advantage from the data we get from golfers’ rounds to help them constantly improve on the course.

The idea for the computation of a trendline is really simple and requires basic knowledge in linear algebra as the process behind it is just a logarithmic regression. Here’s how we do it in a fast and efficient way without using over complicated formulas.

Consider a golfer’s ‘putting’ scores on their last 20 rounds, and the corresponding dates from those rounds. These values are retrieved from our servers and stored in 20x1 matrices.The dates matrix is transformed by applying the logarithm function to all elements and we add a column of ones to this matrix. It looks something like this.

Recall that the general formula for a logarithmic regression is

y = a ln(x) +b

Our objective here is to find the values for a and b that are more adequate to the golfer’s values. These are easily obtained by computing the pseudo-inverse matrix of A and multiplying it by the scores vector. If this arouses some curiosity then you can take a deeper look at the Least Squares problem in a matricial form.

With the values of a and b we can compute your trendline and return the prediction of what your future score will be in 3 months. The challenge here was finding a Ruby library that performed matrix operations. If you’d like to take a deeper look at it, here’s the link of the library we used:

http://ruby-doc.org/stdlib-2.0.0/libdoc/matrix/rdoc/Matrix.html

Using Wit.ai to create a personal golf assistant:

Wit.ai is a natural language processing API that has the awesome functionalities of converting speech-to-text and to understand intents and entities in the processed text.

An intent can be understood as any action a user wants to take, such as “Add a stroke” or “Finish round”.

Entities are keywords within the sentence, for example “Add a stroke, 4 iron on the green”, 4 iron would be a “club” entity and on the green a “lie” entity. Wit allowed you to define which words are associated to each entity.

The flow for using Wit starts by uploading the audio file to their servers where it is processed, and the result is returned to the app in a form of a JSON Object with fields like ConvertedText, Intents, Entities, Confidence. If a certain intent is present you can execute functions associated to it.

On Hole19 we had the idea of using Wit.ai to develop a personal assistant to help golfers out on the course. Imagine you could open the Hole19 app, start a round and speak to your smartphone telling him to “Mark my shot, Driver fairway hit” and Wit.ai would recognise the intents and entities behind your sentences. Pretty neat!

By doing so, your scores would be noted by Wit without having to interrupt your play by taking your smartphone and inputting them on the app.

The APIs that Wit offers have really powerful capabilities, however there is still a lot of room for improvement on their side, as sometimes the accuracy of conversion from speech to text isn’t quite perfect, and the engine would only convert text in English, so all users that weren’t native speakers wouldn’t be able to use this tool, which is a major letdown for us. If you are interested on how they do conversion from speech-to-text you should look up Neural Networks or Recurrent Neural Networks.

Adding up to this, the SDKs for iOS and Android are maintained by the community and stopped being supported by Wit’s own team which meant that we had to drop the project.

Here at Hole19 we believe in the value of data, and use it not only to decide which features we’d like to build next, but we actually bake it into the actual product as much as we can. Our product was born out of the necessity of helping golfers become data driven, and it really is something that guides our day to day decisions at the company.

Up next, we’ll be working on a friend recommendation algorithm based on numerous factors such as what rounds of golf a user has played, and which golf courses he follows, with the intent of helping the community to come closer together. I hope to be able to tell you all about it soon. :-)

--

--

Ricardo Trindade

Fullstack engineer at Marley Spoon. Keen interest in machine learning, Ruby and Kotlin