Skip to content

Instantly share code, notes, and snippets.

View sushihangover's full-sized avatar

Robert N. sushihangover

View GitHub Profile

Movie Recommendations with k-Nearest Neighbors and Cosine Similarity


Introduction

The k-nearest neighbors (k-NN) algorithm is among the simplest algorithms in the data mining field. Distances / similarities are calculated between each element in the data set using some distance / similarity metric ^[1]^ that the researcher chooses (there are many distance / similarity metrics), where the distance / similarity between any two elements is calculated based on the two elements' attributes. A data element’s k-NN are the k closest data elements according to this distance / similarity.


1. A distance metric measures distance; the higher the distance the further apart the neighbors. A similarity metric measures similarity; the higher the similarity the closer the neighbors.
@sushihangover
sushihangover / TidyJson.py
Created May 8, 2016 18:13
TextWranger Format Filter for Json (~/Library/Application Support/TextWrangler/Text Filters)
#!/usr/bin/python
import fileinput
import json
if __name__ == "__main__":
jsonStr = ''
for aline in fileinput.input():
jsonStr = jsonStr + ' ' + aline.strip()
jsonObj = json.loads(jsonStr)
@sushihangover
sushihangover / xamarinandroidbindings.md
Created April 15, 2016 17:38 — forked from JonDouglas/xamarinandroidbindings.md
Xamarin Android Bindings Troubleshooting

Approaching a Xamarin.Android Bindings Case

1. Investigation

One of the best ways to investigate a problematic Xamarin.Android Binding is to first ensure you have the proper tooling available:

%{
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace MarkdownParser
{
class Counter
{
@sushihangover
sushihangover / AppController.cs
Created January 9, 2016 03:42 — forked from grexican/AppController.cs
Windowless Mac App with MonoMac
using System;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace StatusMenu
{
[Register("AppController")]
public partial class AppController : NSObject
{
public AppController()
@sushihangover
sushihangover / genymotionwithplay.txt
Created January 6, 2016 23:46 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
#!/bin/bash
read -r -d '' script <<'EOF'
on run argv
tell application "iTerm"
activate
set myterm to (make new terminal)
tell myterm
launch session "Default"
tell the last session
repeat with arg in argv
@sushihangover
sushihangover / update_github_issues.sh
Last active August 29, 2015 14:27 — forked from dlo/update_github_issues.sh
Make the default GitHub issue labels a little nicer.
function getpassword() {
# Written for Mac OS X Keychain.
SERVICE=$1
ACCOUNT=$2
security find-internet-password -s $SERVICE -a $ACCOUNT -w | tr -d '\n'
}
function update_github_issues() {
read -p "Enter the repo owner: " OWNER
read -p "Enter the repo name: " REPO
@sushihangover
sushihangover / monodevelop.exe.config
Created July 8, 2015 16:29
monodevelop.exe.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.84.0.0" newVersion="2.84.0.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@sushihangover
sushihangover / startuplog.out
Created July 8, 2015 16:04
monodevelop startup debug output - successful
Mono: Config attempting to parse: '/etc/mono/config'.
Mono: Config attempting to parse: '/home/niteware/.mono/config'.
Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
Mono: Image addref mscorlib[0x1d3d4e0] -> /usr/lib/mono/4.5/mscorlib.dll[0x1d3c9a0]: 2
Mono: AOT module '/usr/lib/mono/4.5/mscorlib.dll.so' not found: /usr/lib/mono/4.5/mscorlib.dll.so: cannot open shared object file: No such file or directory
Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
Mono: AOT: loaded AOT Module for /usr/lib/mono/4.5/mscorlib.dll.
Mono: Assembly Loader loaded assembly from location: '/usr/lib/mono/4.5/mscorlib.dll'.