This file contains 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 __future__ import division | |
import numpy as np | |
import math, pdb | |
from sklearn import linear_model | |
#http://stackoverflow.com/questions/17784587/gradient-descent-using-python-and-numpy | |
def genData(numPoints, bias, variance): |
This file contains 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 random, pdb | |
from pprint import pprint | |
import pandas as pd, numpy as np | |
import sklearn | |
from sklearn.cluster import KMeans | |
labels = {0 : 'apple', 1 : 'banana'} | |
input = [ |
This file contains 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 __future__ import division | |
from pprint import pprint | |
import numpy as np | |
import pandas as pd | |
from sklearn.neighbors import KNeighborsClassifier | |
#References - http://saravananthirumuruganathan.wordpress.com/2010/05/17/a-detailed-introduction-to-k-nearest-neighbor-knn-algorithm/ | |
#http://www.saedsayad.com/k_nearest_neighbors.htm | |
input = [ |
This file contains 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 dataMunge, pdb | |
from sklearn import linear_model | |
input = [ | |
[95, 85], | |
[85, 95], | |
[80, 70], | |
[70, 65], | |
[60, 70] |
This file contains 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 math | |
from pprint import pprint | |
import pdb | |
#Linearly separable | |
_or = { | |
'X': [[0,0],[0,1],[1,0],[1,1]], |
This file contains 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
package com.example.kNearestNeighbor; | |
//To use third party libraries simply download the jar | |
//and put it in the Program Files/jre/jdk#.#(version number)/lib/ext for example | |
//Can get the jar file for guava at https://code.google.com/p/guava-libraries/ | |
import com.google.common.base.Functions; | |
import com.google.common.collect.Ordering; | |
//Can get the apache commons math file at |
This file contains 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
package NeuralNetwork; | |
import org.apache.commons.lang3.*; | |
import org.apache.commons.math3.linear.*; | |
import org.apache.commons.math3.stat.StatUtils; | |
import javax.swing.*; | |
import java.util.*; | |
/** |
This file contains 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
package KMeans; | |
import org.apache.commons.lang3.ArrayUtils; | |
import org.apache.commons.math3.linear.MatrixUtils; | |
import org.apache.commons.math3.linear.RealMatrix; | |
import org.apache.commons.math3.linear.RealVector; | |
import org.apache.commons.math3.stat.StatUtils; | |
import java.lang.reflect.Array; | |
import java.util.*; |
This file contains 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 __future__ import division | |
import pandas as pd, numpy as np,datafile,math,pdb,itertools | |
from pprint import pprint | |
from collections import Counter | |
#Will need to import datafile.py and correct dataset for this program | |
class naiveBayes: | |
def __init__(self,name='play', testSize=0): | |
This file contains 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 urllib2, pandas as pd | |
d = { | |
'mushroom' :{ | |
'features': [ | |
'class','cap-shape', 'cap-surface', 'cap-color', | |
'bruises?','odor','gill-attachment', |
OlderNewer