예제 #1
0
class Levy(ExpDesign):

    data_net_all = Corpus([
        'manufacturing', 'fb_uc', 'blogs', 'emaileu', 'propro', 'euroroad',
        'generator7', 'generator12', 'generator10', 'generator4'
    ])
    net_all = data_net_all + Corpus(['clique6', 'BA'])

    data_text_all = Corpus(['kos', 'nips12', 'nips', 'reuter50',
                            '20ngroups'])  # lucene

    #
    # Poisson Point process :
    # * stationarity / ergodicity of p(d_i) ?
    # * Erny theorem (characterization by void probabilities ?
    # * Inference ? Gamma Process ?
    # * Sparsity ?

    wmmsb = ExpTensor(
        corpus=['BA'],
        model='iwmmsb_scvb',
        N=200,
        chunk='adaptative_1',
        K=6,
        iterations=3,
        hyper='auto',
        testset_ratio=20,
        delta=[[2, 2]],
        chi_a=10,
        tau_a=100,
        kappa_a=0.6,
        chi_b=10,
        tau_b=500,
        kappa_b=0.9,
        h**o=0,
        mask='unbalanced',
        _data_format='w',
        _data_type='networks',
        _refdir='debug_scvb',
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}',
        _csv_typo=
        '_iteration time_it _entropy _entropy_t _K _chi_a _tau_a _kappa_a _chi_b _tau_b _kappa_b _elbo _roc'
    )

    noelw3 = ExpGroup(wmmsb,
                      N='all',
                      chunk=['adaptative_0.1', 'adaptative_1'],
                      corpus=data_net_all,
                      mask=['unbalanced'],
                      _refdir='noel3')
예제 #2
0
파일: manager.py 프로젝트: oboder/pymake
    def load(cls, expe, load=True):
        """ Return the frontend suited for the given expe"""

        corpus_name = expe.get('corpus') or expe.get('random')

        if '.' in corpus_name:
            c_split = corpus_name.split('.')
            c_name, c_ext = '.'.join(c_split[:-1]), c_split[-1]
        else:
            c_name = corpus_name
            c_ext = None

        _corpus = Corpus.get(c_name)
        if c_ext in GramExp._frontend_ext:
            # graph-tool object
            # @Todo: Corpus intragation!
            _corpus.update(data_format=c_ext)
        elif _corpus is False:
            raise ValueError('Unknown Corpus `%s\'!' % corpus)
        elif _corpus is None:
            return None

        if _corpus['data_type'] == 'text':
            frontend = frontendText(expe)
        elif _corpus['data_type'] == 'network':
            if _corpus.get('data_format') == 'gt':
                frontend = frontendNetwork_gt.from_expe(expe, load=load, corpus=_corpus)
            else:
                # Obsolete loading design. @Todo
                frontend = frontendNetwork(expe)
                if load is True:
                    frontend.load_data(randomize=False)
                frontend.sample(expe.get('N'), randomize=False)

        return frontend
예제 #3
0
파일: manager.py 프로젝트: cipoll4/pymake
    def load(cls, expe, skip_init=False):
        """ Return the frontend suited for the given expe
            @TODO: skip_init is not implemented

        """
        if skip_init:
            cls.log.warning('skip init is not implemented')

        corpus_name = expe.get('corpus') or expe.get('random') or expe.get(
            'concept')
        if expe.get('driver'):
            corpus_name += '.' + expe.driver.strip('.')

        if '.' in corpus_name:
            c_split = corpus_name.split('.')
            c_name, c_ext = '.'.join(c_split[:-1]), c_split[-1]
        else:
            c_name = corpus_name
            c_ext = None

        _corpus = Corpus.get(c_name)
        if c_ext in cls._frontend_ext:
            # graph-tool object
            # @Todo: Corpus integration!
            if not _corpus:
                dt_lut = {'gt': 'network'}
                _corpus = dict(data_type=dt_lut[c_ext])
            _corpus.update(data_format=c_ext)
        elif _corpus is False:
            raise ValueError('Unknown Corpus `%s\'!' % c_name)
        elif _corpus is None:
            return None

        if _corpus['data_type'] == 'text':
            from .frontendtext import frontendText
            frontend = frontendText(expe)
        elif _corpus['data_type'] == 'network':
            if _corpus.get('data_format') == 'gt':
                from .frontendnetwork import frontendNetwork_gt
                frontend = frontendNetwork_gt.from_expe(expe, corpus=_corpus)
            else:
                from .frontendnetwork import frontendNetwork
                # Obsolete loading design. @Todo
                frontend = frontendNetwork(expe)
                frontend.load_data(randomize=False)

        if hasattr(frontend, 'configure'):
            frontend.configure()

        return frontend
예제 #4
0
    def load(cls, expe):
        """ Return the frontend suited for the given expe"""

        corpus_name = expe.get('corpus') or expe.get('random') or expe.get(
            'concept')
        if expe.get('driver'):
            corpus_name += '.' + expe.ext.strip('.')

        if '.' in corpus_name:
            c_split = corpus_name.split('.')
            c_name, c_ext = '.'.join(c_split[:-1]), c_split[-1]
        else:
            c_name = corpus_name
            c_ext = None

        _corpus = Corpus.get(c_name)
        if c_ext in GramExp._frontend_ext:
            # graph-tool object
            # @Todo: Corpus intragation!
            _corpus.update(data_format=c_ext)
        elif _corpus is False:
            raise ValueError('Unknown Corpus `%s\'!' % corpus)
        elif _corpus is None:
            return None

        if _corpus['data_type'] == 'text':
            from .frontendtext import frontendText
            frontend = frontendText(expe)
        elif _corpus['data_type'] == 'network':
            if _corpus.get('data_format') == 'gt':
                from .frontendnetwork import frontendNetwork_gt
                frontend = frontendNetwork_gt.from_expe(expe, corpus=_corpus)
            else:
                from .frontendnetwork import frontendNetwork
                # Obsolete loading design. @Todo
                frontend = frontendNetwork(expe)
                frontend.load_data(randomize=False)

        frontend.configure()
        return frontend
