This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Query on GoogleImageSearch and install resulted images by scraping. | |
To use this script install mechanize and BeautifulSoup packages as | |
easy_install mechanize | |
easy_install Beautiful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Query on GoogleImageSearch and install resulted images by scraping. | |
To use this script install mechanize and BeautifulSoup packages as | |
easy_install mechanize | |
easy_install Beautiful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [] = sample_neg_examples(ROOT_PATH, num_sample, OUTPUT_PATH) | |
SEARCH_PATH = fullfile(ROOT_PATH,'**','*'); | |
SAVE_PATH = 'neg_examples' | |
paths = rdir(SEARCH_PATH); | |
if exist('OUTPUT_PATH','var') | |
SAVE_PATH = OUTPUT_PATH; | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ~exist('vlfeat', 'dir') | |
from = 'http://www.vlfeat.org/download/vlfeat-0.9.13-bin.tar.gz' ; | |
fprintf('Downloading vlfeat from %s\n', from) ; | |
untar(from, 'data') ; | |
movefile('data/vlfeat-0.9.13', 'vlfeat') ; | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ res ] = ie505_hw1( n,a,b ) | |
%İE505_HW1 Summary of this function goes here | |
% Detailed explanation goes here | |
[~,bins]= hist([a,b],1000); | |
r =unique( round( n*bins)); | |
res = arrayfun(@(x)nchoosek(n,x)*double(1/(2^n)),r); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
split a file into two randomly, line by line. | |
Usage: split.py <input file> <output file 1> <output file 2> [<probability of writing to the first file>] [<random seed>]' | |
''' | |
import csv | |
import sys | |
import random | |
input_file = sys.argv[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def linear_model_ensemble(X, y, X_test, fold_num, fold_num_sec, grid_search_range, oobe=True, x_val=True ): | |
''' | |
X - Train set | |
y - Train set labels with. Labels are 1 for pos instances and -1 for neg instances | |
fold_num1 - Fold size for the first step X-validation to set the hyper-params | |
and feature selectors | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from HTMLParser import HTMLParser | |
class MLStripper(HTMLParser): | |
def __init__(self): | |
self.reset() | |
self.fed = [] | |
def handle_data(self, d): | |
self.fed.append(d) | |
def get_data(self): | |
return ''.join(self.fed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy | |
import theano | |
import theano.tensor as T | |
from theano import function, config, shared, sandbox | |
from theano import ProfileMode | |
from sklearn import cluster, datasets | |
import matplotlib.pyplot as plt | |
def rsom(data, cluster_num, alpha, epochs = -1, batch = 1, verbose = False): |