예제 #1
0
twentynews_home = '../datasets/20news'
sraa_home = '../datasets/SRAA'
reuters_home = '../datasets/Reuters21578'

rperf = Result([
    'dataset', 'task', 'method', 'acc', 'pivot_t', 'dci_t', 'svm_t', 'test_t'
])
for source, target, task, dataset in \
        Topic_task_generator(reuters_home=reuters_home, sraa_home=sraa_home, twenty_home=twentynews_home):

    s_pivots, t_pivots, pivot_time = pivot_selection_timed(npivots,
                                                           source.X,
                                                           source.y,
                                                           source.U,
                                                           target.U,
                                                           source.V,
                                                           target.V,
                                                           phi=1,
                                                           cross=True,
                                                           show=min(
                                                               10, npivots))

    dci = DCI(dcf=dcf, unify=True, post='normal')
    acc, dci_time, svm_time, test_time = DCIinduction(source,
                                                      target,
                                                      s_pivots,
                                                      t_pivots,
                                                      dci,
                                                      optimize=True)

    rperf.add(dataset=dataset,
optimize = True

dataset_home = '../datasets/Webis-CLS-10'

rperf = Result([
    'dataset', 'task', 'method', 'acc', 'pivot_t', 'dci_t', 'svm_t', 'test_t'
])
for source, target, oracle, taskname in WebisCLS10_crossdomain_crosslingual_task_generator(
        os.path.abspath(dataset_home)):

    s_pivots, t_pivots, pivot_time = pivot_selection_timed(npivots,
                                                           source.X,
                                                           source.y,
                                                           source.U,
                                                           target.U,
                                                           source.V,
                                                           target.V,
                                                           oracle=oracle,
                                                           phi=30,
                                                           show=min(
                                                               10, npivots),
                                                           cross=True)

    dci = DCI(dcf=dcf, unify=True, post='normal')
    acc, dci_time, svm_time, test_time = DCIinduction(source,
                                                      target,
                                                      s_pivots,
                                                      t_pivots,
                                                      dci,
                                                      optimize=optimize)

    rperf.add(dataset='Webis-CLS-10',