Beispiel #1
0
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print "Loading data ..."
    data = misc.load_data(dataset)

    # set sigma to something useful
    from milk.unsupervised import pdist

    sigma = np.median(pdist(data[0]))

    print "Done, %s samples with %s features loaded into " "memory" % data[0].shape

    score, res_shogun = misc.bench(bench_shogun, data)
    print "Shogun: mean %.2f, std %.2f" % (np.mean(res_shogun), np.std(res_shogun))
    print "Score: %.2f\n" % score

    score, res_mdp = misc.bench(bench_mdp, data)
    print "MDP: mean %.2f, std %.2f" % (np.mean(res_mdp), np.std(res_mdp))
    print "Score: %.2f\n" % score

    score, res_skl = misc.bench(bench_skl, data)
    print "scikits.learn: mean %.2f, std %.2f" % (np.mean(res_skl), np.std(res_skl))
    print "Score: %.2f\n" % score

    score, res_mlpy = misc.bench(bench_mlpy, data)
    print "MLPy: mean %.2f, std %.2f" % (np.mean(res_mlpy), np.std(res_mlpy))
    print "Score: %.2f\n" % score
    start = datetime.now()
    clf = linear_model.LogisticRegression()
    clf.fit(X, y)
    score = np.mean(clf.predict(T) == valid)
    return score, datetime.now() - start


if __name__ == '__main__':
    import sys, misc

    # don't bother me with warnings
    import warnings; warnings.simplefilter('ignore')
    np.seterr(all='ignore')

    print __doc__ + '\n'
    if not len(sys.argv) == 2:
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)

    print 'Done, %s samples with %s features loaded into ' \
      'memory' % data[0].shape

    res_skl = misc.bench(bench_skl, data)
    print 'MLPy: mean %.2f, std %.2f\n' % (
        np.mean(res_skl), np.std(res_skl))
Beispiel #3
0
        ]
    elif dataset == 'cover_type':
        array_data = [misc.load_cover_type(RND_SEED)]
    elif dataset == 'higgs':
        # We will select some samples for higgs as well
        array_data = [
            misc.load_higgs(random_state=RND_SEED, n_samples=ns)
            for ns in N_SAMPLES
        ]
    else:
        raise ValueError('The dataset is not known. The possible choices are:'
                         ' random')

    # Save only the time for the moment
    res_xgb = [[data[0].shape, p,
                misc.bench(bench_xgb, data, n=n_try, **p)] for p in params_list
               for data in array_data]

    # Check that the path is existing
    if not os.path.exists(store_dir):
        os.makedirs(store_dir)

    # Define the name depending of the type of classifier used
    if type_tree == 'exact':
        filename = 'xgboost_exact_nocache_' + dataset + '.pk'
    elif type_tree == 'approx-global':
        filename = 'xgboost_approx_global_' + dataset + '.pk'
    elif type_tree == 'approx-local':
        filename = 'xgboost_approx_local_' + dataset + '.pk'

    store_filename = os.path.join(store_dir, filename)
Beispiel #4
0
    if dataset == 'random':
        array_data = [
            misc.generate_samples(ns, nf, RND_SEED) for ns in N_SAMPLES
            for nf in N_FEATURES
        ]
    elif dataset == 'cover_type':
        array_data = [misc.load_cover_type(RND_SEED)]
    elif dataset == 'higgs':
        # Select a subset of samples
        array_data = [
            misc.load_higgs(random_state=RND_SEED, n_samples=ns)
            for ns in N_SAMPLES
        ]
    else:
        raise ValueError('The dataset is not known. The possible choices are:'
                         ' random')

    # Save only the time for the moment
    res_lgbm = [[data[0].shape, p,
                 misc.bench(bench_lgbm, data, n=n_try, **p)]
                for p in params_list for data in array_data]

    # Check that the path is existing
    if not os.path.exists(store_dir):
        os.makedirs(store_dir)

    filename = 'lightgbm_' + dataset + '.pk'
    store_filename = os.path.join(store_dir, filename)

    joblib.dump(res_lgbm, store_filename)
