| 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
    
  
  
    
  | 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
    
  
  
    
  | 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
    
  
  
    
  | 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
    
  
  
    
  | 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
    
  
  
    
  | 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
    
  
  
    
  | from vpython import * | |
| scene.title = "Double pendulum" | |
| scene.height = 600 | |
| scene.width = 800 | 
  
    
      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
    
  
  
    
  | g = 9.8 #G force | |
| M1 = 2 #bar 1 mass in kg | |
| M2 = 1 #bar 2 mass in kg | |
| d = 0.05 # thickness of each bar | |
| gap = 2*d # distance between two parts of upper, U-shaped assembly | |
| L1 = 0.5 # physical length of upper assembly; distance between axles | |
| L1display = L1+d # show upper assembly a bit longer than physical, to overlap axle | |
| L2 = 1 # physical length of lower bar | |
| L2display = L2+d/2 # show lower bar a bit longer than physical, to overlap axle | 
  
    
      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
    
  
  
    
  | L = [(1,'Aziz','1980-10-20'),(2,'Khelifi','1990-05-07')] | |
| query = """INSERT INTO Customer | |
| VALUES(?,?,?)""" | |
| c.executemany(query, L) | |
| #executemany is the equivalent of: | |
| for iterable in L: | |
| c.execute(query, iterable) | 
  
    
      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 vpython as vp | |
| vp.scene.title = "Modeling the motion of planets with the gravitational force" | |
| vp.scene.height = 600 | |
| vp.scene.width = 800 |