예제 #1
0
 class_index = 1
 # for class_index in xrange(num_classes):
 H, L, L_hat, n_graphs, n_pos, n_neg, pos_index, neg_index, graph_id_to_list_id = fileio.preproscessing(
     database_train, class_index, labels_mapping, m
 )
 X_train, pattern_set_global = gspan.project(
     database_train,
     freq,
     minsup,
     flabels,
     length,
     H,
     L,
     L_hat,
     n_graphs,
     n_pos,
     n_neg,
     pos_index,
     class_index,
     neg_index,
     graph_id_to_list_id,
     mapper=id_to_uri,
     labels=labels_mapping,
     model=m,
     constraints=cons,
 )
 # for p in pattern_set:
 #    if p not in pattern_set_global:
 #        pattern_set_global.append(p)
 # if m == "top-k":
 #    break
예제 #2
0
def Gspan(support):
	database = fileio.read_file(r"database.txt")
	minsup = int((float(support)*len(database)))
	database, freq, trimmed, flabels = gspan.trim_infrequent_nodes(database, minsup)
	database = fileio.read_file(r"database.txt", frequent = freq)
	gspan.project(database, freq, minsup, flabels)
예제 #3
0
import sys
import os

import fileio
import gspan

if __name__ == '__main__':
    print 'Database: ', sys.argv[1]
    database = fileio.read_file(sys.argv[1])
    print 'Number Graphs Read: ', len(database)
    print 'Support: ', sys.argv[2],
    minsup = int((float(sys.argv[2]) * len(database)))
    print minsup
    database, freq, trimmed, flabels = gspan.trim_infrequent_nodes(
        database, minsup)
    database = fileio.read_file(sys.argv[1], frequent=freq)
    print 'Trimmed ', len(trimmed), ' labels from the database'
    print flabels
    gspan.project(database, freq, minsup, flabels)
예제 #4
0
import sys
import os

import fileio
import gspan

if __name__ == '__main__':
	print 'Database: ', sys.argv[1]
	database = fileio.read_file(sys.argv[1])
	print 'Number Graphs Read: ', len(database)
	print 'Support: ', sys.argv[2],
	minsup = int((float(sys.argv[2])*len(database)))
	print minsup
	database, freq, trimmed, flabels = gspan.trim_infrequent_nodes(database, minsup)
	database = fileio.read_file(sys.argv[1], frequent = freq)
	print 'Trimmed ', len(trimmed), ' labels from the database'
	print flabels
	gspan.project(database, freq, minsup, flabels)


def Gspan(support):
	database = fileio.read_file(r"database.txt")
	minsup = int((float(support)*len(database)))
	database, freq, trimmed, flabels = gspan.trim_infrequent_nodes(database, minsup)
	database = fileio.read_file(r"database.txt", frequent = freq)
	gspan.project(database, freq, minsup, flabels)