Blood Pressure | Age | Tachycardia | Decision |
---|---|---|---|
110 | 50 | 1 | 0 |
119 | 36 | 0 | 0 |
82 | 72 | 0 | 1 |
81 | 70 | 0 | 1 |
56 | 50 | 1 | 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
from google.colab import files | |
uploaded = files.upload() | |
## test.csv(application/vnd.ms-excel) - 28629 bytes, last modified: 11/12/2019 - 100% done | |
## train.csv(application/vnd.ms-excel) - 61194 bytes, last modified: 11/12/2019 - 100% done | |
import io | |
train = pd.read_csv(io.BytesIO(uploaded['train.csv'])) | |
test = pd.read_csv(io.BytesIO(uploaded['test.csv'])) |
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 pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt |
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
class DecisionNode(Node): | |
def __init__(self,label,distr,threshold ,left = None,right = None): | |
Node.__init__(self,label,left,right) | |
self.threshold = threshold | |
self.distr = distr | |
def __str__(self): | |
L = self.linearize() | |
s = "" | |
for e in L: | |
s += "IF " |
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
class Node: | |
def __init__(self,val,leftNote = None, rightNode = None): | |
self.label = val | |
self.left = leftNote | |
self.right = rightNode | |
def isLeaf(self): | |
return self.left == None and self.right == None | |
def __str__(self): | |
if self.isLeaf(): | |
return "Node({})".format(self.label) |
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 iterative_factorial(n): | |
f = 1 | |
for i in range(2, n+1): | |
f *= i | |
return f |
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 recursive_factorial(n): | |
if n <= 1: | |
return 1 | |
else: | |
return n*recursive_factorial(n-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 recursive_factorial(n): | |
return n*recursive_factorial(n-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
# 1) conventional syntax: | |
dict1={} | |
for user in Users: | |
dict1.update({user['name']:user['salary']}) | |
print (dict1) #>>> {'Ahmed': 1200, 'Aziz': 1800, 'Khelifi': 820} | |
# 2) Dict comprehesion: | |
dict2 = {user['name'] : user['salary'] for user in Users } | |
print(dict2) #>>> {'Ahmed': 1200, 'Aziz': 1800, 'Khelifi': 820} |
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
# 1) conventional syntax: | |
dict1={} | |
for user in Users: | |
dict1.update({user['name']:user['salary']}) | |
print (dict1) #>>> {'Ahmed': 1200, 'Aziz': 1800, 'Khelifi': 820} | |
# 2) Dict comprehesion: | |
dict2 = {user['name'] : user['salary'] for user in Users } | |
print(dict2) #>>> {'Ahmed': 1200, 'Aziz': 1800, 'Khelifi': 820} |