In [3]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
from eden.util import configure_logging
import logging
configure_logging(logging.getLogger(),verbosity=0)
from IPython.core.display import HTML
HTML('<style>.container { width:95% !important; }</style>')
# data source, see introduction for details.
from eden_extra.converter.graph.gspan import gspan_to_eden
from itertools import islice
def get_graphs(dataset_fname='../toolsdata/bursi.pos.gspan', size=100):
return islice(gspan_to_eden(dataset_fname),size)
def get_graphss(dataset_fname='../toolsdata/bursi.neg.gspan', size=100):
return islice(gspan_to_eden(dataset_fname),size)
In [2]:
%%time
# Testing my evil plans
import graphlearn01.learnedlayer.cascade as cascade
from graphlearn01.minor import decompose
from graphlearn01.utils import draw
'''
graphs = get_graphs(size=200)
mycascade = cascade.Cascade(depth=2,debug=True,multiprocess=True,max_group_size=5,min_group_size=3, num_classes=1)
graphs = mycascade.fit_transform(graphs)
draw.graphlearn_layered2(graphs[:5])
'''
for i in range(1):
graphs = get_graphs(size=300)
graphss = get_graphss(size=300)
mycascade = cascade.Cascade(depth=2,debug=True,multiprocess=True,max_group_size=6,min_group_size=2, num_classes=2)
graphs = mycascade.fit_transform(graphs,graphss)
for g in graphs[:10]:
for n,d in g.nodes(data=True):
d['importance_sd']=d['importance'][0]
draw.graphlearn_layered2(graphs[:10],vertex_label='importance_sd')
In [3]:
In [4]:
In [ ]:
In [ ]:
from graphlearn01.minor import decompose
from graphlearn01.utils import draw
decomp=decompose.MinorDecomposer()
mystuff = map(decomp.make_new_decomposer, graphs)
print len(mystuff)
mystuff = [ arg.compress_layers() for arg in mystuff]
print len(mystuff)
mystuff = [arg.pre_vectorizer_graph(nested=True) for arg in mystuff]
print len(mystuff)
#draw.graphlearn_layered(mystuff[:10])
#print 'asdasdasd'
In [ ]:
%%time
#from graphlearn01.utils import draw
import graphlearn01.learnedlayer.cascade as cascade
graphs = list(get_graphs(size=200))
graphss = list(get_graphss(size=200))
mycascade = cascade.Cascade(depth=2,debug=False,multiprocess=True)
graph = mycascade.fit_transform(graphs,graphss)
#draw.graphlearn_layered2(graphs[:5])
#draw.graphlearn_layered2(g2[:5])
# ok was will ich von der cascade?
# transform muss noch laufen.. und zwar so dass unten graphs rausfallen.
#draw.graphlearn(graphs[:5])
In [ ]:
In [ ]:
In [ ]: