repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/interpolating.py
import numpy as np from scipy.interpolate import griddata def interpolate_image(input_array, method='linear'): """ Seth 11/13/14 2D interpolation to smooth over missing pixels using built-in scipy methods :param input_array: N x M array :param method: :return: N x M interpolated image array ...
1,110
40.148148
92
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/smoothing.py
import numpy as np import ast import matplotlib.pyplot as plt import scipy.constants as con from scipy.interpolate import griddata import scipy.integrate import astropy import warnings from astropy.convolution import convolve from astropy.convolution import Gaussian2DKernel def astropy_convolve(image, x_stddev=1.0): ...
17,267
42.386935
138
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/legacy/oracle.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 29 16:28:30 2018 @author: clint GO TO THE ENCLOSING DIRECTORY AND RUN IT FROM THE TERMINAL WITH THE FOLLOWING COMMAND: python oracle.py optional arguments: path to file you want to look at. It works with .h5, .bin, and .img python oracle.py /pat...
60,108
41.996423
251
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/legacy/quickLook_img.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 29 16:28:30 2018 @author: clint GO TO THE ENCLOSING DIRECTORY AND RUN IT FROM THE TERMINAL WITH THE FOLLOWING COMMAND: python quickLook_img.py set the system variable $MKID_IMG_DIR to the place where you want to look for img files set the system v...
21,209
40.104651
163
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/legacy/array_operations.py
import numpy as np from numpy import linalg try: from skimage.transform import rotate as imrotate except ImportError: from scipy.misc import imrotate from astropy import wcs def fit_rigid_rotation(x, y, ra, dec, x0=0, y0=0): """ calculate the rigid rotation from row,col positions to ra,dec positions ...
1,766
28.949153
86
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/legacy/oracle_helpers.py
""" Author: Alex Walter Date: Feb 22, 2018 Last Updated: Sept 19, 2018 This code is for analyzing the photon arrival time statistics in a bin-free way to find a maximum likelihood estimate of Ic, Is in the presence of an incoherent background source Ir. For example usage, see if __name__ == "__main__": """ import num...
20,999
34.413153
155
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/legacy/__init__.py
0
0
0
py
sherpa
sherpa-master/generate_readme.py
import os welcome_text = """SHERPA: A Python Hyperparameter Optimization Library ==================================================== .. figure:: https://docs.google.com/drawings/d/e/2PACX-1vRaTP5d5WqT4KY4V57niI4wFDkz0098zHTRzZ9n7SzzFtdN5akBd75HchBnhYI-GPv_AYH1zYa0O2_0/pub?w=522&h=150 :figwidth: 100% :align: ...
1,298
36.114286
151
py
sherpa
sherpa-master/setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Note: To use the 'upload' functionality of this file, you must: # $ pip install twine from __future__ import print_function import io import os import sys from shutil import rmtree import argparse from setuptools import find_packages, setup, Command # parser = argpar...
3,678
27.968504
86
py
sherpa
sherpa-master/sherpa/core.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
31,945
36.060325
112
py
sherpa
sherpa-master/sherpa/schedulers.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
14,938
34.82494
80
py
sherpa
sherpa-master/sherpa/database.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
10,144
36.161172
177
py
sherpa
sherpa-master/sherpa/__init__.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
998
32.3
80
py
sherpa
sherpa-master/sherpa/algorithms/core.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
32,218
39.324155
128
py
sherpa
sherpa-master/sherpa/algorithms/bayesian_optimization.py
import numpy import logging import sherpa from sherpa.algorithms import Algorithm import pandas from sherpa.core import Choice, Continuous, Discrete, Ordinal import collections import GPyOpt as gpyopt_package import GPy import warnings bayesoptlogger = logging.getLogger(__name__) class GPyOpt(Algorithm): """ ...
14,984
40.167582
101
py
sherpa
sherpa-master/sherpa/algorithms/__init__.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
894
39.681818
80
py
sherpa
sherpa-master/sherpa/algorithms/successive_halving.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
4,768
37.152
152
py
sherpa
sherpa-master/sherpa/app/app.py
import logging import pandas from flask import Flask from flask import render_template, flash, redirect logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) class SherpaApp(Flask): def __init__(self, *args, **kwargs): Flask.__init__(self, *args, **kwargs) self.parameter_t...
1,916
29.428571
90
py
sherpa
sherpa-master/sherpa/app/__init__.py
0
0
0
py
sherpa
sherpa-master/examples/simple.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
2,694
37.5
99
py
sherpa
sherpa-master/examples/randomforest.py
from sklearn.datasets import load_breast_cancer from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_val_score import time import sherpa import sherpa.algorithms.bayesian_optimization as bayesian_optimization parameters = [sherpa.Discrete('n_estimators', [2, 50]), ...
1,441
42.69697
79
py
sherpa
sherpa-master/examples/parallel-examples/simple.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
3,314
35.833333
170
py
sherpa
sherpa-master/examples/parallel-examples/bianchini/runner.py
import os import argparse import sherpa from sherpa.schedulers import LocalScheduler,SGEScheduler def run_example(FLAGS): """ Run parallel Sherpa optimization over a set of discrete hp combinations. """ # Iterate algorithm accepts dictionary containing lists of possible values. hp_space = {'act':...
2,758
40.179104
122
py
sherpa
sherpa-master/examples/parallel-examples/bianchini/bianchini.py
# Train simple network on 2D data. # Author: Peter Sadowski from __future__ import print_function import numpy as np import sherpa from keras.models import Model from keras.layers import Dense, Input from keras.optimizers import SGD def dataset_bianchini(batchsize, k=1): ''' Synthetic data set where we can c...
2,585
31.734177
123
py
sherpa
sherpa-master/examples/parallel-examples/mnistmlp/trial.py
from __future__ import print_function import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import sherpa import keras from keras.models import Model from keras.layers import Dense, Input, Dropout from keras.optimizers import SGD from keras.datasets import mnist def define_model(params): """ Return compiled model...
2,619
30.95122
93
py
sherpa
sherpa-master/examples/parallel-examples/mnistmlp/runner.py
import os import argparse import sherpa import datetime from sherpa.schedulers import LocalScheduler,SGEScheduler import sherpa.algorithms.bayesian_optimization as bayesian_optimization def run_example(FLAGS): """ Run parallel Sherpa optimization over a set of discrete hp combinations. """ parameters ...
3,578
46.72
122
py
sherpa
sherpa-master/examples/parallel-examples/mnistcnnpbt/mnist_cnn.py
'''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' from __future__ import print_function import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf CONFIG = tf....
3,873
37.74
109
py
sherpa
sherpa-master/examples/parallel-examples/mnistcnnpbt/runner.py
import sherpa import sherpa.schedulers import argparse parser = argparse.ArgumentParser() parser.add_argument('--local', help='Run locally', action='store_true', default=True) parser.add_argument('--max_concurrent', help='Number of concurrent processes', typ...
2,716
44.283333
118
py
sherpa
sherpa-master/examples/parallel-examples/fashion_mnist_benchmark/runner_gpyopt.py
import os import argparse import sherpa import datetime import time from sherpa.schedulers import LocalScheduler,SGEScheduler import sherpa.algorithms.bayesian_optimization as bayesian_optimization def run_example(FLAGS): """ Run parallel Sherpa optimization over a set of discrete hp combinations. """ ...
1,862
37.8125
80
py
sherpa
sherpa-master/examples/parallel-examples/fashion_mnist_benchmark/runner_population_based_training.py
import os import argparse import sherpa import datetime import time from sherpa.schedulers import LocalScheduler,SGEScheduler def run_example(FLAGS): """ Run parallel Sherpa optimization over a set of discrete hp combinations. """ parameters = [sherpa.Continuous('learning_rate', [1e-5, 5e-1], 'lo...
1,999
40.666667
112
py
sherpa
sherpa-master/examples/parallel-examples/fashion_mnist_benchmark/runner_successive_halving.py
import os import argparse import sherpa import datetime import time from sherpa.schedulers import LocalScheduler,SGEScheduler def run_example(FLAGS): """ Run parallel Sherpa optimization over a set of discrete hp combinations. """ parameters = [sherpa.Continuous('learning_rate', [1e-5, 5e-1], 'lo...
1,888
38.354167
98
py
sherpa
sherpa-master/examples/parallel-examples/fashion_mnist_benchmark/fashion_mlp.py
'''Trains a simple deep NN on the MNIST dataset. Gets to 98.40% test accuracy after 20 epochs (there is *a lot* of margin for parameter tuning). 2 seconds per epoch on a K520 GPU. ''' from __future__ import print_function import os import time os.environ['CUDA_VISIBLE_DEVICES'] = '' import sherpa import keras from ker...
2,681
36.25
137
py
sherpa
sherpa-master/examples/parallel-examples/fashion_mnist_benchmark/runner_random_search.py
import os import argparse import sherpa import datetime import time from sherpa.schedulers import LocalScheduler,SGEScheduler def run_example(FLAGS): """ Run parallel Sherpa optimization over a set of discrete hp combinations. """ parameters = [sherpa.Continuous('learning_rate', [1e-5, 5e-1], 'lo...
1,591
35.181818
80
py
sherpa
sherpa-master/tests/test_successive_halving.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
9,652
37.003937
80
py
sherpa
sherpa-master/tests/long_tests.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
3,945
34.54955
95
py
sherpa
sherpa-master/tests/test_algorithms.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
21,565
37.442068
122
py
sherpa
sherpa-master/tests/testing_utils.py
import pytest import sherpa import sherpa.core import sherpa.schedulers import sherpa.database import logging try: import unittest.mock as mock except ImportError: import mock import tempfile import shutil logging.basicConfig(level=logging.DEBUG) testlogger = logging.getLogger(__name__) def get_test_paramete...
1,977
31.42623
65
py
sherpa
sherpa-master/tests/test_seed.py
import sherpa from testing_utils import get_test_parameters def test_rng(): sherpa.rng.randn() sherpa.rng.seed(1234) a = sherpa.rng.randn() sherpa.rng.seed(1234) b = sherpa.rng.randn() assert a ==b def test_random_search(): algorithm = sherpa.algorithms.RandomSearch() sherpa.rng.seed(1...
542
29.166667
76
py
sherpa
sherpa-master/tests/test_gpyopt.py
import sherpa import pandas import pytest import numpy import collections import GPyOpt as gpyopt_package from sherpa.algorithms.bayesian_optimization import GPyOpt from sherpa.algorithms import Repeat @pytest.fixture def parameters(): parameters = [sherpa.Continuous('dropout', [0., 0.5]), sher...
17,804
40.894118
124
py
sherpa
sherpa-master/tests/test_runner.py
import sherpa import sherpa.core import sherpa.schedulers import sherpa.database try: import unittest.mock as mock except ImportError: import mock from testing_utils import * def test_runner_update_results(): mock_db = mock.MagicMock() mock_db.get_new_results.return_value = [{'context': {'other_metric...
3,834
34.509259
82
py
sherpa
sherpa-master/tests/test_schedulers.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
5,068
34.697183
114
py
sherpa
sherpa-master/tests/test_database.py
import os import pytest import sys import sherpa import sherpa.core import sherpa.schedulers import sherpa.database try: import unittest.mock as mock except ImportError: import mock import logging import time import warnings from testing_utils import * def test_database(test_dir): test_trial = get_test_tr...
3,431
33.32
79
py
sherpa
sherpa-master/tests/test_study.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
4,098
32.876033
182
py
sherpa
sherpa-master/docs/conf.py
""" SHERPA is a Python library for hyperparameter tuning of machine learning models. Copyright (C) 2018 Lars Hertel, Peter Sadowski, and Julian Collado. This file is part of SHERPA. SHERPA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
6,552
30.965854
80
py
MetaSeg
MetaSeg-master/metaseg_io.py
import os import pickle import h5py import numpy as np # parameters from global_defs.py, please adjust variables and paths from global_defs import MetaSeg metaseg = MetaSeg() ######################################################## # probs_gt_save( probs, gt, image_name, i ): # This routine stores softmax probabil...
4,219
25.878981
89
py
MetaSeg
MetaSeg-master/metrics_setup.py
from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension import numpy as np ext_core = Extension( "metrics", sources=["metrics.pyx"], include_dirs=[np.get_include()], extra_compile_args=["-O3"]) setup( ext_modules = cythonize([ex...
331
21.133333
44
py
MetaSeg
MetaSeg-master/metrics_test.py
import os os.system("python3 setup.py build_ext --inplace") from metrics import compute_metrics, test_metrics test_metrics()
130
13.555556
49
py
MetaSeg
MetaSeg-master/metaseg_plot.py
import os from metaseg_io import metaseg import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from scipy.stats import pearsonr, kde from sklearn.metrics import mean_squared_error, r2_score, roc_curve, auc import numpy as np def add_scatterplot_vs_iou(ious, sizes, dataset, shortname, size_fac, sc...
10,567
40.443137
187
py
MetaSeg
MetaSeg-master/metaseg_eval.py
import random import os import time import sys from PIL import Image import numpy as np import pandas as pd import scipy from sklearn import datasets, linear_model, preprocessing, model_selection from sklearn.metrics import mean_squared_error, r2_score, roc_curve, auc from scipy.interpolate import interp1d from multip...
22,375
34.127159
151
py
MetaSeg
MetaSeg-master/global_defs.py
class MetaSeg: METASEG_MODEL_NAMES = [ "xc.mscl.os8", "mn.sscl.os16" ] METASEG_CLASS_DTYPES = [ "one_hot_classes", "probs" ] METASEG_MODEL_NAME = METASEG_MODEL_NAMES[0] METASEG_READ_DATA_PATH = "/home/rottmann/seg_uncertainty/metaseg_io/" METASEG_MY_IO_PATH = "/home/rottmann/seg_uncertaint...
2,729
32.292683
115
py
socks
socks-main/benchmarks/experiment_matrix.py
import logging import numpy as np from collections.abc import Generator from itertools import product from functools import reduce from operator import mul from operator import itemgetter from scipy import stats from time import perf_counter from sacred import Experiment def _result_accumulator( config, ...
6,885
25.898438
88
py
socks
socks-main/benchmarks/__init__.py
__all__ = ["experiment_matrix"]
32
15.5
31
py
socks
socks-main/benchmarks/kernel_linear_id/plot_sample_size_vs_time.py
0
0
0
py
socks
socks-main/benchmarks/kernel_linear_id/plot_dimensionality_vs_time.py
0
0
0
py
socks
socks-main/benchmarks/kernel_linear_id/__init__.py
0
0
0
py
socks
socks-main/benchmarks/kernel_linear_id/baseline.py
0
0
0
py
socks
socks-main/benchmarks/kernel_control_fwd/plot_sample_size_vs_accuracy.py
0
0
0
py
socks
socks-main/benchmarks/kernel_control_fwd/plot_lambda_vs_accuracy.py
0
0
0
py
socks
socks-main/benchmarks/kernel_control_fwd/plot_sigma_vs_accuracy.py
0
0
0
py
socks
socks-main/benchmarks/kernel_control_fwd/plot_sample_size_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_control_fwd.baseline import ex mx = experiment_matrix(ex,...
1,905
25.472222
76
py
socks
socks-main/benchmarks/kernel_control_fwd/__init__.py
0
0
0
py
socks
socks-main/benchmarks/kernel_control_fwd/baseline.py
0
0
0
py
socks
socks-main/benchmarks/kernel_sr_max/plot_sample_size_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr_max.baseline import ex mx = experiment_matrix(ex, call...
2,041
26.226667
79
py
socks
socks-main/benchmarks/kernel_sr_max/plot_action_sample_size_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr_max.baseline import ex mx = experiment_matrix(ex, call...
2,080
26.746667
86
py
socks
socks-main/benchmarks/kernel_sr_max/plot_test_sample_size_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr_max.baseline import ex mx = experiment_matrix(ex, call...
2,071
26.626667
84
py
socks
socks-main/benchmarks/kernel_sr_max/plot_dimensionality_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr_max.baseline import ex mx = experiment_matrix(ex, call...
2,059
26.466667
82
py
socks
socks-main/benchmarks/kernel_sr_max/__init__.py
0
0
0
py
socks
socks-main/benchmarks/kernel_sr_max/baseline.py
import numpy as np from sacred import Experiment from sacred import Ingredient from time import perf_counter from functools import lru_cache from functools import partial from gym.spaces import Box from gym_socks.envs.integrator import NDIntegratorEnv from gym_socks.sampling import random_sampler from gym_socks.sa...
3,855
20.541899
79
py
socks
socks-main/benchmarks/kernel_sr_max/plot_time_horizon_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr_max.baseline import ex mx = experiment_matrix(ex, call...
2,039
26.2
80
py
socks
socks-main/benchmarks/tests/test_experiment_matrix.py
import unittest from unittest.mock import patch import numpy as np from functools import partial from sacred import Experiment from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean class TestExperimentMatrix(unittest.TestCase): def test_config_len(cls):...
1,421
21.935484
88
py
socks
socks-main/benchmarks/tests/__init__.py
0
0
0
py
socks
socks-main/benchmarks/separating_kernel/__init__.py
0
0
0
py
socks
socks-main/benchmarks/separating_kernel/baseline.py
0
0
0
py
socks
socks-main/benchmarks/kernel_sr/plot_sample_size_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr.baseline import ex mx = experiment_matrix(ex, callback...
2,025
26.013333
76
py
socks
socks-main/benchmarks/kernel_sr/plot_test_sample_size_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr.baseline import ex mx = experiment_matrix(ex, callback...
2,055
26.413333
80
py
socks
socks-main/benchmarks/kernel_sr/plot_dimensionality_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr.baseline import ex mx = experiment_matrix(ex, callback...
2,043
26.253333
78
py
socks
socks-main/benchmarks/kernel_sr/__init__.py
0
0
0
py
socks
socks-main/benchmarks/kernel_sr/baseline.py
import numpy as np from sacred import Experiment from sacred import Ingredient from time import perf_counter from functools import lru_cache from functools import partial from gym.spaces import Box from gym_socks.envs.integrator import NDIntegratorEnv from gym_socks.sampling import random_sampler from gym_socks.sa...
3,256
20.427632
79
py
socks
socks-main/benchmarks/kernel_sr/plot_time_horizon_vs_time.py
import numpy as np from scipy import stats from functools import partial from benchmarks.experiment_matrix import experiment_matrix from benchmarks.experiment_matrix import sample_mean import matplotlib import matplotlib.pyplot as plt from benchmarks.kernel_sr.baseline import ex mx = experiment_matrix(ex, callback...
2,023
25.986667
76
py
socks
socks-main/examples/reach/stoch_reach.py
# %% [markdown] """ # Stochastic Reachability This example shows the stochastic reachability algorithm. By default, the system is a double integrator (2D stochastic chain of integrators). To run the example, use the following command: ```shell python examples/reach/stoch_reach.py ``` """ # %% import gym impo...
3,435
23.898551
88
py
socks
socks-main/examples/reach/forward_reach.py
# %% [markdown] """ # Forward Reachability This example demonstrates the forward reachability classifier on a set of dummy data. Note that the data is not taken from a dynamical system, but can easily be adapted to data taken from system observations via a simple substitution. The reason for the dummy data is to showc...
3,920
26.808511
89
py
socks
socks-main/examples/reach/stoch_reach_maximal.py
# %% [markdown] """ # Maximal Policies This example demonstrates the stochastic reachability algorithm to compute the maximal policy in the terminal (first) sense. By default, the system is a double integrator (2D stochastic chain of integrators). To run the example, use the following command: ```shell python e...
3,624
24.34965
88
py
socks
socks-main/examples/control/satellite_rendezvous.py
# %% [markdown] """ # Satellite Rendezvous and Docking Constrained stochastic optimal control problem using CWH dynamics. Note that the solution is currently unstable. This is partly due to the fact that the CWH dynamics are extremely sensitive to inputs, but also due to the fact that random sampling is not guaranteed...
5,899
24.106383
88
py
socks
socks-main/examples/control/obstacle_avoid.py
# %% [markdown] """ # Obstacle Avoid _Coming Soon_ To run the example, use the following command: ```shell python examples/control/obstacle_avoid.py ``` """
165
10.857143
46
py
socks
socks-main/examples/control/tracking.py
# %% [markdown] """ # Target Tracking This example demonstrates the kernel-based stochastic optimal control algorithm and the dynamic programming algorithm. By default, it uses a nonholonomic vehicle system (unicycle dynamics), and seeks to track a v-shaped trajectory. To run the example, use the following command: ...
4,954
23.651741
87
py
socks
socks-main/examples/kernel/random_fourier_features.py
# %% [markdown] """ # Random Fourier Features This example demonstrates the use of conditional distribution embeddings on a simple function $x^{2}$, corrupted by Gaussian noise and using the kernel approximation technique Random Fourier Features. This example is useful for experimenting with the kernel choice, paramet...
4,361
33.078125
88
py
socks
socks-main/examples/kernel/conditional_embedding.py
# %% [markdown] """ # Conditional Distribution Embedding This example demonstrates the use of conditional distribution embeddings on a simple function $x^{2}$, corrupted by Gaussian noise. This example is useful for experimenting with the kernel choice, parameters, or dataset and visualizing the result. To run the ex...
2,240
25.678571
88
py
socks
socks-main/examples/kernel/derivative_approximation.py
# %% [markdown] """ # Derivative Approximation This example demonstrates the use of conditional distribution embeddings to compute an approximation of the first and second derivatives of a function, $$f(x) = x^{3} - 4 x^{2} + 6 x - 24 + \exp(-x)$$ We use an idealized dataset, which approximates the partial derivativ...
2,760
26.888889
88
py
socks
socks-main/examples/kernel/nystrom_approximation.py
# %% [markdown] """ # Nystrom Approximation This example demonstrates the use of conditional distribution embeddings on a simple function $x^{2}$, corrupted by Gaussian noise and using the Nystrom kernel approximation technique. This example is useful for experimenting with the kernel choice, parameters, or dataset an...
5,209
30.575758
88
py
socks
socks-main/examples/kernel/maximum_mean_discrepancy.py
# %% [markdown] """ # Maximum Mean Discrepancy This example demonstrates the maximum mean discrepancy using data drawn from two different distributions. Additionally, we demonstrate the empirical witness function, which displays the difference between the two distributions. To run the example, use the following comma...
2,890
26.533333
88
py
socks
socks-main/examples/identification/linear_id.py
# %% [markdown] """ # Linear System ID This example demonstrates the linear system identification algorithm. By default, it uses the CWH4D system dynamics. Try setting the regularization parameter lower for higher accuracy. Note that this can introduce numerical instability if set too low. To run the example, use th...
3,547
24.89781
88
py
socks
socks-main/.jupyter/jupyter_notebook_config.py
c.NotebookApp.contents_manager_class = "jupytext.TextFileContentsManager" c.ContentsManager.preferred_jupytext_formats_read = "py:percent" c.ContentsManager.sphinx_convert_rst2md = True
186
45.75
73
py
socks
socks-main/docs/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 e...
4,549
26.743902
222
py
socks
socks-main/docs/sphinxext/github_link.py
from operator import attrgetter import inspect import subprocess import os import sys from functools import partial REVISION_CMD = "git rev-parse --short HEAD" def _get_git_revision(): try: revision = subprocess.check_output(REVISION_CMD.split()).strip() except (subprocess.CalledProcessError, OSError...
2,643
30.105882
85
py
socks
socks-main/gym_socks/__init__.py
"""SOCKS - A kernel-based stochastic optimal control toolbox.""" import logging logger = logging.getLogger(__name__) """Default logger for gym_socks. Used mainly for debugging. Can be diabled entirely by setting the log level of the logger to "notset". """ logging.basicConfig(level=logging.INFO, format="%(levelnam...
407
24.5
88
py
socks
socks-main/gym_socks/envs/core.py
from abc import ABC, abstractmethod import gym from gym.utils import seeding import numpy as np from functools import wraps class BaseDynamicalObject(gym.Env, ABC): """Base dynamical object class. Bases: :py:obj:`gym.Env`, :py:obj:`abc.ABC` This class is **abstract**, meaning it is not meant to be in...
4,934
26.569832
117
py
socks
socks-main/gym_socks/envs/planar_quad.py
"""Planar quadrotor system.""" import gym from gym_socks.envs.dynamical_system import DynamicalSystem import numpy as np from scipy.constants import g from scipy.integrate import solve_ivp class PlanarQuadrotorEnv(DynamicalSystem): """Planar quadrotor system. Bases: :py:class:`gym_socks.envs.dynamical_sys...
3,711
27.775194
307
py
socks
socks-main/gym_socks/envs/point_mass.py
"""ND point mass system.""" import gym from gym_socks.envs.dynamical_system import DynamicalSystem import numpy as np class NDPointMassEnv(DynamicalSystem): """ND point mass system. Bases: :py:class:`gym_socks.envs.dynamical_system.DynamicalSystem` A point mass is a very simple system in which the inp...
1,595
26.517241
88
py
socks
socks-main/gym_socks/envs/tora.py
"""TORA (translational oscillation with rotational actuation) system.""" import gym from gym_socks.envs.dynamical_system import DynamicalSystem import numpy as np class TORAEnv(DynamicalSystem): """TORA (translational oscillation with rotational actuation) system. Bases: :py:class:`gym_socks.envs.dynamical...
1,808
29.661017
236
py
socks
socks-main/gym_socks/envs/QUAD20.py
"""Quadrotor system. This system is taken from `ARCH-COMP20 Category Report: Continuous and Hybrid Systems with Nonlinear Dynamics <https://easychair.org/publications/open/nrdD>`_. """ import gym from gym_socks.envs.dynamical_system import DynamicalSystem import numpy as np from scipy.constants import g class Qu...
5,463
30.222857
87
py