-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalysis.py
More file actions
29 lines (22 loc) · 792 Bytes
/
Analysis.py
File metadata and controls
29 lines (22 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 13 18:14:07 2019
@author: ayanca
"""
import numpy as np
import pandas as pd
data = pd.read_csv("data/glass2.data", sep=',', low_memory=False)
#print "Original data:", data
print ("Original data shape:", data.shape)
#print data
data = data.iloc[:,1:].values
features = np.size(data,1)-1 # 149 #column [all columns except last one as it has predicted class]
#print features
samples = np.size(data,0) #row
totalClass = data[:, features]
totalClass = (np.sort(np.unique(np.array(totalClass))))
totalClass = np.reshape(totalClass,[totalClass.size,1]) #convert to (*,1) array
print ("classes: ", totalClass.shape[0])
for i in range(totalClass.shape[0]):
W1 = data[data[:, features] == totalClass[i]]
print (totalClass[i], W1.shape)