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 | |
from hashlib import sha256 | |
def coprime(a, b): | |
while b != 0: | |
a, b = b, a % b | |
return a | |
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 csv | |
import random | |
import math | |
import operator | |
from time import time | |
def loadDataset(filename, divFactor, trainData=[] , testData=[]): | |
with open(filename, 'r') as csvfile: | |
lines = csv.reader(csvfile) | |
dataset = list(lines) |