Skip to content

Instantly share code, notes, and snippets.

@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@VikParuchuri
VikParuchuri / sentiment_plot.R
Created June 18, 2012 16:12
Generate Sentiment Plot
term<-c("egypt","jordan","israel","saudi")
term_vec<-foreach(i=1:length(all_score_frames),.combine=rbind) %do%
{
score_row<-rep(0,length(term))
for(z in 1:length(score_row))
{
sel_score<-all_score_frames[[i]][all_score_frames[[i]]$term==term[z],"score"]
sel_score[is.na(sel_score)]<-0
if(length(sel_score)==0)
sel_score<-0
protected override void OnBarUpdate()
{
if (Historical) return;Enumerable.Range(0,14).ToList().ForEach(i =>DrawText((CurrentBar+i).ToString(),"\u0CA0_\u0CA0",0, i % 2 == 0 ? (Close[0]+TickSize) + (TickSize*i) : (Close[0]-TickSize)-(TickSize*i),i % 2 == 0 ? Color.FromArgb(255 - (i*15),0, 0,255):Color.FromArgb(255 - (i*15),255, 0,0)));
}
@DexterHaslem
DexterHaslem / gist:3085590
Created July 10, 2012 19:13
NinjaTrader create Indicator type @ runtime
using System;
using System.ComponentModel;
namespace NinjaTrader.Indicator
{
[Description("f")]
public class derp : Indicator
{
IndicatorBase myEMA;
protected override void Initialize()
@adrn
adrn / scatterplotmatrix.py
Created April 3, 2013 13:25
Make a scatter-plot matrix with matplotlib
# coding: utf-8
""" Create a scatter-plot matrix using Matplotlib. """
from __future__ import division, print_function
__author__ = "adrn <[email protected]>"
# Standard library
import os, sys
@ryanseys
ryanseys / passer_rating.py
Created April 6, 2013 22:30
Calculates the Passer Rating (passer efficiency or pass efficiency) of a player given some variables. Use at own risk, old-as-fuck code here.
# This Python application will calculate the passer rating
# (passer efficiency or pass efficiency) given the five required variables.
#
# Variables to be used as values are defined below. Set to strings so input
# can be anything. Later the strings will be converted to numbers, given
# they pass a series of error checking tests.
COMP = "null"
ATT = "null"
YARDS = "null"
@Zardoz89
Zardoz89 / adm.py
Created August 10, 2013 13:15
Adaptative Delta Modulation coding example in Python 3
#!/usr/bin/env python3
import array
BYTES = 2 # N bytes arthimetic
MAX = 2 ** (BYTES * 8 - 1) - 1
MIN = - (2 ** (BYTES * 8 - 1)) + 1
CHUNK= 1024
@amintos
amintos / tf512.py
Created September 6, 2013 01:54
Simple string encryption and decryption in pure Python using Threefish-512. No guarantee this implementation is 100% correct!
#
# Simple Pure-Python Threefish-512 Encryption.
# (No guarantee that this implementation is 100% correct!)
#
# Use encrypt(text, key) and decrypt(text, key) for string encryption.
#
# The cipher operates in CBC mode with a random tweak value.
#
from StringIO import StringIO
@paulgb
paulgb / binom_interval.py
Created September 19, 2013 17:58
Compute two-sided binomial confidence interval in Python. Based on R's binom.test.
from scipy.stats import beta
def binom_interval(success, total, confint=0.95):
quantile = (1 - confint) / 2.
lower = beta.ppf(quantile, success, total - success + 1)
upper = beta.ppf(1 - quantile, success + 1, total - success)
return (lower, upper)
@aflaxman
aflaxman / 2013_10_07_bootstrap_SIDS.ipynb
Created October 7, 2013 17:44
Bootstrap resampling with Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.