Skip to content

Commit 163d57a

Browse files
author
g
committed
added missing file
1 parent 6f55fe1 commit 163d57a

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

tseeder

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/python2
2+
3+
"""
4+
This file is part of VDISCOVER.
5+
6+
VDISCOVER is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
VDISCOVER is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with VDISCOVER. If not, see <http://www.gnu.org/licenses/>.
18+
19+
Copyright 2015 by G.Grieco
20+
"""
21+
22+
import os
23+
import argparse
24+
import sys
25+
import csv
26+
27+
from vdiscover.Utils import *
28+
from vdiscover.Sampling import *
29+
30+
csv.field_size_limit(sys.maxsize)
31+
32+
if __name__ == "__main__":
33+
34+
# Arguments
35+
parser = argparse.ArgumentParser(description='A small utility to perform seed selection for fuzzig')
36+
parser.add_argument("infile", help="A csv with the features to train or predict", type=str, default=None)
37+
parser.add_argument("outdir", help="A directory with the seeds", type=str, default=None)
38+
parser.add_argument("-n", help="Number of seeds to select per cluster", type=int, default=1)
39+
parser.add_argument("--random", help="Sample randomly", action="store_true", default=None)
40+
41+
options = parser.parse_args()
42+
in_file = options.infile
43+
outdir = options.outdir
44+
nseeds = options.n
45+
46+
reader = load_csv(in_file)
47+
clusters = []
48+
for [label, cluster] in reader:
49+
clusters.append((label.split(":")[-1], cluster))
50+
51+
selected = cluster_sampler(clusters, nseeds)
52+
53+
for seed in selected:
54+
print "cp", seed, outdir
55+
56+

0 commit comments

Comments
 (0)