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
# include <iostream> | |
using namespace std; | |
int page_fault(int el,int pf[],int npf){ | |
int j; | |
int f=0; | |
for (j=0;j<npf;j++){ | |
if (pf[j]==el){ | |
f=1; | |
break; |
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 libraries | |
import numpy as np | |
import pandas as pd | |
import math | |
from pprint import pprint | |
# Function to get Data | |
# Import dataset and create df | |
def get_data(file, index_col): | |
df = pd.read_csv(file, index_col=index_col) |
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
# Function to get the next root node | |
def get_next_root(df, out_col, positive_attr): | |
l = list(df.columns) | |
l.remove(out_col) | |
# Get the root node | |
root = "" | |
max_infogain = 0 | |
for attr in l: | |
t = cal_information_gain(df, attr, out_col, positive_attr) |