Beispiel #5
0
    np.seterr(all='ignore')

    print __doc__ + '\n'
    if not len(sys.argv) == 2:
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)

    print 'Done, %s samples with %s features loaded into ' \
      'memory' % data[0].shape

    score, res_mdp = misc.bench(bench_mdp, data)
    print 'MDP: mean %s, std %s' % (
        np.mean(res_mdp), np.std(res_mdp))
    print 'Explained variance: %s\n'% score

    score, res_skl = misc.bench(bench_skl, data)
    print 'scikits.learn: mean %.2f, std %.2f' % (
        np.mean(res_skl), np.std(res_skl))
    print 'Explained variance: %s\n'% score

    score, res_pybrain = misc.bench(bench_pybrain, data)
    print 'Pybrain: mean %s, std %s' % (
        np.mean(res_pybrain), np.std(res_pybrain))
    print 'Explained variance: %s\n'% score

    score, res_milk = misc.bench(bench_milk, data)
    import sys, misc

    # don't bother me with warnings
    import warnings; warnings.simplefilter('ignore')
    np.seterr(all='ignore')

    print __doc__ + '\n'

    if not len(sys.argv) == 2:
        print misc.USAGE
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)
    print 'Done, %s samples with %s features loaded into ' \
          'memory' % data[0].shape

    score, res_skl = misc.bench(bench_skl, data)
    print 'scikits.learn: mean %s, std %s' % (res_skl.mean(), res_skl.std())
    print 'MSE ', score

    score, res_mlpy = misc.bench(bench_mlpy, data)
    print 'MLPy: mean %s, std %s' % (res_mlpy.mean(), res_mlpy.std())
    print 'MSE ', score

    score, res_pymvpa = misc.bench(bench_pymvpa, data)
    print 'PyMVPA: mean %s, std %s' % (res_pymvpa.mean(), res_pymvpa.std())
    print 'MSE ', score
    import warnings
    warnings.simplefilter('ignore')
    np.seterr(all='ignore')

    print __doc__ + '\n'
    if not len(sys.argv) == 2:
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)

    print 'Done, %s samples with %s features loaded into ' \
      'memory' % data[0].shape

    score, res_skl = misc.bench(bench_skl, data)
    print 'scikits.learn: mean %.2f, std %.2f' % (np.mean(res_skl),
                                                  np.std(res_skl))
    print 'MSE: %s\n' % score

    score, res_mlpy = misc.bench(bench_mlpy, data)
    print 'MLPy: mean %.2f, std %.2f' % (np.mean(res_mlpy), np.std(res_mlpy))
    print 'MSE: %s\n' % score

    score, res_pymvpa = misc.bench(bench_pymvpa, data)
    print 'PyMVPA: mean %.2f, std %.2f' % (np.mean(res_pymvpa),
                                           np.std(res_pymvpa))
    print 'MSE: %s\n' % score
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)

    # set sigma to something useful
    from milk.unsupervised import pdist
    sigma = np.median(pdist(data[0]))

    print 'Done, %s samples with %s features loaded into ' \
      'memory' % data[0].shape

    score, res_shogun = misc.bench(bench_shogun, data)
    print 'Shogun: mean %.2f, std %.2f' % (
        np.mean(res_shogun), np.std(res_shogun))
    print 'Score: %.2f\n' % score

    score, res_mdp = misc.bench(bench_mdp, data)
    print 'MDP: mean %.2f, std %.2f' % (
        np.mean(res_mdp), np.std(res_mdp))
    print 'Score: %.2f\n' % score

    score, res_skl = misc.bench(bench_skl, data)
    print 'scikits.learn: mean %.2f, std %.2f' % (
        np.mean(res_skl), np.std(res_skl))
    print 'Score: %.2f\n' % score

    score, res_mlpy = misc.bench(bench_mlpy, data)
    np.seterr(all='ignore')

    print __doc__ + '\n'
    if not len(sys.argv) == 2:
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)

    print 'Done, %s samples with %s features loaded into ' \
      'memory' % data[0].shape

    score, res_mdp = misc.bench(bench_mdp, data)
    print 'MDP: mean %s, std %s' % (np.mean(res_mdp), np.std(res_mdp))
    print 'Explained variance: %s\n' % score

    score, res_skl = misc.bench(bench_skl, data)
    print 'scikits.learn: mean %.2f, std %.2f' % (np.mean(res_skl),
                                                  np.std(res_skl))
    print 'Explained variance: %s\n' % score

    score, res_pybrain = misc.bench(bench_pybrain, data)
    print 'Pybrain: mean %s, std %s' % (np.mean(res_pybrain),
                                        np.std(res_pybrain))
    print 'Explained variance: %s\n' % score

    score, res_milk = misc.bench(bench_milk, data)
    print 'milk: mean %s, std %s' % (np.mean(res_milk), np.std(res_milk))
