Skip to content

Instantly share code, notes, and snippets.

import numpy as np
class Perceptron(object):
""" Perceptron Classifier
Parameters
------------
rate : float
Learning rate (ranging from 0.0 to 1.0)
number_of_iteration : int
@maheshkkumar
maheshkkumar / min-char-rnn.py
Created February 26, 2017 11:55 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@maheshkkumar
maheshkkumar / non_linear_classification.m
Created February 20, 2017 04:44 — forked from egonSchiele/non_linear_classification.m
Non-linear classification example
% my training data.
% so if x > 3 || x < 7, y = 1, otherwise y = 0.
x = 1:100;
y = [0, 0, 0, 1, 1, 1, 1, zeros(1, 93)];
% instead of theta' * x, I'm trying to create
% a non-linear decision boundary.
% So instead of y = theta_0 + theta_1 * x, I use:
function result = h(x, theta)
result = sigmoid(theta(1) + theta(2) * x + theta(3) * ((x - theta(4))^2));
@maheshkkumar
maheshkkumar / logistic_regression_grapefruit.m
Created February 20, 2017 04:44 — forked from egonSchiele/logistic_regression_grapefruit.m
Logistic regression for orange vs grapefruit
% data
x = [1, 2, 3, 4, 5, 6];
y = [0, 0, 0, 1, 1, 1];
% function to calculate the predicted value
function result = h(x, t0, t1)
result = sigmoid(t0 + t1 * x);
end
% sigmoid function
import numpy as np
class Perceptron(object):
""" Perceptron Classifier
Parameters
------------
rate : float
Learning rate (ranging from 0.0 to 1.0)
number_of_iteration : int
import urllib2
from lxml import html
from bs4 import BeautifulSoup
import re
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure, DuplicateKeyError
import datetime
import time
DB_NAME = 'news_aggregator'
import argparse
import re
from multiprocessing.pool import ThreadPool as Pool
import requests
import bs4
root_url = 'http://pyvideo.org'
index_url = root_url + '/category/50/pycon-us-2014'