forked from SushantKafle/DBSCAN
/
main.py
42 lines (28 loc) · 759 Bytes
/
main.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
'''
Created on Feb 13, 2014
@author: sushant
'''
from dbscanner import *
import csv
import re
configPath = '/home/sushant/config'
dataPath = '/home/sushant/abc.csv'
def main():
[Data,eps,MinPts]= getData()
dbc= dbscanner()
dbc.dbscan(Data, eps, MinPts)
def getData():
Data = []
with open(dataPath,'rb') as f:
reader = csv.reader(f)
for row in reader:
#row = re.split(r'\t+',row[0])
Data.append([float(row[0]),float(row[1])])
f = open(configPath,'r')
[eps,MinPts] = parse(f.readline())
print eps,MinPts
return [Data,eps,MinPts]
def parse(line):
data = line.split(" ")
return [int(data[0]),int(data[1])]
main()