Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | DA-Transformer-main/fs_plugins/models/glat_decomposed_with_link.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 59,479 | 51.54417 | 229 | py |
null | DA-Transformer-main/fs_plugins/models/hub_interface.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 9,619 | 38.265306 | 143 | py |
null | DA-Transformer-main/fs_plugins/models/ls_glat_decomposed_with_link.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 18,592 | 44.795567 | 139 | py |
null | DA-Transformer-main/fs_plugins/models/ls_nat_decoder.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 5,346 | 39.203008 | 84 | py |
null | DA-Transformer-main/fs_plugins/models/ls_transformer.py | # Modified from https://github.com/bytedance/lightseq/blob/812d9d798e491ab9139c1f36113693308c4c0637/lightseq/training/cli/fs_modules/ls_transformer.py
# Licensed under the Apache License, Version 2 by the authors of LightSeq
import math
from typing import Dict, List, Optional
import torch
from torch._C import Value
im... | 29,714 | 44.50536 | 187 | py |
null | DA-Transformer-main/fs_plugins/optimizer/__init__.py | import os
import importlib
# automatically import any Python files in the criterions/ directory
for file in os.listdir(os.path.dirname(__file__)):
if file.endswith(".py") and not file.startswith("_"):
file_name = file[: file.find(".py")]
importlib.import_module("fs_plugins.optimizer." + file_name)
| 320 | 34.666667 | 68 | py |
null | DA-Transformer-main/fs_plugins/optimizer/ls_adam.py | # Modified from https://github.com/bytedance/lightseq/blob/812d9d798e491ab9139c1f36113693308c4c0637/lightseq/training/cli/fs_modules/ls_adam.py
# Licensed under the Apache License, Version 2, by the authors of LightSeq
import logging
import math
from dataclasses import dataclass, field
from typing import List, Any
im... | 3,125 | 34.123596 | 143 | py |
null | DA-Transformer-main/fs_plugins/scripts/__init__.py | 0 | 0 | 0 | py | |
null | DA-Transformer-main/fs_plugins/scripts/_convert_utils.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 14,769 | 44.869565 | 113 | py |
null | DA-Transformer-main/fs_plugins/scripts/average_checkpoints.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This file is from https://github.com/facebookresearch/fairseq/blob/b5a039c292facba9c73f59ff34621ec131d82341/scripts/a... | 8,183 | 37.422535 | 140 | py |
null | DA-Transformer-main/fs_plugins/scripts/convert_fs_to_ls.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 2,614 | 37.455882 | 149 | py |
null | DA-Transformer-main/fs_plugins/scripts/convert_ls_to_fs.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 2,613 | 37.441176 | 152 | py |
null | DA-Transformer-main/fs_plugins/scripts/extract_model_state.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 3,019 | 37.227848 | 151 | py |
null | DA-Transformer-main/fs_plugins/scripts/test_tradeoff.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 6,964 | 43.363057 | 143 | py |
null | DA-Transformer-main/fs_plugins/tasks/__init__.py | import os
import importlib
# automatically import any Python files in the criterions/ directory
for file in os.listdir(os.path.dirname(__file__)):
if file.endswith(".py") and not file.startswith("_"):
file_name = file[: file.find(".py")]
importlib.import_module("fs_plugins.tasks." + file_name)
| 316 | 34.222222 | 68 | py |
null | DA-Transformer-main/fs_plugins/tasks/translation_dat.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 36,149 | 43.519704 | 239 | py |
null | DA-Transformer-main/fs_plugins/tasks/translation_dat_dataset.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 25,799 | 44.342707 | 170 | py |
null | DA-Transformer-main/fs_plugins/tasks/translation_dat_dict.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 2,396 | 30.539474 | 105 | py |
null | DA-Transformer-main/fs_plugins/tasks/translation_dat_generator.py | ##########################################################################
# Copyright (C) 2022 COAI @ Tsinghua University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www... | 4,897 | 32.319728 | 151 | py |
null | DA-Transformer-main/scripts/__init__.py | 0 | 0 | 0 | py | |
null | DA-Transformer-main/scripts/average_checkpoints.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import collections
import os
import re
import torch
from fairseq.file_io import PathManager
def aver... | 7,780 | 37.519802 | 126 | py |
null | DA-Transformer-main/scripts/build_sym_alignment.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Use this script in order to build symmetric alignments for your translation
dataset.
This script depends on fast_align and mosesdecoder too... | 3,796 | 37.744898 | 88 | py |
null | DA-Transformer-main/scripts/compare_namespaces.py | #!/usr/bin/env python
"""Helper script to compare two argparse.Namespace objects."""
from argparse import Namespace # noqa
def main():
ns1 = eval(input("Namespace 1: "))
ns2 = eval(input("Namespace 2: "))
def keys(ns):
ks = set()
for k in dir(ns):
if not k.startswith("_"):
... | 1,090 | 22.212766 | 88 | py |
null | DA-Transformer-main/scripts/compound_split_bleu.sh | #!/bin/bash
if [ $# -ne 1 ]; then
echo "usage: $0 GENERATE_PY_OUTPUT"
exit 1
fi
GEN=$1
SYS=$GEN.sys
REF=$GEN.ref
if [ $(tail -n 1 $GEN | grep BLEU | wc -l) -ne 1 ]; then
echo "not done generating"
exit
fi
grep ^H $GEN | awk -F '\t' '{print $NF}' | perl -ple 's{(\S)-(\S)}{$1 ##AT##-##AT## $2}g' > $S... | 439 | 19.952381 | 96 | sh |
null | DA-Transformer-main/scripts/convert_dictionary.lua | -- Copyright (c) Facebook, Inc. and its affiliates.
--
-- This source code is licensed under the MIT license found in the
-- LICENSE file in the root directory of this source tree.
--
-- Usage: convert_dictionary.lua <dict.th7>
require 'fairseq'
require 'torch'
require 'paths'
if #arg < 1 then
print('usage: convert... | 787 | 21.514286 | 66 | lua |
null | DA-Transformer-main/scripts/convert_model.lua | -- Copyright (c) Facebook, Inc. and its affiliates.
--
-- This source code is licensed under the MIT license found in the
-- LICENSE file in the root directory of this source tree.
--
-- Usage: convert_model.lua <model_epoch1.th7>
require 'torch'
local fairseq = require 'fairseq'
model = torch.load(arg[1])
function f... | 3,423 | 30.412844 | 87 | lua |
null | DA-Transformer-main/scripts/count_docs.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Count the number of documents and average number of lines and tokens per
document in a large file. Documents should ... | 1,784 | 29.254237 | 79 | py |
null | DA-Transformer-main/scripts/read_binarized.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from fairseq.data import Dictionary, data_utils, indexed_dataset
def get_parser():
parser = argp... | 1,370 | 26.979592 | 103 | py |
null | DA-Transformer-main/scripts/rm_pt.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import re
import shutil
import sys
pt_regexp = re.compile(r"checkpoint(\d+|_\d+_\d+|_[a-z]+... | 4,740 | 32.387324 | 96 | py |
null | DA-Transformer-main/scripts/sacrebleu.sh | #!/bin/bash
if [ $# -ne 4 ]; then
echo "usage: $0 TESTSET SRCLANG TGTLANG GEN"
exit 1
fi
TESTSET=$1
SRCLANG=$2
TGTLANG=$3
GEN=$4
if ! command -v sacremoses &> /dev/null
then
echo "sacremoses could not be found, please install with: pip install sacremoses"
exit
fi
grep ^H $GEN \
| sed 's/^H\-//' \
|... | 486 | 16.392857 | 89 | sh |
null | DA-Transformer-main/scripts/shard_docs.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Split a large file into shards while respecting document boundaries. Documents
should be separated by a single empty... | 1,616 | 28.4 | 79 | py |
null | DA-Transformer-main/scripts/split_train_valid_docs.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Split a large file into a train and valid set while respecting document
boundaries. Documents should be separated by... | 2,551 | 28.333333 | 74 | py |
null | DA-Transformer-main/scripts/spm_decode.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
... | 1,520 | 27.166667 | 83 | py |
null | DA-Transformer-main/scripts/spm_encode.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
i... | 3,432 | 27.608333 | 84 | py |
null | DA-Transformer-main/scripts/spm_train.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
impor... | 431 | 24.411765 | 82 | py |
null | DA-Transformer-main/scripts/test_fsdp.sh | #!/usr/bin/env bash
rm -rf fsdp_dummy
mkdir -p fsdp_dummy
CUDA_VISIBLE_DEVICES=0,1,2,3 fairseq-train /private/home/sshleifer/data-bin/stories_mmap \
--ddp-backend fully_sharded --fp16 --fp16-init-scale 4 \
--cpu-offload --checkpoint-activations \
--task language_modeling --tokens-per-sample 256 --batch-size... | 1,257 | 49.32 | 90 | sh |
null | DA-Transformer-main/scripts/constraints/extract.py | #!/usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Extracts random constraints from reference files."""
import argparse
import random
import sys
def get_phrase(wo... | 2,915 | 31.043956 | 88 | py |
null | DA-Transformer-main/scripts/constraints/validate.py | #!/usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
"""Reads in a fairseq output file, and verifies that the constraints
(C- lines) are present in the outpu... | 931 | 25.628571 | 70 | py |
BayesianOptimization | BayesianOptimization-master/README.md | <div align="center">
<img src="https://github.com/fmfn/BayesianOptimization/blob/master/examples/func.png"><br><br>
</div>
# Bayesian Optimization

[,
author='Fernando Nogueira',
author_email="fmfnogueira@gmail.com",
description='Bayesian Optimization package',
... | 663 | 26.666667 | 95 | py |
BayesianOptimization | BayesianOptimization-master/.github/ISSUE_TEMPLATE/bug_report.md | ---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug, enhancement
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
Ex: Using `scipy==1.8` with `bayesian-optimization==1.2.0` results in `TypeError: 'float' object is not subscriptable`.
**To R... | 1,171 | 22.918367 | 119 | md |
BayesianOptimization | BayesianOptimization-master/.github/ISSUE_TEMPLATE/feature_request.md | ---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.
**Describe the solution you'd like**
A clear and concise description of what you... | 778 | 31.458333 | 176 | md |
BayesianOptimization | BayesianOptimization-master/.github/workflows/build_docs.yml | name: build docs
on:
push:
branches:
- master
pull_request:
jobs:
deploy:
runs-on: ubuntu-20.04
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actio... | 1,059 | 22.555556 | 53 | yml |
BayesianOptimization | BayesianOptimization-master/.github/workflows/run_tests.yml | # This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
... | 1,242 | 24.367347 | 122 | yml |
BayesianOptimization | BayesianOptimization-master/bayes_opt/__init__.py | from .bayesian_optimization import BayesianOptimization, Events
from .domain_reduction import SequentialDomainReductionTransformer
from .util import UtilityFunction
from .logger import ScreenLogger, JSONLogger
from .constraint import ConstraintModel
__all__ = [
"BayesianOptimization",
"ConstraintModel",
"U... | 436 | 24.705882 | 66 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/bayesian_optimization.py | import warnings
from bayes_opt.constraint import ConstraintModel
from .target_space import TargetSpace
from .event import Events, DEFAULT_EVENTS
from .logger import _get_default_logger
from .util import UtilityFunction, acq_max, ensure_rng
from sklearn.gaussian_process.kernels import Matern
from sklearn.gaussian_pro... | 11,728 | 34.01194 | 117 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/constraint.py | import numpy as np
from sklearn.gaussian_process.kernels import Matern
from sklearn.gaussian_process import GaussianProcessRegressor
from scipy.stats import norm
class ConstraintModel():
"""
This class takes the function to optimize as well as the parameters bounds
in order to find which values for the pa... | 5,522 | 35.576159 | 79 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/domain_reduction.py | from typing import Optional, Union, List
import numpy as np
from .target_space import TargetSpace
class DomainTransformer():
'''The base transformer class'''
def __init__(self, **kwargs):
pass
def initialize(self, target_space: TargetSpace):
raise NotImplementedError
def transform(... | 5,714 | 37.355705 | 108 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/event.py | class Events:
OPTIMIZATION_START = 'optimization:start'
OPTIMIZATION_STEP = 'optimization:step'
OPTIMIZATION_END = 'optimization:end'
DEFAULT_EVENTS = [
Events.OPTIMIZATION_START,
Events.OPTIMIZATION_STEP,
Events.OPTIMIZATION_END,
]
| 259 | 20.666667 | 45 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/logger.py | from __future__ import print_function
import os
import json
import warnings
from pathlib import Path
from .observer import _Tracker
from .event import Events
from .util import Colours
def _get_default_logger(verbose, is_constrained):
return ScreenLogger(verbose=verbose, is_constrained=is_constrained)
class Scree... | 4,991 | 28.892216 | 88 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/observer.py | """
observers...
"""
from datetime import datetime
from .event import Events
class Observer:
def update(self, event, instance):
raise NotImplementedError
class _Tracker(object):
def __init__(self):
self._iterations = 0
self._previous_max = None
self._previous_max_params = No... | 1,363 | 24.735849 | 67 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/target_space.py | import numpy as np
from .util import ensure_rng, NotUniqueError
from .util import Colours
def _hashable(x):
""" ensure that an point is hashable by a python dict """
return tuple(map(float, x))
class TargetSpace(object):
"""
Holds the param-space coordinates (X) and target values (Y)
Allows for ... | 11,328 | 30.557103 | 116 | py |
BayesianOptimization | BayesianOptimization-master/bayes_opt/util.py | import warnings
import numpy as np
from scipy.stats import norm
from scipy.optimize import minimize
from colorama import just_fix_windows_console
import json
def acq_max(ac, gp, y_max, bounds, random_state, constraint=None, n_warmup=10000, n_iter=10):
"""
A function to find the maximum of the acquisition func... | 9,768 | 29.720126 | 102 | py |
BayesianOptimization | BayesianOptimization-master/docsrc/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 2,377 | 32.971429 | 79 | py |
BayesianOptimization | BayesianOptimization-master/examples/async_optimization.py | import time
import random
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction, Colours
import asyncio
import threading
try:
import json
import tornado.ioloop
import tornado.httpserver
from tornado.web import RequestHandler
import requests
except ImportError:
... | 3,807 | 26.79562 | 90 | py |
BayesianOptimization | BayesianOptimization-master/examples/duplicate_point.py | import numpy as np
from bayes_opt import BayesianOptimization
from bayes_opt import UtilityFunction
def f(x):
return np.exp(-(x - 2) ** 2) + np.exp(-(x - 6) ** 2 / 10) + 1/ (x ** 2 + 1)
if __name__ == '__main__':
optimizer = BayesianOptimization(f=None, pbounds={'x': (-2, 2)}, verbose=2, random_state=1,
... | 968 | 47.45 | 124 | py |
BayesianOptimization | BayesianOptimization-master/examples/sklearn_example.py | from sklearn.datasets import make_classification
from sklearn.model_selection import cross_val_score
from sklearn.ensemble import RandomForestClassifier as RFC
from sklearn.svm import SVC
from bayes_opt import BayesianOptimization
from bayes_opt.util import Colours
def get_data():
"""Synthetic binary classificati... | 3,939 | 31.295082 | 78 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_acceptance.py | # import numpy as np
# from bayes_opt import BayesianOptimization
# from bayes_opt.util import ensure_rng
# def test_simple_optimization():
# """
# ...
# """
# def f(x, y):
# return -x ** 2 - (y - 1) ** 2 + 1
# optimizer = BayesianOptimization(
# f=f,
# pbounds={"x": (-3... | 1,737 | 23.828571 | 63 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_bayesian_optimization.py | import pytest
import numpy as np
from bayes_opt import UtilityFunction
from bayes_opt import BayesianOptimization
from bayes_opt.logger import ScreenLogger
from bayes_opt.event import Events, DEFAULT_EVENTS
from bayes_opt.util import NotUniqueError
import pickle
import os
def target_func(**kwargs):
# arbitrary ta... | 12,509 | 30.832061 | 113 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_constraint.py | import numpy as np
from bayes_opt import BayesianOptimization
from pytest import approx, raises
from scipy.optimize import NonlinearConstraint
np.random.seed(42)
def test_single_constraint_upper():
def target_function(x, y):
return np.cos(2 * x) * np.cos(y) + np.sin(x)
def constraint_function(x, y)... | 5,838 | 27.763547 | 119 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_notebooks_run.py | """
collect all notebooks in examples, and check that they run without error
"""
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from pathlib import Path
from glob import glob
from matplotlib import pyplot as plt # this script doesn't use this but the notebooks do
this_file_loc = Path(__file__... | 1,155 | 35.125 | 89 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_observer.py | from bayes_opt.bayesian_optimization import Observable
from bayes_opt.observer import _Tracker
from bayes_opt.event import Events
import os
EVENTS = ["a", "b", "c"]
class SimpleObserver():
def __init__(self):
self.counter = 0
def update(self, event, instance):
self.counter += 1
def test_g... | 3,546 | 27.604839 | 75 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_queue.py | import pytest
from bayes_opt.bayesian_optimization import Queue
def test_add():
queue = Queue()
assert len(queue) == 0
assert queue.empty
queue.add(1)
assert len(queue) == 1
queue.add(1)
assert len(queue) == 2
queue.add(2)
assert len(queue) == 3
def test_queue():
queue =... | 766 | 14.34 | 49 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_seq_domain_red.py | import numpy as np
import pytest
from bayes_opt import SequentialDomainReductionTransformer
from bayes_opt import BayesianOptimization
from bayes_opt.target_space import TargetSpace
def black_box_function(x, y):
"""Function with unknown internals we wish to maximize.
This is just serving as an example, for a... | 4,473 | 29.643836 | 91 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_target_space.py | import pytest
import numpy as np
from bayes_opt.constraint import ConstraintModel
from bayes_opt.target_space import TargetSpace
from bayes_opt.util import NotUniqueError
def target_func(**kwargs):
# arbitrary target func
return sum(kwargs.values())
PBOUNDS = {'p1': (0, 1), 'p2': (1, 100)}
def test_keys_a... | 8,516 | 31.38403 | 98 | py |
BayesianOptimization | BayesianOptimization-master/tests/test_util.py | import pytest
import numpy as np
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction, Colours
from bayes_opt.util import acq_max, load_logs, ensure_rng
from sklearn.gaussian_process.kernels import Matern
from sklearn.gaussian_process import GaussianProcessRegressor
from scipy.optimi... | 5,180 | 24.150485 | 84 | py |
null | ParMETIS-main/README.md | # ParMETIS
ParMETIS is an MPI-based library for partitioning graphs, partitioning finite element meshes,
and producing fill reducing orderings for sparse matrices. The algorithms implemented in
ParMETIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint
partitioning schemes dev... | 2,981 | 31.064516 | 111 | md |
null | ParMETIS-main/libparmetis/initbalance.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* initbalance.c
*
* This file contains code that computes an initial partitioning
*
* Started 3/4/96
* George
*
* $Id: initbalance.c 10592 2011-07-16 21:17:53Z karypis $
*/
#include <parmetislib.h>
/*********************************************... | 17,514 | 33.890438 | 93 | c |
null | ParMETIS-main/libparmetis/ctrl.c | /*!
* Copyright 1997, Regents of the University of Minnesota
*
* \file
* \brief Functions dealing with manipulating the ctrl_t structure
*
*
* \date Started 10/19/1996
* \author George Karypis
* \version\verbatim $Id: ctrl.c 10592 2011-07-16 21:17:53Z karypis $ \endverbatime
*/
#include <parmetislib.h>
/*... | 4,919 | 28.638554 | 88 | c |
null | ParMETIS-main/libparmetis/defs.h | /*
* Copyright 1997, Regents of the University of Minnesota
*
* defs.h
*
* This file contains constant definitions
*
* Started 8/27/94
* George
*
* $Id: defs.h 10543 2011-07-11 19:32:24Z karypis $
*
*/
#define GLOBAL_DBGLVL 0
#define GLOBAL_SEED 15
#define NUM_INIT_MSECTIONS 5
#define M... | 2,253 | 24.044444 | 87 | h |
null | ParMETIS-main/libparmetis/ometis.c | /*!
* Copyright 1997, Regents of the University of Minnesota
*
* \file
* \brief This is the entry point of parallel ordering routines
*
* \date Started 8/1/2008
* \author George Karypis
* \version\verbatim $Id: ometis.c 10666 2011-08-04 05:22:36Z karypis $ \endverbatime
*
*/
#include <parmetislib.h>
/*****... | 21,503 | 32.032258 | 116 | c |
null | ParMETIS-main/libparmetis/macros.h | /*
* Copyright 1997, Regents of the University of Minnesota
*
* macros.h
*
* This file contains macros used in multilevel
*
* Started 9/25/94
* George
*
* $Id: macros.h 10578 2011-07-14 18:10:15Z karypis $
*
*/
/* The following macro returns a random number in the specified range */
#define AND(a, b) ((a)... | 2,645 | 29.767442 | 93 | h |
null | ParMETIS-main/libparmetis/gklib.c | /*!
\file gklib.c
\brief Various helper routines generated using GKlib's templates
\date Started 4/12/2007
\author George
\author Copyright 1997-2009, Regents of the University of Minnesota
\version\verbatim $Id: gklib.c 10395 2011-06-23 23:28:06Z karypis $ \endverbatim
*/
#include "parmetislib.h"
/*********... | 3,276 | 26.082645 | 95 | c |
null | ParMETIS-main/libparmetis/msetup.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* msetup.c
*
* This file contain various routines for setting up a mesh
*
* Started 10/19/96
* George
*
* $Id: msetup.c 10057 2011-06-02 13:44:44Z karypis $
*
*/
#include <parmetislib.h>
/******************************************************... | 2,449 | 24.520833 | 81 | c |
null | ParMETIS-main/libparmetis/kmetis.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* kmetis.c
*
* This is the entry point of ParMETIS_PartKway
*
* Started 10/19/96
* George
*
* $Id: kmetis.c 10757 2011-09-15 22:07:47Z karypis $
*
*/
#include <parmetislib.h>
/********************************************************************... | 7,322 | 28.768293 | 133 | c |
null | ParMETIS-main/libparmetis/proto.h | /*
* Copyright 1997, Regents of the University of Minnesota
*
* proto.h
*
* This file contains header files
*
* Started 10/19/95
* George
*
* $Id: proto.h 10592 2011-07-16 21:17:53Z karypis $
*
*/
/* ctrl.c */
ctrl_t *SetupCtrl(pmoptype_et optype, idx_t *options, idx_t ncon, idx_t nparts,
real_... | 14,305 | 40.109195 | 90 | h |
null | ParMETIS-main/libparmetis/mdiffusion.c | /* * Copyright 1997, Regents of the University of Minnesota
*
* mdiffusion.c
*
* This file contains code that performs mc-diffusion
*
* Started 9/16/99
* George
*
* $Id: mdiffusion.c 10542 2011-07-11 16:56:22Z karypis $
*/
#include <parmetislib.h>
#define PE -1
/********************************************... | 12,256 | 28.045024 | 94 | c |
null | ParMETIS-main/libparmetis/util.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* util.c
*
* This function contains various utility routines
*
* Started 9/28/95
* George
*
* $Id: util.c 10057 2011-06-02 13:44:44Z karypis $
*/
#include <parmetislib.h>
/************************************************************************... | 9,302 | 22.027228 | 94 | c |
null | ParMETIS-main/libparmetis/gkmpi.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* gkmpi.c
*
* This function contains wrappers around MPI calls to allow
* future de-coupling of sizes from 'int' datatypes.
*
* Started 5/30/11
* George
*
* $Id: gkmpi.c 10022 2011-05-30 20:18:42Z karypis $
*/
#include <parmetislib.h>
int gkMPI... | 11,037 | 26.254321 | 82 | c |
null | ParMETIS-main/libparmetis/pspases.c | /*
* pspases.c
*
* This file contains ordering routines that are to be used with the
* parallel Cholesky factorization code PSPASES
*
* Started 10/14/97
* George
*
* $Id: pspases.c 10535 2011-07-11 04:29:44Z karypis $
*
*/
#include <parmetislib.h>
/*********************************************************... | 4,467 | 27.458599 | 98 | c |
null | ParMETIS-main/libparmetis/rename.h | #ifndef _LIBPARMETIS_RENAME_H_
#define _LIBPARMETIS_RENAME_H_
#define KWayAdaptiveRefine libparmetis__KWayAdaptiveRefine
#define Adaptive_Partition libparmetis__Adaptive_Partition
#define BalanceMyLink libparmetis__BalanceMyLink
#define CommChangedInterfaceData libparmetis__CommChangedInterfaceData
#define CommInterfa... | 9,650 | 51.737705 | 94 | h |
null | ParMETIS-main/libparmetis/gklib_defs.h | /*!
\file
\brief Data structures and prototypes for GKlib integration
\date Started 12/23/2008
\author George
\version\verbatim $Id: gklib_defs.h 10395 2011-06-23 23:28:06Z karypis $ \endverbatim
*/
#ifndef _LIBPARMETIS_GKLIB_H_
#define _LIBPARMETIS_GKLIB_H_
#include "gklib_rename.h"
/*****************************... | 1,637 | 29.333333 | 85 | h |
null | ParMETIS-main/libparmetis/comm.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* comm.c
*
* This function provides various high level communication functions
*
* $Id: comm.c 10592 2011-07-16 21:17:53Z karypis $
*/
#include <parmetislib.h>
/*************************************************************************/
/*! This f... | 15,306 | 29.860887 | 123 | c |
null | ParMETIS-main/libparmetis/parmetislib.h | /*
* Copyright 1997, Regents of the University of Minnesota
*
* par_metis.h
*
* This file includes all necessary header files
*
* Started 8/27/94
* George
*
* $Id: parmetislib.h 10379 2011-06-22 18:51:24Z benjamin $
*/
/*
#define DEBUG 1
#define DMALLOC 1
*/
#include <mpi.h>
#include <GKlib.h>
#includ... | 459 | 13.83871 | 59 | h |
null | ParMETIS-main/libparmetis/diffutil.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* wavefrontK.c
*
* This file contains code for the initial directed diffusion at the coarsest
* graph
*
* Started 5/19/97, Kirk, George
*
* $Id: diffutil.c 13946 2013-03-30 15:51:45Z karypis $
*
*/
#include <parmetislib.h>
/******************... | 7,949 | 25.588629 | 119 | c |
null | ParMETIS-main/libparmetis/xyzpart.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* xyzpart.c
*
* This file contains code that implements a coordinate based partitioning
*
* Started 7/11/97
* George
*
* $Id: xyzpart.c 10755 2011-09-15 12:28:34Z karypis $
*
*/
#include <parmetislib.h>
/***************************************... | 20,877 | 29.748159 | 109 | c |
null | ParMETIS-main/libparmetis/wspace.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* memory.c
*
* This file contains routines that deal with memory allocation
*
* Started 2/24/96
* George
*
* $Id: wspace.c 10540 2011-07-11 15:42:13Z karypis $
*
*/
#include <parmetislib.h>
/****************************************************... | 4,315 | 30.05036 | 85 | c |
null | ParMETIS-main/libparmetis/timer.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* timer.c
*
* This file contain various timing routines
*
* Started 10/19/96
* George
*
* $Id: timer.c 10052 2011-06-01 22:29:57Z karypis $
*
*/
#include <parmetislib.h>
/**********************************************************************... | 3,030 | 31.591398 | 83 | c |
null | ParMETIS-main/libparmetis/gklib_rename.h | /*!
\file
* Copyright 1997, Regents of the University of Minnesota
*
* This file contains header files
*
* Started 10/2/97
* George
*
* $Id: gklib_rename.h 10395 2011-06-23 23:28:06Z karypis $
*
*/
#ifndef _LIBPARMETIS_GKLIB_RENAME_H_
#define _LIBPARMETIS_GKLIB_RENAME_H_
/* gklib.c - generated from the .o... | 4,321 | 34.138211 | 87 | h |
null | ParMETIS-main/libparmetis/serial.c | /*
* serial.c
*
* This file contains code that implements k-way refinement
*
* Started 7/28/97
* George
*
* $Id: serial.c 13927 2013-03-27 22:42:41Z karypis $
*
*/
#include <parmetislib.h>
/*************************************************************************
* This function computes the initial id/ed
... | 37,103 | 28.447619 | 113 | c |
null | ParMETIS-main/libparmetis/renumber.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* mgrsetup.c
*
* This file contain various graph setting up routines
*
* Started 10/19/96
* George
*
* $Id: renumber.c 10531 2011-07-09 21:58:13Z karypis $
*
*/
#include <parmetislib.h>
/******************************************************... | 2,130 | 21.431579 | 113 | c |
null | ParMETIS-main/libparmetis/mmetis.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* mmetis.c
*
* This is the entry point of ParMETIS_V3_PartMeshKway
*
* Started 10/19/96
* George
*
* $Id: mmetis.c 10573 2011-07-14 13:31:54Z karypis $
*
*/
#include <parmetislib.h>
/************************************************************... | 2,725 | 29.629213 | 89 | c |
null | ParMETIS-main/libparmetis/kwayrefine.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* medge_refine.c
*
* This file contains code that performs the k-way refinement
*
* Started 3/1/96
* George
*
* $Id: kwayrefine.c 10987 2011-10-31 14:42:33Z karypis $
*/
#include <parmetislib.h>
#define ProperSide(c, from, other) \
... | 38,524 | 31.483137 | 93 | c |
null | ParMETIS-main/libparmetis/akwayfm.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* makwayfm.c
*
* This file contains code that performs the k-way refinement
*
* Started 3/1/96
* George
*
* $Id: akwayfm.c 10528 2011-07-09 19:47:30Z karypis $
*/
#include <parmetislib.h>
#define ProperSide(c, from, other) \
(((c) ... | 20,868 | 31.916404 | 97 | c |
null | ParMETIS-main/libparmetis/match.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* mmatch.c
*
* This file contains code that finds a matching
*
* Started 2/22/96
* George
*
* $Id: match.c 10592 2011-07-16 21:17:53Z karypis $
*
*/
#include <parmetislib.h>
#define LHTSIZE 8192 /* This should be a power of two */
#define MASK ... | 56,067 | 32.857488 | 146 | c |
null | ParMETIS-main/libparmetis/gkmetis.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* gkmetis.c
*
* This is the entry point of parallel geometry based partitioning
* routines
*
* Started 10/19/96
* George
*
* $Id: gkmetis.c 10663 2011-08-04 03:54:49Z karypis $
*
*/
#include <parmetislib.h>
/*********************************... | 7,399 | 27.682171 | 94 | c |
null | ParMETIS-main/libparmetis/initpart.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* initpart.c
*
* This file contains code that performs log(p) parallel multilevel
* recursive bissection
*
* Started 3/4/96
* George
*
* $Id: initpart.c 10542 2011-07-11 16:56:22Z karypis $
*/
#include <parmetislib.h>
#define DEBUG_IPART_
/... | 7,758 | 28.727969 | 91 | c |
null | ParMETIS-main/libparmetis/rmetis.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* rmetis.c
*
* This is the entry point of the partitioning refinement routine
*
* Started 10/19/96
* George
*
* $Id: rmetis.c 10612 2011-07-21 20:09:05Z karypis $
*
*/
#include <parmetislib.h>
/************************************************... | 3,045 | 26.690909 | 87 | c |
null | ParMETIS-main/libparmetis/graph.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* graph.c
*
* This file contains routines that deal with setting up and freeing the
* graph structure.
*
* Started 2/24/96
* George
*
* $Id: memory.c 10412 2011-06-25 23:12:57Z karypis $
*
*/
#include <parmetislib.h>
/***********************... | 13,813 | 26.794769 | 104 | c |
null | ParMETIS-main/libparmetis/weird.c | /*
* Copyright 1997, Regents of the University of Minnesota
*
* weird.c
*
* This file contain various graph setting up routines
*
* Started 10/19/96
* George
*
* $Id: weird.c 10592 2011-07-16 21:17:53Z karypis $
*
*/
#include <parmetislib.h>
#define RIFN(x) \
if ((x) == NULL) {\
printf("PARMETIS ERR... | 13,955 | 25.838462 | 120 | c |