예제 #5
0
파일: netw.py 프로젝트: oboder/pymake
class Netw(ExpDesign):

    # Use for Name on figure and table
    _alias = dict((
        ('propro', 'Protein'),
        ('blogs', 'Blogs'),
        ('euroroad', 'Euroroad'),
        ('emaileu', 'Emaileu'),
        ('manufacturing', 'Manufacturing'),
        ('fb_uc', 'UC Irvine'),
        ('generator7', 'Network1'),
        ('generator12', 'Network2'),
        ('generator10', 'Network3'),

        #('generator4'     , 'Network4' ),
        ('generator4', 'Network2'),
        #('pmk.ilfm_cgs'     , 'ILFM' ),
        #('pmk.immsb_cgs'     , 'IMMSB' ),
    ))

    # Networks Data
    corpus_real_net = Corpus(
        ['manufacturing', 'fb_uc', 'blogs', 'emaileu', 'propro', 'euroroad'])

    ### Bursty
    CORPUS_BURST_1 = Corpus([
        'generator3', 'generator11', 'generator12', 'generator7', 'generator14'
    ])

    ### Non Bursty
    CORPUS_NBURST_1 = Corpus([
        'generator4', 'generator5', 'generator6', 'generator9', 'generator10'
    ])

    CORPUS_SYN_ICDM = Corpus(
        ['generator7', 'generator12', 'generator10', 'generator4'])
    CORPUS_REAL_ICDM = Corpus([
        'manufacturing',
        'fb_uc',
    ])
    CORPUS_ALL_ICDM = CORPUS_SYN_ICDM + CORPUS_REAL_ICDM
    CORPUS_REAL_PNAS = Corpus(
        ['manufacturing', 'fb_uc', 'blogs', 'emaileu', 'propro'])
    CORPUS_ALL_PNAS = CORPUS_REAL_PNAS + CORPUS_SYN_ICDM
    pnas_short = Corpus(['blogs', 'manufacturing', 'generator7', 'generator4'])
    pnas_rest = (corpus_real_net + CORPUS_SYN_ICDM) - pnas_short

    #data_net_all
    #net_all

    # Text Corpus
    # intruder ?
    data_text_all = Corpus(['kos', 'nips12', 'nips', 'reuter50',
                            '20ngroups'])  # lucene

    # Tensor Exp
    EXPE_ICDM = ExpTensor((
        ('_data_type', ('networks', )),
        ('_refdir', ('debug10', 'debug11')),
        #('corpus' , ('fb_uc', 'manufacturing')),
        ('corpus', CORPUS_ALL_ICDM),
        ('model', ('immsb_cgs', 'ilfm_cgs')),
        ('K', (5, 10, 15, 20)),
        ('N', ('all', )),
        ('hyper', ('fix', 'auto')),
        ('h**o', (0, )),
        #('_repeat'   , (0, 1, 2,3, 4, 5)),
    ))

    PNAS1 = ExpTensor((
        ('corpus', CORPUS_ALL_PNAS),
        ('_data_type', 'networks'),
        ('_refdir', 'debug111111'),  # ign in gen
        #('model'        , 'mmsb_cgs')   ,
        ('model', ['immsb_cgs', 'ilfm_cgs']),
        ('K', 10),
        ('N', 'all'),  # ign in gen
        ('hyper', ['auto', 'fix']),  # ign in gen
        ('h**o', 0),  # ign in gen
        ('_repeat', 1),
        ('_bind', ['immsb_cgs.auto', 'ilfm_cgs.fix']),
        ('iterations', '200'),
        ('_format', '{model}_{corpus}_{K}_{hyper}_{h**o}_{N}')))

    PNAS2 = ExpTensor((
        ('corpus', CORPUS_ALL_PNAS),
        ('_data_type', 'networks'),
        ('_refdir', 'pnas2'),  # ign in gen
        #('model'        , 'mmsb_cgs')   ,
        ('model', ['immsb_cgs', 'ilfm_cgs']),
        ('K', 10),
        ('N', 'all'),  # ign in gen
        ('hyper', ['fix', 'auto']),  # ign in gen
        ('h**o', 0),  # ign in gen
        ('_repeat', 0),
        ('_bind', [
            'immsb_cgs.auto', 'ilfm_cgs.fix', 'ilfm_cgs.iterations.25',
            'immsb_cgs.iterations.150'
        ]),
        ('iterations', [25, 150]),
        ('testset_ratio', [40, 60, 80]),
        ('_format', '{model}_{corpus}_{K}_{hyper}_{h**o}_{N}_{testset_ratio}'),
        ('_csv_typo',
         '_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var'
         ),
    ))

    PNAS3 = ExpTensor((
        ('corpus', pnas_short),
        ('_refdir', 'pnas3'),  # ign in gen
        ('_data_type', 'networks'),
        ('model', ['immsb_cgs', 'ilfm_cgs']),
        ('K', 10),
        ('N', 'all'),  # ign in gen
        ('hyper', ['fix', 'auto']),  # ign in gen
        ('h**o', 0),  # ign in gen
        ('_repeat', 0),
        ('_bind', [
            'immsb_cgs.auto', 'ilfm_cgs.fix', 'ilfm_cgs.iterations.25',
            'immsb_cgs.iterations.150'
        ]),
        ('iterations', [25, 150]),
        ('testset_ratio', 20),
        ('_format',
         '{model}_{iterations}_{corpus}_{K}_{hyper}_{h**o}_{N}_{testset_ratio}'
         ),
        ('_csv_typo',
         '_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var'
         ),
    ))

    EXPE_ICDM_R = ExpTensor((
        ('_data_type', ('networks', )),
        #('corpus' , ('fb_uc', 'manufacturing')),
        ('corpus', CORPUS_SYN_ICDM),
        #('_refdir'  , ('debug10', 'debug11')),
        ('_refdir', ('debug101010', 'debug111111')),
        ('model', ('immsb_cgs', 'ilfm_cgs')),
        ('K', (5, 10, 15, 20)),
        ('hyper', ('fix', 'auto')),
        ('h**o', (0, 1, 2)),
        ('N', ('all', )),
        ('_repeat', list(range(10))),
        ('iterations', '200'),
        ('_bind', ['immsb_cgs.auto', 'ilfm_cgs.fix']),
    ))

    EXPE_ICDM_R_R = ExpTensor((
        ('_data_type', ('networks', )),
        ('corpus', ('fb_uc', 'manufacturing')),
        ('_refdir', ('debug101010', 'debug111111')),
        ('model', ('immsb_cgs', 'ilfm_cgs')),
        ('K', (5, 10, 15, 20)),
        ('hyper', ('fix', 'auto')),
        ('h**o', (0, 1, 2)),
        ('N', ('all', )),
        ('_repeat', list(range(10))),
        ('iterations', '200'),
        ('_bind', ['immsb_cgs.auto', 'ilfm_cgs.fix']),
    ))

    # Single Expe

    MODEL_FOR_CLUSTER_IBP = ExpSpace((
        ('_data_type', 'networks'),
        ('_refdir', 'debug11'),
        ('model', 'ilfm_cgs'),
        ('K', 20),
        ('N', 'all'),
        ('hyper', 'fix'),
        ('h**o', 0),
        #('_repeat'      , '*')       ,
    ))
    MODEL_FOR_CLUSTER_IMMSB = ExpSpace((
        ('_data_type', 'networks'),
        ('_refdir', 'debug11'),
        ('model', 'immsb_cgs'),
        ('K', 20),
        ('N', 'all'),
        ('hyper', 'auto'),
        ('h**o', 0),
        #('_repeat'      , '*')       ,
    ))

    default_gen = ExpTensor((
        ('corpus', CORPUS_SYN_ICDM),
        ('_data_type', 'networks'),
        ('_refdir', 'debug111111'),  # ign in gen
        #('model'        , 'mmsb_cgs')   ,
        ('model', ['immsb_cgs', 'ilfm_cgs']),
        ('K', 10),
        ('N', 'all'),  # ign in gen
        ('hyper', ['auto', 'fix']),  # ign in gen
        ('h**o', 0),  # ign in gen
        ('_repeat', 1),
        ('_bind', ['immsb_cgs.auto', 'ilfm_cgs.fix']),
        ('alpha', 1),
        ('gmma', 1),
        ('delta', [(1, 5)]),
    ))
    default_check = default_gen.copy()
    default_check['model'] = 'immsb_cgs'

    MODELS_GENERATE = ExpTensor((
        ('_data_type', 'networks'),
        ('_refdir', 'debug11'),
        ('model', ['immsb_cgs', 'ilfm_cgs']),
        ('K', 10),
        ('N', 'all'),
        ('hyper', ['fix', 'auto']),
        ('h**o', 0),
        #('_repeat'      , '*')       ,
        ('_bind', ['immsb_cgs.auto', 'ilfm_cgs.fix']),
        ('_csv_typo ',
         ('_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var',
          )),
    ))

    #### Temp

    EXPE_ALL_ICDM_IBP = ExpTensor((
        ('_data_type', ('networks', )),
        ('_refdir', ('debug111111', 'debug101010')),
        ('corpus', CORPUS_ALL_ICDM),
        ('model', ('ilfm_cgs', )),
        ('K', (5, 10, 15, 20)),
        ('N', ('all', )),
        ('hyper', ('fix', )),
        ('h**o', (0, )),
        ('_repeat', (6, 7, 8, 9)),
        ('_csv_typo ',
         ('_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var',
          )),
    ))
    EXPE_ALL_ICDM_IMMSB = ExpTensor((
        ('_data_type', ('networks', )),
        ('_refdir', ('debug111111', 'debug101010')),
        ('corpus', CORPUS_ALL_ICDM),
        ('model', ('immsb_cgs', )),
        ('K', (5, 10, 15, 20)),
        ('N', ('all', )),
        ('hyper', ('auto', )),
        ('h**o', (0, )),
        ('_repeat', (6, 7, 8, 9)),
        ('_csv_typo ',
         ('_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var',
          )),
    ))

    RUN_DD = ExpTensor((
        ('_data_type', ('networks', )),
        #('corpus' , ('fb_uc', 'manufacturing')),
        ('_refdir', ('test_temp', )),
        ('corpus', ('generator1', )),
        ('model', ('immsb_cgs', 'ilfm_cgs')),
        ('K', (5, )),
        ('N', ('all', )),
        ('hyper', ('auto', )),
        ('h**o', (0, )),
        ('hyper_prior', ('1 2 3 4', '20 2 10 2')),
        ('_repeat', (0, 1, 2, 4, 5)),
        ('_bind', ['immsb_cgs.auto', 'ilfm_cgs.fix']),
        ('_csv_typo ',
         ('_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var',
          )),
    ))

    EXPE_REAL_V2_IBP = ExpTensor((
        ('_data_type', ('networks', )),
        ('corpus', ('propro', 'blogs', 'euroroad', 'emaileu')),
        (
            '_refdir',
            ('debug111111'),
        ),
        ('model', ('ilfm_cgs', )),
        ('K', (10, )),
        ('hyper', ('fix', )),
        ('h**o', (0, )),
        ('N', ('all', )),
        ('_repeat', list(range(5))),
        ('_csv_typo ',
         ('_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var',
          )),
    ))

    EXPE_REAL_V2_IMMSB = ExpTensor((
        ('_data_type', ('networks', )),
        ('corpus', ('propro', 'blogs', 'euroroad', 'emaileu')),
        (
            '_refdir',
            ('debug111111', ),
        ),
        ('model', ('immsb_cgs', )),
        ('K', (10, )),
        ('hyper', ('auto', )),
        ('h**o', (0, )),
        ('N', ('all', )),
        ('_repeat', list(range(5))),
        ('_csv_typo ',
         ('_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var',
          )),
    ))

    RAGNRK = ExpTensor(
        _data_type=['networks'],
        corpus=['propro', 'blogs', 'euroroad', 'emaileu'],
        _refdir=['ragnarok'],
        model=['immsb_cgs'],
        K=[10],
        hyper=['auto'],
        h**o=[0],
        N=[10],
        _repeat=list(range(2)),
        _csv_typo=
        '_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var'
    )

    default_expe = ExpTensor(
        _data_type='networks',
        corpus='clique4',
        model='immsb_cgs',
        hyper='auto',
        _refdir='debug',
        testset_ratio=20,
        K=5,
        N=50,
        iterations=10,
        h**o=0,
        _format='{model}_{corpus}_{K}_{hyper}_{h**o}_{N}',
        #_csv_typo = '_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var'
    )

    debug = ExpTensor(_data_type='networks',
                      corpus='clique4',
                      model=['immsb_cgs', 'ilfm_cgs', 'immsb_scvb'],
                      hyper='auto',
                      _refdir='debug',
                      testset_ratio=20,
                      K=4,
                      N=42,
                      iterations=3,
                      h**o=0,
                      _format='{model}_{corpus}_{K}_{hyper}_{h**o}_{N}',
                      _csv_typo='_iteration time_it _entropy _entropy_t _K')

    model_all = Model(['immsb_cgs', 'ilfm_cgs', 'immsb_scvb', 'rescal'])
    model_debug = Model(['mmsb_vb'])
