-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gaa-cifasis
committed
Oct 29, 2015
1 parent
49cf8b4
commit 0650fdb
Showing
4 changed files
with
72 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
This file is part of VDISCOVER. | ||
VDISCOVER is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
VDISCOVER is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with VDISCOVER. If not, see <http://www.gnu.org/licenses/>. | ||
Copyright 2014 by G.Grieco | ||
""" | ||
|
||
import random | ||
import copy | ||
|
||
def cluster_sampler(clustered_traces, n_per_cluster): | ||
#cc = copy.copy(clusters) | ||
#n_per_cluster = 1#n / len(cc) | ||
clusters = dict() | ||
for label, cluster in clustered_traces: | ||
clusters[cluster] = clusters.get(cluster, []) + [label.split(":")[-1]] | ||
|
||
print "Selecting", len(clusters), "seeds" | ||
for (cluster, seeds) in clusters.items(): | ||
print ",".join(random.sample(seeds, n_per_cluster)) |
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