Skip to content

Instantly share code, notes, and snippets.

p=3
m=1000
def stringHash(txt):
# print len(txt)
txtHashList = [0L] * (len(txt) - 100)
for i in xrange(0, 100):
# print i
txtHashList[0] += ord(txt[i])*(p**i)
import numpy as np
import pandas as pd
from sklearn import preprocessing
class decisionnode:
def __init__(self,col=-1,value=None,results=None,tb=None,fb=None):
self.col=col
self.value=value
self.results=results
self.tb=tb
@annanay25
annanay25 / learn.py
Last active October 22, 2019 14:45
Backpropagation implementation in Python.
#Backpropagation algorithm written in Python by annanay25.
import string
import math
import random
class Neural:
def __init__(self, pattern):
#
# Lets take 2 input nodes, 3 hidden nodes and 1 output node.
# Hence, Number of nodes in input(ni)=2, hidden(nh)=3, output(no)=1.