import sys
import os
import pandas as pd
from writeapriorifile import WriteAprioriFile
#print(sys.path)
os.chdir("..\\..\\..\\02450Toolbox_Python\\Scripts")
#print(os.getcwd())
from similarity import binarize2

data = pd.read_csv('..\\..\\Projects\\Project1\\Projekt3\\data.csv',header="infer")
X = data.as_matrix()
attributeNames = list(data)
data, newnames
 = binarize2(X,columnnames=attributeNames)
print(data) #ser godt ud

# Gem binæriseret data som en pik med et ordentligt navn
WriteAprioriFile(data,filename="FatBinarizedIndians.txt")
# ex12_1_5
# Load data from the wine dataset
from scipy.io import loadmat
mat_data = loadmat('../Data/wine.mat')
X = mat_data['X']
y = mat_data['y'].squeeze()
attributeNames = [name[0][0] for name in mat_data['attributeNames']]

# We will now transform the wine dataset into a binary format. Notice the changed attribute names:
from similarity import binarize2
Xbin, attributeNamesBin = binarize2(X, attributeNames)
print("X, i.e. the wine dataset, has now been transformed into:")
print(Xbin)
print(attributeNamesBin)
Exemplo n.º 3
0
# Binarizing data and splitting diabetes in one out of

import sys
sys.path.append("02450Toolbox_Python/Tools")
import numpy as np
from scipy.io import loadmat
from scipy.stats import zscore
from similarity import binarize2
from writeapriorifile import WriteAprioriFile
import pandas as pd
from projekt3 import X, names, y
#data= np.concatenate((X, y), axis=1)
data = X
[data, Names] = binarize2(data, names)
data = np.concatenate((data, y, abs(y - 1)), axis=1)
WriteAprioriFile(data, titles=None, filename="pimaBinarize.txt")
#WriteAprioriFile(X,titles=Names,filename="pimaBinarize.txt")
Exemplo n.º 4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 24 16:32:42 2018

@author: ibenfjordkjaersgaard
"""
import sys
sys.path.append(
    '/Users/ibenfjordkjaersgaard/Library/Mobile Documents/com~apple~CloudDocs/Documents/Uni/Semester 4/Machine learning og data mining/02450Toolbox_Python/Tools'
)

from similarity import binarize2

from projekt3 import pimaData

pimaData = pimaData

binarize2(pimaData, ['a', 'b', 'c', 'd'])