Practical Machine Learning
http://bkanuka.com/
Recent content on Practical Machine Learning
Hugo  gohugo.io
enus
Copyright © 2017  Bennett Kanuka
Wed, 11 Apr 2018 22:15:50 0400

Box Cli Download
http://bkanuka.com/posts/boxclidownload/
Wed, 11 Apr 2018 22:15:50 0400
http://bkanuka.com/posts/boxclidownload/
I recently needed to download a folder from a shared Box drive programmatically. I also wanted some basic sync ability (only download the file from Box if the file has changed).
Box has created a cli that seems to work in Windows and Mac, but guess what OS I’m using…. ;) Anyway, even if the CLI did work, I’d still need some script to call it. So I wrote my own script to do this.

HDCP HDMI Capture
http://bkanuka.com/posts/hdcphdmicapture/
Tue, 02 Jan 2018 20:16:04 0500
http://bkanuka.com/posts/hdcphdmicapture/
Introduction I’m working on integrating a Chromecast with Kodi. Basically I want Kodi and my HTPC to work as a receiver, and handle all the input switching and video sources. Everything runs through Kodi and my TV is only ever on one input.
Why? Because it gives me more control. I can put Kodi menus over a Chromecast video in the background. I can turn off the TV when it’s not in use, regardless of what input it is on.

Installing Windows 10 in KVM + libvirt
http://bkanuka.com/posts/windows10libvirt/
Thu, 28 Dec 2017 07:51:54 0500
http://bkanuka.com/posts/windows10libvirt/
There’s a few “tricks” that are good to know when installing Windows 10 on kvm/libvirt. This is the way I install a Windows 10 VM and I’ll try to explain each step of the process. I’ll say right away that this may look like a very long post and therefore a long process, but the length is just images and this probably takes about 30 minutes if you chug through it!

Windows VM Launcher
http://bkanuka.com/posts/windowsasanapp/
Mon, 25 Dec 2017 08:22:40 0500
http://bkanuka.com/posts/windowsasanapp/
Create ~/.local/share/applications/windows.desktop with the following content:
[Desktop Entry] Version=1.0 Name=Windows 10 Comment=Starts the Windows 10 VM Exec=bash c 'virsh start Windows10 && virtviewer wait c qemu:///system Windows10 && virsh shutdown Windows10' Icon=windows Type=Application Under Exec change Windows10 to whatever you’ve named your VM. After logging out and back in, you will now have Windows 10 as an “application” that you can run from your launcher (Unity or Gnome Shell or whatever it is).

About
http://bkanuka.com/about/
Sat, 23 Dec 2017 21:16:38 0500
http://bkanuka.com/about/
This is Bennett Kanuka’s personal blog. I work for Lixar I.T. in Ottawa, Canada but any opinions or things I might write are strictly my own.
At Lixar, I helped grow the data science group from 3 employees to over 20 data scientists, engineers, and visualization experts. I have worked in almost every subfield of machine learning and AI.
Sometimes I write about Linux, scripting languages, and other things I find interesting.

Drawing Regular ngons with Horizontal Bottom
http://bkanuka.com/posts/drawingregularngons/
Thu, 17 Apr 2014 00:00:00 +0000
http://bkanuka.com/posts/drawingregularngons/
We start with the unit circle centered at (0,0). The coordinates of any point on the circle are given by: $$ \begin{align*} x &= \cos (t) \\ y &= \sin (t) \end{align*} $$ Therefore we can find the coordinates of the regular ngon at: $$ \begin{align*} x &= \cos \left(k \frac{2 \pi}{n}\right) \\ y &= \sin \left(k \frac{2 \pi}{n}\right) \quad \text{where } k = 0, 1, \ldots n \end{align*} $$

Convert Mathematica Equation to Python
http://bkanuka.com/posts/mathematicatopython/
Tue, 15 Apr 2014 00:00:00 +0000
http://bkanuka.com/posts/mathematicatopython/
I recently used Mathematica to solve a Lagrangian differential equation. I wish I could have used Sage but I was unable to find a simple way to program the EulerLagrange equation into a function. See this bug report. Mathematica on the other hand, came with a reference notebook with the Lagrangian and EL equations builtin.
I solved the equations in Mathematica, but needed to use the resulting equations in Python code.

Native Looking matplotlib Plots in LaTeX
http://bkanuka.com/posts/nativelatexplots/
Tue, 15 Apr 2014 00:00:00 +0000
http://bkanuka.com/posts/nativelatexplots/
I write most of my math/numerical analysis scripts in Python, and I tend to use matplotlib for plotting. When including a matplotlib plot in LaTeX I got the highest quality results by saving the plot as a PDF and using \includegraphics{plot.pdf} in LaTeX. However, it bothered me that the plot had different fonts and font sizes than the rest of the document. Here’s how I fixed that.
Figure Width I always choose the size of my plots as a percentage of the text width.

Random Selection with Average
http://bkanuka.com/posts/randomselectingwithaverage/
Tue, 15 Apr 2014 00:00:00 +0000
http://bkanuka.com/posts/randomselectingwithaverage/
The goal of this project was to “randomly” select numbers from a predefined set, with replacement, in a way that the mean of the selected numbers would equal (or come close to) a specified number. For example, and the original motivation, was to select 100 numbers from the set: $$ X = \left\{0, 0.1, 0.25, 0.5, 0.75, 0.8, 1.0\right\} $$ so that the mean of the selected numbers was $ \approx 0.

img2pdf: Merge and resize images into a PDF
http://bkanuka.com/posts/mergeimagesletterpdf/
Tue, 15 Apr 2014 00:00:00 +0000
http://bkanuka.com/posts/mergeimagesletterpdf/
I was recently emailed a bunch of JPEG files of a scanned document. There was a file for every page, and the image files were very large. I wanted to get them all in a single PDF file on letter size paper. Because I find PDF mystical and difficult to work with, I decided to stick to tools I know  and I know LaTeX.
In no time I learned how to use the ImageMagick tool convert to convert to PDF.