예제 #6
0
class Levy(ExpDesign):

    #refdir=gapv1 is old likelihood + sampling r/p.sampling
    #rocw1: new likelihood + sampling r/p
    #rocw2: newlikelihood + mixed samling/VB r/p
    #rocw3: new likelihood + mixed samling/VB r/p and N_Phi added. (partial some correction and inversion sample/expectation)
    #rocw4: new likelihood + samling r/p and

    _alias = {'ml.iwmmsb_scvb3': 'WMMSB',
              'ml.iwmmsb_scvb3_auto': 'WMMSB-bg',
              'ml.immsb_scvb3': 'MMSB',
              'ml.sbm_gt': 'SBM',
              'ml.wsbm_gt': 'WSBM',
              'link-dynamic-simplewiki': 'wiki-link',
              'munmun_digg_reply': 'digg-reply',
              'slashdot-threads': 'slashdot',
             }

    net_old = Corpus(['manufacturing', 'fb_uc', 'blogs', 'emaileu', 'propro', 'euroroad',
                      'generator7', 'generator12', 'generator10', 'generator4'])
    net_gt = Corpus(['astro-ph', 'hep-th', 'netscience', 'cond-mat']) # all undirected
    net_random = Corpus(['clique6', 'BA'])
    net_test = Corpus(['manufacturing', 'fb_uc', 'netscience'])
    net_large = Corpus(['link-dynamic-simplewiki', 'enron', 'foldoc'])
    net_w = Corpus(['manufacturing', 'fb_uc']) + net_gt
    # 'actor-collaboration' # Too big?
    net_w2 = Corpus(['slashdot-threads', 'prosper-loans', 'munmun_digg_reply', 'moreno_names'])
    # manufacturing
    net_final = Corpus(['fb_uc',
                        #'manufacturing',
                        'hep-th',
                        'link-dynamic-simplewiki',
                        'enron',
                        'slashdot-threads',
                        'prosper-loans',
                        'munmun_digg_reply',
                        'moreno_names',
                        'astro-ph'])
    net_all = net_old + net_gt + net_large

    #
    # Poisson Point process :
    # * stationarity / ergodicity of p(d_i) ?
    # * Erny theorem (characterization by void probabilities ?
    # * Inference ? Gamma Process ?
    # * Sparsity ?

    warm = ExpTensor(
        corpus=['manufacturing'],
        model='iwmmsb_scvb3',
        N='all',
        K=10,
        hyper='auto',
        h**o=0,
        testset_ratio=20,
        validset_ratio=10,


        # Sampling
        chunk='stratify',
        sampling_coverage=0.42,
        #chi_a=10, tau_a=100, kappa_a=0.6,
        #chi_b=10, tau_b=500, kappa_b=0.9,
        chi_a=1, tau_a=1024, kappa_a=0.5,
        chi_b=1, tau_b=1024, kappa_b=0.5,
        zeros_set_prob=1/2,
        zeros_set_len=50,

        #delta = [[1, 1]],
        #delta = [[0.5, 10]],
        delta='auto',

        fig_xaxis=[('_observed_pt', 'visited edges')],
        fig_legend=4,
        legend_size=12,
        #ticks_size = 20,
        title_size=20,

        driver='gt', # graph-tool driver

        _data_type='networks',
        _refdir='debug_scvb3',
        _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}',
        _measures='_observed_pt time_it _entropy _K _chi_a _tau_a _kappa_a _chi_b _tau_b _kappa_b _roc _wsim _pr',
    )

    # Sparse sampling
    warm_sparse_chunk = ExpGroup(warm, sampling_coverage=1, chunk='sparse')

    # Sampling sensiblity | hyper-delta sensibility
    warm_sampling = ExpGroup(warm, delta=[[1, 1], [0.5, 10], [10, 0.5]],
                             zeros_set_prob=[1/2, 1/3, 1/4], zeros_set_len=[10, 50])

    arm_sampling = ExpGroup(warm_sampling, delta='auto', model='immsb_scvb3')

    sbm_base = ExpGroup(warm, model=['sbm_gt', 'wsbm_gt', 'rescal_als'],
                        zeros_set_prob=None, zeros_set_len=None, delta=None,
                        _measures='time_it _entropy _K _roc _wsim _pr')
    wsbm2_base = ExpGroup(sbm_base, model=['wsm_g', 'wsbm2_gt'])
    wsbm_base = ExpGroup(sbm_base, model=['wsbm_gt'])

    # Compare sensibility
    eta_b = ExpGroup([arm_sampling], _refdir='eta', corpus=net_w,
                     zeros_set_prob=[1/2, 1/4])
    eta_w = ExpGroup([warm_sampling], _refdir='eta', corpus=net_w,
                     zeros_set_prob=[1/2, 1/4])
    eta = ExpGroup([eta_b, eta_w])

    eta_sbm = ExpGroup(sbm_base, _refdir='eta', corpus=net_w)

    # test/visu
    warm_visu = ExpGroup(warm, delta=[[1, 1], 'auto'],
                         zeros_set_prob=[1/2], zeros_set_len=[10])

    # Best selection visu (eta)
    best_mmsb = ExpGroup(eta_b, zeros_set_prob=1/4, zeros_set_len=50, delta='auto')
    best_wmmsb = ExpGroup(eta_w, zeros_set_prob=1/4, zeros_set_len=50, delta=[[0.5, 10]])
    best_scvb = ExpGroup([best_mmsb, best_wmmsb])
    eta_best = ExpGroup([best_scvb, eta_sbm])

    # Corrected zero sampling
    eta2_base = ExpGroup(warm, testset_ratio=20, _refdir='roc5', corpus=net_w) # roc5§roc5_N
    eta2_sbm = ExpGroup(eta2_base, model=['sbm_gt', 'wsbm_gt', 'rescal_als'],
                        zeros_set_prob=None, zeros_set_len=None, delta=None,
                        _measures='time_it _entropy _K _roc _wsim _pr')

    eta2_b = ExpGroup(eta2_base, model="immsb_scvb3", zeros_set_prob=1/2, zeros_set_len=10, delta='auto')
    eta2_b10 = eta2_b
    eta2_b50 = ExpGroup(eta2_base, model="immsb_scvb3", zeros_set_prob=1/2, zeros_set_len=50, delta='auto')

    eta0_w = ExpGroup(eta2_base, model="iwmmsb_scvb3", zeros_set_prob=1/2, zeros_set_len=10, delta=[[10, 0.5]])
    eta1_w = ExpGroup(eta2_base, model="iwmmsb_scvb3", zeros_set_prob=1/2, zeros_set_len=10, delta=[[1, 1]])
    eta2_w = ExpGroup(eta2_base, model="iwmmsb_scvb3", zeros_set_prob=1/2, zeros_set_len=10, delta=[[0.5, 10]])
    eta3_w = ExpGroup(eta2_base, model="iwmmsb_scvb3", zeros_set_prob=1/2, zeros_set_len=10, delta=[[0.1, 10]])
    eta0_w50 = ExpGroup(eta2_base, model="iwmmsb_scvb3", zeros_set_prob=1/2, zeros_set_len=50, delta=[[10, 0.5]])
    eta1_w50 = ExpGroup(eta2_base, model="iwmmsb_scvb3", zeros_set_prob=1/2, zeros_set_len=50, delta=[[1, 1]])
    eta2_w50 = ExpGroup(eta2_base, model="iwmmsb_scvb3", zeros_set_prob=1/2, zeros_set_len=50, delta=[[0.5, 10]])

    eta2a_w = ExpGroup(eta2_base, model="iwmmsb_scvb3_auto", zeros_set_prob=1/2,
                       zeros_set_len=10, delta='auto', _model="ml.iwmmsb_scvb3")
    eta2a_w10 = eta2a_w
    eta2a_w50 = ExpGroup(eta2_base, model="iwmmsb_scvb3_auto", zeros_set_prob=1/2,
                         zeros_set_len=50, delta='auto', _model="ml.iwmmsb_scvb3")

    eta4_full = ExpGroup([eta2_b50, eta2_w50, eta2a_w50]) # weighte are squared

    roc_visu_sbm = ExpGroup(sbm_base, corpus=net_w, testset_ratio=20, model=['sbm_gt', 'wsbm_gt'], _refdir='roc5')
    roc_visu_sbm_full = ExpGroup(sbm_base, corpus=net_w, testset_ratio=20, model=[
                                 'rescal_als', 'sbm_gt', 'wsbm_gt'], _refdir='roc5')
    roc_visu_full = ExpGroup([eta4_full, roc_visu_sbm_full])
    roc_visu_final10 = ExpGroup([eta2_b, eta2_w, eta2a_w, roc_visu_sbm])
    roc_visu_final50 = ExpGroup([eta2_b50, eta2_w50, eta2a_w50, roc_visu_sbm])
    roc_visu_final = roc_visu_final50

    roc_visu_final2 = ExpGroup([eta2_b50, eta2_w50, eta2a_w50], _refdir="roc5v")
    roc_visu_final2 = ExpGroup([roc_visu_final2, roc_visu_sbm])
    roc_visu_final2_full = ExpGroup([roc_visu_final2, roc_visu_sbm_full])

    roc_visu_final3 = ExpGroup([eta2_b50, eta1_w50, eta2a_w50], _refdir="roc5v")
    roc_visu_final3 = ExpGroup([roc_visu_final3, roc_visu_sbm])

    online_roc = ExpGroup(roc_visu_final3, training_ratio=[1, 5, 10, 20, 30, 50, 100], _refdir='online1w', corpus=net_final,
                          _seed='corpus', testset_ratio=20,
                          _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}--{training_ratio}',
                         )

    online_roc_ = ExpGroup([eta2_b50, eta2a_w50, roc_visu_sbm], training_ratio=[1, 5, 10, 20, 30, 50, 100], _refdir='online1w', corpus=net_final,
                           _seed='corpus', testset_ratio=20,
                           _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}--{training_ratio}',
                         )

    online_roc_sbm = ExpGroup(roc_visu_sbm, training_ratio=[1, 5, 10, 20, 30, 50, 100], _refdir='online1w', corpus=net_final,
                              _seed='corpus', testset_ratio=20,
                              _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}--{training_ratio}',
                         )

    online_roc_mmsb = ExpGroup([eta2_b50, eta1_w50, eta2a_w50], training_ratio=[1, 5, 10, 20, 30, 50, 100], _refdir='online1w', corpus=net_final,
                               _seed='corpus', testset_ratio=20,
                               _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}--{training_ratio}',
                         )

    online_roc_w = ExpGroup([eta1_w50, eta2a_w50, wsbm_base], training_ratio=[1, 5, 10, 20, 30, 50, 100], _refdir='online1w', corpus=net_final,
                            _seed='corpus', testset_ratio=20,
                            _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}--{training_ratio}',
                         )

    online_roc_wm = ExpGroup([eta1_w50, eta2a_w50], training_ratio=[1, 5, 10, 20, 30, 50, 100], _refdir='online1w', corpus=net_final,
                             _seed='corpus', testset_ratio=20,
                             _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}--{training_ratio}',
                            )

    online_roc_wsbm = ExpGroup([wsbm_base], training_ratio=[1, 5, 10, 20, 30, 50, 100], _refdir='online1w', corpus=net_final,
                               _seed='corpus', testset_ratio=20,
                               _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}--{training_ratio}',
                         )

    roc_w = ExpGroup([eta0_w, eta1_w, eta2_w, eta0_w50, eta1_w50, eta2_w50]) # squared weight
    roc_b = ExpGroup(eta2_base, model="immsb_scvb3", zeros_set_prob=1/2, zeros_set_len=[10, 50], delta='auto')

    conv_w = ExpGroup([eta0_w50, eta1_w50, eta2_w50, eta2a_w50], corpus=['astro-ph', 'enron', 'munmun_digg_reply'])

    param1 = ExpGroup(eta2a_w50, c0=[0.5, 1, 10, 100], r0=[0.1, 0.5, 1])
    gap = ExpGroup([param1], _refdir='gap_hyper', testset_ratio=20, corpus=net_w,
                   ce=[100], eps=[1e-6],
                   _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}-{c0}-{r0}-{ce}-{eps}',
                  )

    gap_visu = ExpGroup([eta2a_w50], _refdir='gap_hyper', testset_ratio=20, corpus=net_w,
                        ce=[1, 10, 100], eps=[1e-5, 1e-6, 1e-7],
                        c0=10, r0=1,
                        _format='{corpus}_{model}_{N}_{K}_{hyper}_{h**o}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}_{delta}_{zeros_set_len}_{zeros_set_prob}-{c0}-{r0}-{ce}-{eps}',
                  )