if __name__ == '__main__':

    import sys, misc

    # don't bother me with warnings
    import warnings; warnings.simplefilter('ignore')
    np.seterr(all='ignore')

    print __doc__ + '\n'

    if not len(sys.argv) == 2:
        print misc.USAGE
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)
    print 'Done, %s samples with %s features loaded into ' \
          'memory' % data[0].shape

##    score, res_skl = misc.bench(bench_skl, data)
##    print 'scikits.learn: mean %s, std %s' % (res_skl.mean(), res_skl.std())

    score, res_mlpy = misc.bench(bench_mlpy, data)
    print 'MLPy: mean %s, std %s' % (res_mlpy.mean(), res_mlpy.std())

##    score, res_pymvpa = misc.bench(bench_pymvpa, data)
##    print 'PyMVPA: mean %s, std %s' % (res_pymvpa.mean(), res_pymvpa.std())
Beispiel #11
0
#
    from milk.unsupervised import pca as milk_pca
    start = datetime.now()
    _ = milk_pca(X)
    return datetime.now() - start


if __name__ == '__main__':

    # don't bother me with warnings
    import warnings; warnings.simplefilter('ignore')
    np.seterr(all='ignore')

    print __doc__ + '\n'

    res_mdp = bench(bench_mdp)
    print 'MDP: mean %s, std %s' % (
        np.mean(res_mdp), np.std(res_mdp))

    res_skl = bench(bench_skl)
    print 'scikits.learn: mean %s, std %s' % (
        np.mean(res_skl), np.std(res_skl))

    res_pybrain = bench(bench_pybrain)
    print 'Pybrain: mean %s, std %s' % (
        np.mean(res_pybrain), np.std(res_pybrain))

    res_milk = bench(bench_milk)
    print 'milk: mean %s, std %s' % (
        np.mean(res_milk), np.std(res_milk))
Beispiel #12
0
    np.seterr(all='ignore')

    print __doc__ + '\n'
    if not len(sys.argv) == 2:
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)

    print 'Done, %s samples with %s features loaded into ' \
      'memory' % data[0].shape

    score, res_shogun = misc.bench(bench_shogun, data)
    print 'Shogun: mean %.2f, std %.2f' % (
        np.mean(res_shogun), np.std(res_shogun))
    print 'Score: %2f\n' % score

    score, res_mdp = misc.bench(bench_mdp, data)
    print 'MDP: mean %.2f, std %.2f' % (
        np.mean(res_mdp), np.std(res_mdp))
    print 'Score: %2f\n' % score

    score, res_skl = misc.bench(bench_skl, data)
    print 'scikits.learn: mean %.2f, std %.2f' % (
        np.mean(res_skl), np.std(res_skl))
    print 'Score: %2f\n' % score

    score, res_mlpy = misc.bench(bench_mlpy, data)
Beispiel #13
0
    np.seterr(all='ignore')

    print __doc__ + '\n'
    if not len(sys.argv) == 2:
        print misc.USAGE % __file__
        sys.exit(-1)
    else:
        dataset = sys.argv[1]

    print 'Loading data ...'
    data = misc.load_data(dataset)

    print 'Done, %s samples with %s features loaded into ' \
      'memory' % data[0].shape

    res_shogun = misc.bench(bench_shogun, data)
    print 'Shogun: mean %.2f, std %.2f\n' % (res_shogun.mean(), res_shogun.std())

    res_mdp = misc.bench(bench_mdp, data)
    print 'MDP: mean %.2f, std %.2f\n' % (res_mdp.mean(), res_mdp.std())

    res_skl = misc.bench(bench_skl, data)
    print 'scikits.learn: mean %.2f, std %.2f\n' % (res_skl.mean(), res_skl.std())

    res_mlpy = misc.bench(bench_mlpy, data)
    print 'MLPy: mean %.2f, std %.2f\n' % (res_mlpy.mean(), res_mlpy.std())

    res_milk = misc.bench(bench_milk, data)
    print 'milk: mean %.2f, std %.2f\n' % (res_milk.mean(), res_milk.std())

    res_pymvpa = misc.bench(bench_pymvpa, data)