예제 #7
0
class Netw2(ExpDesign):

    data_net_all = Corpus([
        'manufacturing', 'fb_uc', 'blogs', 'emaileu', 'propro', 'euroroad',
        'generator7', 'generator12', 'generator10', 'generator4'
    ])
    net_all = data_net_all + Corpus(['clique6', 'BA'])

    # compare perplexity and rox curve from those baseline.
    compare_scvb = ExpTensor(
        corpus=['clique6', 'BA'],
        model=['immsb_cgs', 'ilfm_cgs', 'rescal', 'immsb_cvb'],
        N=200,
        K=6,
        iterations=30,
        hyper='auto',
        testset_ratio=20,
        h**o=0,
        mask='unbalanced',
        _data_type='networks',
        _refdir='debug_scvb',
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}',
        _csv_typo=
        '_iteration time_it _entropy _entropy_t _K _alpha _gmma alpha_mean delta_mean alpha_var delta_var'
    )
    compare_scvb_m = ExpGroup(compare_scvb, model=['immsb_cgs', 'immsb_cvb'])
    cvb = ExpGroup(compare_scvb, model='immsb_cvb')

    scvb = ExpTensor(
        corpus=['BA'],
        model='immsb_scvb',
        N=200,
        chunk='adaptative_1',
        K=6,
        iterations=3,
        hyper='auto',
        testset_ratio=20,
        #chi_a = 1,
        #tau_a = 42,
        kappa_a=0.75,
        #chi_b = 42,
        #tau_b = 300,
        #kappa_b = 0.9,
        h**o=0,
        mask='unbalanced',
        _data_type='networks',
        _refdir='debug_scvb',
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}_{chunk}',
        _csv_typo=
        '_iteration time_it _entropy _entropy_t _K _chi_a _tau_a _kappa_a _chi_b _tau_b _kappa_b _elbo _roc'
    )
    scvb_t = ExpGroup(scvb, _refdir='debug_')

    scvb_chi = ExpGroup(
        scvb,
        chi_a=1,
        tau_a=42,
        kappa_a=[0.6, 0.7, 0.9],
        chi_b=42,
        tau_b=300,
        kappa_b=[0.6, 0.7, 0.9],
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}'
    )

    scvb_chi2 = ExpGroup(
        scvb,
        chi_a=[10],
        tau_a=[100],
        kappa_a=[0.6],
        chi_b=[10],
        tau_b=[500],
        kappa_b=[0.9],
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}'
    )

    scvb_chi_2 = ExpGroup(
        scvb,
        chi_a=[1, 10],
        tau_a=[42, 100, 500],
        kappa_a=[0.6],
        chi_b=[1, 10],
        tau_b=[42, 100, 500],
        kappa_b=[0.6, 0.7, 0.9],
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}_{chunk}_{chi_a}-{tau_a}-{kappa_a}_{chi_b}-{tau_b}-{kappa_b}'
    )

    #
    #
    #
    # * iter1 : don"t set masked, and gamma is not symmetric
    #
    # * iter2 : don"t set masked, and gamma is symmetric
    #
    #
    #

    scvb1_chi_a = ExpTensor(
        corpus=['blogs', 'manufacturing', 'generator7', 'generator10'],
        model='immsb_scvb',
        N='all',
        chunk='adaptative_1',
        K=6,
        iterations=1,
        hyper='auto',
        testset_ratio=20,
        chi_a=[0.5, 1, 2, 10],
        tau_a=[0.5, 1, 2, 16, 64, 256, 1024],
        kappa_a=[0.51, 0.45, 1],
        #h**o = 0,
        #mask = 'unbalanced',
        _data_type='networks',
        _refdir='debug_scvb_chia_i1',
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}_{chunk}-{_name}-{_id}',
        _csv_typo=
        '_iteration time_it _entropy _entropy_t _K _chi_a _tau_a _kappa_a _chi_b _tau_b _kappa_b'
    )

    scvb1_chi_b = ExpTensor(
        corpus=['blogs', 'manufacturing', 'generator7', 'generator10'],
        model='immsb_scvb',
        N='all',
        chunk='adaptative_1',
        K=6,
        iterations=1,
        hyper='auto',
        testset_ratio=20,
        chi_b=[0.5, 1, 2, 10],
        tau_b=[0.5, 1, 2, 16, 64, 256, 1024],
        kappa_b=[0.51, 0.45, 1],
        #h**o = 0,
        #mask = 'unbalanced',
        _data_type='networks',
        _refdir='debug_scvb_chib_i1',
        _format=
        '{corpus}_{model}_{N}_{K}_{iterations}_{hyper}_{h**o}_{mask}_{testset_ratio}_{chunk}-{_name}-{_id}',
        _csv_typo=
        '_iteration time_it _entropy _entropy_t _K _chi_a _tau_a _kappa_a _chi_b _tau_b _kappa_b'
    )

    # Noel expe
    noel = ExpGroup([scvb, compare_scvb],
                    N='all',
                    corpus=data_net_all,
                    mask=['balanced', 'unbalanced'],
                    _refdir='noel')

    noel_cvb = ExpGroup(cvb,
                        N='all',
                        corpus=data_net_all,
                        mask=['balanced', 'unbalanced'],
                        _refdir='noel')
    noel_scvb = ExpGroup(scvb,
                         N='all',
                         corpus=data_net_all,
                         mask=['balanced', 'unbalanced'],
                         _refdir='noel')
    noel_scvb_ada = ExpGroup(noel_scvb,
                             chunk=[
                                 'adaptative_0.1', 'adaptative_0.5',
                                 'adaptative_1', 'adaptative_10'
                             ])

    noel_mmsb = ExpGroup([scvb, compare_scvb_m],
                         N='all',
                         corpus=data_net_all,
                         mask=['balanced', 'unbalanced'],
                         _refdir='noel')

    compare_scvb2 = ExpGroup(compare_scvb,
                             N='all',
                             corpus=data_net_all,
                             iterations=100,
                             mask=['balanced', 'unbalanced'],
                             _refdir='noel2')

    noel3 = ExpGroup(scvb_chi2,
                     N='all',
                     chunk=['adaptative_0.1', 'adaptative_1'],
                     corpus=data_net_all,
                     mask=['unbalanced'],
                     _refdir='noel3')

    # cvb debug
    pd = ExpGroup(compare_scvb,
                  iterations=150,
                  model='immsb_cvb',
                  _repeat='debug_cvb',
                  N='all',
                  corpus=data_net_all,
                  mask=['unbalanced'],
                  _refdir='noel2')

    pd2n = ExpGroup(compare_scvb,
                    iterations=150,
                    model='immsb_cvb',
                    _repeat='debug_cvb_2n',
                    N='all',
                    corpus=data_net_all,
                    mask=['unbalanced'],
                    _refdir='noel2')
예제 #8
0
class Aistats19(ExpDesign):

    _alias = {
        'ml.iwmmsb_scvb3': 'WMMSB-bg',
        'ml.immsb_scvb3': 'MMSB',
        'ml.sbm_gt': 'SBM',
        'ml.wsbm_gt': 'WSBM',
        'ml.sbm_ai': 'SBM-ai',
        'ml.wsbm_ai_n': 'WSBM-ai-n',
        'ml.wsbm_ai_p': 'WSBM-ai-p',
        'ml.epm': 'EPM',
        'link-dynamic-simplewiki': 'wiki-link',
        'munmun_digg_reply': 'digg-reply',
        'slashdot-threads': 'slashdot',
    }

    net_final = Corpus([
        'fb_uc',
        #'manufacturing',
        'hep-th',
        'link-dynamic-simplewiki',
        'enron',
        'slashdot-threads',
        'prosper-loans',
        'munmun_digg_reply',
        'moreno_names',
        'astro-ph'
    ])

    base_graph = dict(
        corpus='manufacturing',
        _seed='corpus',
        testset_ratio=20,
        validset_ratio=10,
        training_ratio=100,

        # Model global param
        N='all',
        K=10,
        kernel='none',

        # plotting
        fig_legend=4,
        legend_size=7,
        #ticks_size = 20,
        title_size=18,
        fig_xaxis=('time_it', 'time'),
        fig_yaxis=dict(wsim='MSE'),
        driver='gt',  # graph-tool driver
        _write=True,
        _data_type='networks',
        _refdir='aistat_wmmsb2',
        _format="{model}-{kernel}-{K}_{corpus}-{training_ratio}",
        _measures=[
            'time_it',
            'entropy@data=valid',
            'roc@data=test',
            #'roc@data=test&measure_freq=10',
            'pr@data=test&measure_freq=20',
            'wsim@data=test&measure_freq=10',
            'roc2@data=test&measure_freq=10',
            'wsim2@data=test&measure_freq=10',
        ],
    )

    sbm_peixoto = ExpTensor(base_graph, model='sbm_gt')
    wsbm_peixoto = ExpTensor(base_graph, model='wsbm_gt')
    rescal_als = ExpTensor(base_graph, model='rescal_als')

    wsbm = ExpTensor(
        base_graph,
        model='sbm_aicher',
        kernel=['bernoulli', 'normal', 'poisson'],
        #kernel = 'normal',
        mu_tol=0.001,
        tau_tol=0.001,
        max_iter=100,
    )

    wsbm_1 = ExpTensor(
        wsbm,
        model='sbm_ai',
        _model='ml.sbm_aicher',
        #model='ml.sbm_aicher',
        kernel='bernoulli',
    )
    wsbm_2 = ExpTensor(
        wsbm,
        model='wsbm_ai_n',
        _model='ml.sbm_aicher',
        #model='ml.sbm_aicher',
        kernel='normal',
    )
    wsbm_3 = ExpTensor(
        wsbm,
        model='wsbm_ai_p',
        _model='ml.sbm_aicher',
        #, model='ml.sbm_aicher',
        kernel='poisson',
    )
    wsbm_t = ExpGroup([wsbm_1, wsbm_2, wsbm_3])

    wmmsb = ExpTensor(
        base_graph,
        model="iwmmsb_scvb3",
        chunk='stratify',
        delta='auto',
        sampling_coverage=0.5,
        zeros_set_prob=1 / 2,
        zeros_set_len=50,
        chi_a=1,
        tau_a=1024,
        kappa_a=0.5,
        chi_b=1,
        tau_b=1024,
        kappa_b=0.5,
        tol=0.001,
        #fig_xaxis = ('_observed_pt', 'visited edges'),
    )
    mmsb = ExpTensor(wmmsb, model="immsb_scvb3")
    epm = ExpTensor(wmmsb, model="epm")

    aistats_design_wmmsb = ExpGroup(
        [wmmsb],
        corpus=net_final,
        training_ratio=[1, 5, 10, 20, 30, 50, 100],  # subsample the edges
        _refdir="ai19_1",
    )
    aistats_design_mmsb = ExpGroup(
        [mmsb],
        corpus=net_final,
        training_ratio=[1, 5, 10, 20, 30, 50, 100],  # subsample the edges
        _refdir="ai19_1",
    )
    aistats_design_mm = ExpGroup([aistats_design_wmmsb, aistats_design_mmsb])

    aistats_design_wsbm = ExpGroup(
        [wsbm],
        corpus=net_final,
        training_ratio=[1, 5, 10, 20, 30, 50, 100],  # subsample the edges
        _refdir="ai19_1",
    )

    aistats_design_peixoto = ExpGroup(
        [sbm_peixoto, wsbm_peixoto],
        corpus=net_final,
        training_ratio=[1, 5, 10, 20, 30, 50, 100],  # subsample the edges
        _refdir="ai19_1",
    )

    aistats_design_final = ExpGroup(
        [wmmsb, mmsb, wsbm_t, sbm_peixoto, wsbm_peixoto],
        corpus=net_final,
        training_ratio=[1, 5, 10, 20, 30, 50, 100],  # subsample the edges
        _refdir="ai19_1",
    )

    aistats_design_final_2 = ExpGroup(
        [wmmsb, mmsb, wsbm_t, sbm_peixoto, wsbm_peixoto, epm],
        corpus=net_final,
        K=[20, 30, 50],
        training_ratio=[100],  # subsample the edges
        _refdir="ai19_1",
    )

    #
    #
    # Post expe Fix
    #
    #

    aistats_compute_zcp_w_tmp = ExpGroup(
        [wmmsb],
        corpus=net_final,
        K=[20, 30, 50],
        training_ratio=[100],  # subsample the edges
        _refdir="ai19_1",
    )
    aistats_compute_zcp_a_tmp = ExpGroup(
        [wsbm_3],
        corpus=net_final,
        K=[20, 30, 50],
        training_ratio=[100],  # subsample the edges
        _refdir="ai19_1",
    )

    aistats_compute_wsim4 = ExpGroup(
        [wsbm_t, sbm_peixoto, wsbm_peixoto],
        corpus=net_final,
        K=[10],
        training_ratio=[100],  # subsample the edges
        _refdir="ai19_1",
    )

    aistats_doh = ExpGroup(
        [epm],
        corpus=net_final,
        K=[20],
        training_ratio=[100],  # subsample the edges
        _refdir="ai19_1",
    )