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
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/inference/auto_model.py
# -*- coding: utf-8 -*- # Copyright 2020 The HuggingFace Inc. team and Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICEN...
4,153
33.04918
110
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/inference/savable_models.py
# -*- coding: utf-8 -*- # Copyright 2020 TensorFlowTTS Team # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
2,870
35.807692
87
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/inference/auto_config.py
# -*- coding: utf-8 -*- # Copyright 2020 The HuggingFace Inc. team and Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICEN...
3,150
33.626374
109
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/inference/__init__.py
from tensorflow_tts.inference.auto_model import TFAutoModel from tensorflow_tts.inference.auto_config import AutoConfig from tensorflow_tts.inference.auto_processor import AutoProcessor
186
45.75
65
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/inference/auto_processor.py
# -*- coding: utf-8 -*- # Copyright 2020 The TensorFlowTTS Team. # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
3,111
33.197802
113
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/losses/stft.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
5,179
33.533333
97
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/losses/spectrogram.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
2,697
31.902439
83
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/losses/__init__.py
from tensorflow_tts.losses.spectrogram import TFMelSpectrogram from tensorflow_tts.losses.stft import TFMultiResolutionSTFT
124
40.666667
62
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/trainers/base_trainer.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
36,562
35.165183
113
py
TensorFlowTTS
TensorFlowTTS-master/tensorflow_tts/trainers/__init__.py
from tensorflow_tts.trainers.base_trainer import GanBasedTrainer, Seq2SeqBasedTrainer
86
42.5
85
py
TensorFlowTTS
TensorFlowTTS-master/test/test_hifigan.py
# -*- coding: utf-8 -*- # Copyright 2020 TensorFlowTTS Team # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
3,900
29.960317
76
py
TensorFlowTTS
TensorFlowTTS-master/test/test_fastspeech.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
2,995
34.247059
86
py
TensorFlowTTS
TensorFlowTTS-master/test/test_tacotron2.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
5,329
34.533333
87
py
TensorFlowTTS
TensorFlowTTS-master/test/test_melgan_layers.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
2,965
30.892473
113
py
TensorFlowTTS
TensorFlowTTS-master/test/test_melgan.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
2,841
29.55914
84
py
TensorFlowTTS
TensorFlowTTS-master/test/test_mb_melgan.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
2,401
29.025
86
py
TensorFlowTTS
TensorFlowTTS-master/test/test_parallel_wavegan.py
# -*- coding: utf-8 -*- # Copyright 2020 TensorFlowTTS Team. # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
2,967
26.481481
82
py
TensorFlowTTS
TensorFlowTTS-master/test/test_fastspeech2.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
4,805
35.969231
88
py
TensorFlowTTS
TensorFlowTTS-master/test/test_auto.py
# -*- coding: utf-8 -*- # Copyright 2020 Minh Nguyen (@dathudeptrai) # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
2,820
34.708861
79
py
TensorFlowTTS
TensorFlowTTS-master/test/test_base_processor.py
import pytest from tensorflow_tts.processor.base_processor import BaseProcessor, DataProcessorError import string from dataclasses import dataclass from shutil import copyfile @dataclass class LJ(BaseProcessor): def get_one_sample(self, item): sample = { "raw_text": None, "text_ids...
3,035
27.111111
85
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/setup.py
from setuptools import setup config = { 'name': 'sgmcmc_ssm', 'version': '0.1', 'url': 'https://github.com/aicherc/sgmcmc_ssm_code', 'description': 'SGMCMC for SSM Code', 'author': 'Christopher Aicher', 'license': 'MIT License', 'packages': ['sgmcmc_ssm'], } setup(**config) # Build Extensio...
441
26.625
56
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/lgssm/driver.py
""" Experiment Driver Call python <path_to_this_file>.py --help to see documentation """ import os import sys sys.path.append(os.getcwd()) # Fix Python Path import numpy as np import pandas as pd import joblib import time import argparse from tqdm import tqdm import functools import matplotlib matplotlib.use('Agg')...
57,938
38.657084
104
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/lgssm/demo_setup.py
""" Create Setup Script for Demo Experiment Usage: 0. Change `project_root` in this file to match the directory of `sgmcmc_nonlinear_ssm` 1. Run this script, which will create a `setup.sh` script at `<experiment_folder>` (default is `./scratch/<experiment_name>/scripts/setup.sh`) This will generate...
6,445
31.23
91
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/garch/driver.py
""" Experiment Driver Call python <path_to_this_file>.py --help to see documentation """ import os import sys sys.path.append(os.getcwd()) # Fix Python Path import numpy as np import pandas as pd import joblib import time import argparse from tqdm import tqdm import functools import matplotlib matplotlib.use('Agg')...
53,197
38.729649
104
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/garch/demo_setup.py
""" Create Setup Script for Demo Experiment Usage: 0. Change `project_root` in this file to match the directory of `sgmcmc_nonlinear_ssm` 1. Run this script, which will create a `setup.sh` script at `<experiment_folder>` (default is `./scratch/<experiment_name>/scripts/setup.sh`) This will generate...
6,074
31.837838
91
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/svm/driver.py
""" Experiment Driver Call python <path_to_this_file>.py --help to see documentation """ import os import sys sys.path.append(os.getcwd()) # Fix Python Path import numpy as np import pandas as pd import joblib import time import argparse from tqdm import tqdm import functools import matplotlib matplotlib.use('Agg')...
59,557
38.918231
104
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/svm/demo_setup.py
""" Create Setup Script for Demo Experiment Usage: 0. Change `project_root` in this file to match the directory of `sgmcmc_nonlinear_ssm` 1. Run this script, which will create a `setup.sh` script at `<experiment_folder>` (default is `./scratch/<experiment_name>/scripts/setup.sh`) This will generate...
5,924
32.100559
91
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/gradient_error_fig_scripts/svm_grad_compare.py
#!/usr/bin/python3 #This script is being used to test the particle gradient approximations (full data) #######IMPORT RELEVANT MODULES###################### import numpy as np import pandas as pd import time import joblib import os from sgmcmc_ssm.models.svm import ( SVMParameters, SVMSampler, SVMPrior...
8,962
37.969565
107
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/gradient_error_fig_scripts/garch_grad_compare.py
#!/usr/bin/python3 #This script is being used to test the particle gradient approximations (full data) #######IMPORT RELEVANT MODULES###################### import numpy as np import pandas as pd import time import joblib import os from sgmcmc_ssm.models.garch import ( GARCHParameters, GARCHSampler, ...
9,330
38.041841
107
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/nonlinear_ssm_pf_experiment_scripts/gradient_error_fig_scripts/lgssm_grad_compare.py
#!/usr/bin/python3 #This script is being used to test the particle gradient approximations (full data) #######IMPORT RELEVANT MODULES###################### import numpy as np import pandas as pd import time import joblib import os from sgmcmc_ssm.models.lgssm import ( LGSSMParameters, LGSSMSampler, ...
10,036
39.800813
107
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/lgssm_quick_start.py
import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm np.random.seed(12357) ############################################################################### # Generate Synthetic Data ############################################################################### from sgmcmc_ssm.models.lgssm import ( ...
7,617
33.008929
79
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/exchange_rate/exchange_rate_full_demo.py
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() from sgmcmc_ssm.models.svm import SeqSVMSampler from tqdm import tqdm np.random.seed(12345) ####################################################...
5,954
33.622093
79
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/exchange_rate/exchange_rate_subset_demo.py
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() from sgmcmc_ssm.models.svm import SeqSVMSampler from tqdm import tqdm np.random.seed(12345) ####################################################...
5,815
33.414201
79
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/exchange_rate/exchange_rate_single_demo.py
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() from sgmcmc_ssm.models.svm import SeqSVMSampler, SVMSampler from tqdm import tqdm np.random.seed(12345) ########################################...
5,702
33.355422
79
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/exchange_rate/process_exchange_data.py
import pandas as pd import numpy as np import os ############################################################################### # Process Raw Exchange Rate Data Pulled From Finam.RU ############################################################################### path_to_raw_data = './data/EURUS_data.csv' path_to_outpu...
2,209
39.181818
122
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/synthetic/lgssm_demo.py
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import joblib import logging import os from tqdm import tqdm from sgmcmc_ssm.models.lgssm import ( generate_lgssm_data, LGSSMParameters, LGSSMPrior, LGSSMPreconditioner, LGSSMHelper, L...
5,352
30.674556
83
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/synthetic/hmm_demo.py
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import joblib import logging import os from tqdm import tqdm from sgmcmc_ssm.models.gauss_hmm import ( generate_gausshmm_data, GaussHMMParameters, GaussHMMPrior, GaussHMMPreconditioner, Gauss...
6,538
33.597884
83
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/synthetic/slds_demo.py
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import joblib import logging import os from tqdm import tqdm from sgmcmc_ssm.models.slds import ( generate_slds_data, SLDSParameters, SLDSPrior, SLDSPreconditioner, SLDSHelper, SLDSSam...
6,876
33.557789
105
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/ion_channel/ion_channel_subset_demo.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sgmcmc_ssm.models.gauss_hmm import GaussHMMSampler from tqdm import tqdm np.random.seed(12345) # Load and Scale Data from scipy.io import loadmat ion_data = loadmat('data/alamethicin.mat') from sklearn.preprocessing import RobustScaler scal...
4,577
31.013986
83
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/ion_channel/ion_channel_downsample_demo.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sgmcmc_ssm.models.gauss_hmm import GaussHMMSampler from tqdm import tqdm np.random.seed(12345) # Load and Scale Data from scipy.io import loadmat ion_data = loadmat('data/alamethicin.mat') from sklearn.preprocessing import RobustScaler scal...
4,961
31.860927
91
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/ion_channel/ion_channel_full_demo.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sgmcmc_ssm.models.gauss_hmm import GaussHMMSampler from tqdm import tqdm np.random.seed(12345) # Load and Scale Data from scipy.io import loadmat ion_data = loadmat('data/alamethicin.mat') from sklearn.preprocessing import RobustScaler scal...
4,127
32.024
91
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/api_demos/hmm_long_demo.py
import numpy as np from sgmcmc_ssm.models.gauss_hmm import ( generate_gausshmm_data, GaussHMMParameters, GaussHMMPrior, GaussHMMPreconditioner, GaussHMMHelper, GaussHMMSampler, ) np.random.seed(12345) # Parameters ## Define Gaussian HMM Parameters logit_pi = np.array([[...
8,623
30.246377
101
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/api_demos/slds_long_demo.py
import numpy as np from sgmcmc_ssm.models.slds import ( generate_slds_data, SLDSParameters, SLDSPrior, SLDSPreconditioner, SLDSHelper, SLDSSampler, ) np.random.seed(12345) # Parameters ## Define SLDS Parameters alpha = 0.05 delta=np.pi b = np.pi/2 pi = np.array([ ...
11,414
31.991329
107
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/api_demos/arhmm_long_demo.py
import numpy as np from sgmcmc_ssm.models.arphmm import ( generate_arphmm_data, ARPHMMParameters, ARPHMMPrior, ARPHMMPreconditioner, ARPHMMHelper, ARPHMMSampler, ) np.random.seed(12345) # Parameters ## Define ARPHMM Parameters logit_pi = np.array([[2, 0], [0, 2]])*2 D =...
8,407
30.02583
101
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/api_demos/lgssm_pf_demo.py
import numpy as np from sgmcmc_ssm.models.lgssm import ( generate_lgssm_data, LGSSMParameters, LGSSMPrior, LGSSMPreconditioner, LGSSMHelper, LGSSMSampler, ) from tqdm import tqdm np.random.seed(12345) # Parameters ## Define LGSSM Parameters A = np.eye(1)*0.95 C = np.eye...
7,269
28.673469
81
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/api_demos/garch_long_demo.py
import numpy as np from sgmcmc_ssm.models.garch import ( generate_garch_data, GARCHParameters, GARCHPrior, GARCHHelper, GARCHSampler, ) from tqdm import tqdm np.random.seed(12345) # Parameters ## Define GARCH Parameters alpha = 0.1 beta = 0.8 gamma = 0.05 tau = 0.3 log_mu, lo...
8,081
29.383459
82
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/api_demos/svm_long_demo.py
import numpy as np from sgmcmc_ssm.models.svm import ( generate_svm_data, SVMParameters, SVMPrior, SVMHelper, SVMSampler, ) from tqdm import tqdm np.random.seed(12345) # Parameters ## Define SVM Parameters A = np.eye(1)*0.95 Q = np.eye(1)*1.0 R = np.eye(1)*1.0 LQinv = np.lina...
7,747
29.868526
103
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/demo/api_demos/lgssm_long_demo.py
import numpy as np from sgmcmc_ssm.models.lgssm import ( generate_lgssm_data, LGSSMParameters, LGSSMPrior, LGSSMPreconditioner, LGSSMHelper, LGSSMSampler, ) np.random.seed(12345) # Parameters ## Define LGSSM Parameters A = np.eye(2)*0.9 Q = np.eye(2)*0.1 C = np.eye(2) R...
7,933
29.633205
101
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/driver_utils.py
import numpy as np import pandas import contextlib import os import joblib import io import time from tqdm import tqdm import logging # For Logs logger = logging.getLogger(name=__name__) def script_builder( script_name, python_script_path, python_script_args, path_to_shell_script, ...
6,683
31.926108
146
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/trace_metric_functions.py
""" Metric Functions for full parameter traces (e.g. Kernel Stein Divergence) """ import numpy as np import pandas as pd from tqdm import tqdm from itertools import product import logging LOGGING_FORMAT = '%(levelname)s: %(asctime)s - %(name)s: %(message)s ...' logging.basicConfig( level = logging.INFO, ...
3,870
31.805085
85
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/_utils.py
""" Utilities functions """ import numpy as np import pandas as pd import logging import scipy import scipy.linalg.lapack from copy import deepcopy logger = logging.getLogger(name=__name__) # Random Categorical def random_categorical(pvals, size=None): out = np.random.multinomial(n=1, pvals=pvals, size=size).d...
5,978
31.318919
138
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/plotting_utils.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import logging logger = logging.getLogger(name=__name__) def plot_metrics(evaluator, full_trace=True, burnin=None, x='iteration'): df = evaluator.get_metrics() df['variable:metric'] = df['variable']+':'+df['me...
7,187
38.065217
91
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/base_parameters.py
""" Base Parameters """ import numpy as np from copy import deepcopy # Param and ParamHelper Class class BaseParameters(object): """ Base Class for Parameters """ # List of ParamHelpers _param_helper_list = [] # Set Attributes (must be copied in each subclass) for param_helper in _param_helper_l...
10,720
29.807471
80
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/evaluator.py
import numpy as np import pandas as pd import logging import time logger = logging.getLogger(name=__name__) class BaseEvaluator(object): """ Evaluator Base Class """ def __init__(self, sampler, metric_functions=None, sample_functions=None): # Set Sampler self.sampler = sampler # Check ...
28,263
36.735648
85
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/metric_functions.py
""" Sampler Metric Function Generators """ import numpy as np def sample_function_parameter(parameter_name, return_variable_name=None): """ Returns sample function that extracts a parameter from current state Args: parameter_name (string): atrribute in sampler.parameters (e.g. A, C, LRin...
17,322
36.577007
81
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/__init__.py
from .sgmcmc_sampler import SGMCMCSampler, SGMCMCHelper from .evaluator import SamplerEvaluator
96
31.333333
55
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/sgmcmc_sampler.py
import numpy as np import pandas as pd import time from datetime import timedelta import logging from .evaluator import BaseEvaluator logger = logging.getLogger(name=__name__) NOISE_NUGGET=1e-9 # SGMCMCSampler class SGMCMCSampler(object): """ Base Class for SGMCMC with Time Series """ def __init__(self, **kwa...
82,434
39.789213
86
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/hmm_helper.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ..sgmcmc_sampler import SGMCMCHelper from .._utils import random_categorical class HMMHelper(SGMCMCHelper): """ HMM Helper forward_message (dict) with keys prob_vector (ndarray) dimension num_states l...
22,130
37.894552
127
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/__init__.py
0
0
0
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/arphmm/sampler.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...sgmcmc_sampler import SGMCMCSampler, SeqSGMCMCSampler from .parameters import ARPHMMParameters, ARPHMMPrior, ARPHMMPreconditioner from .helper import ARPHMMHelper class ARPHMMSampler(SGMCMCSampler): # Note d = m*p def __init__...
8,279
34.084746
103
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/arphmm/helper.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ..hmm_helper import HMMHelper from .parameters import stack_y from ..._utils import random_categorical class ARPHMMHelper(HMMHelper): """ ARPHMM Helper forward_message (dict) with keys prob_vector (ndarray) dimen...
13,187
38.8429
82
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/arphmm/parameters.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...base_parameters import ( BaseParameters, BasePrior, BasePreconditioner, ) from ...variables import ( TransitionMatrixParamHelper, TransitionMatrixPriorHelper, TransitionMatrixPrecondHelper, RectM...
5,128
32.522876
88
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/arphmm/__init__.py
from .parameters import ( ARPHMMParameters, ARPHMMPrior, ARPHMMPreconditioner, generate_arphmm_data, stack_y, ) from .helper import ARPHMMHelper from .sampler import ARPHMMSampler, SeqARPHMMSampler
222
21.3
52
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/gauss_hmm/sampler.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...sgmcmc_sampler import SGMCMCSampler, SeqSGMCMCSampler from .parameters import GaussHMMParameters, GaussHMMPrior, GaussHMMPreconditioner from .helper import GaussHMMHelper class GaussHMMSampler(SGMCMCSampler): def __init__(self, nu...
7,485
34.478673
100
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/gauss_hmm/helper.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ..hmm_helper import HMMHelper from ..._utils import random_categorical class GaussHMMHelper(HMMHelper): """ GaussHMM Helper forward_message (dict) with keys prob_vector (ndarray) dimension num_states ...
8,999
37.961039
78
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/gauss_hmm/parameters.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...base_parameters import ( BaseParameters, BasePrior, BasePreconditioner, ) from ...variables import ( TransitionMatrixParamHelper, TransitionMatrixPriorHelper, TransitionMatrixPrecondHelper, Vecto...
3,793
33.490909
94
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/gauss_hmm/__init__.py
from .parameters import ( GaussHMMParameters, GaussHMMPrior, GaussHMMPreconditioner, generate_gausshmm_data, ) from .helper import GaussHMMHelper from .sampler import GaussHMMSampler, SeqGaussHMMSampler
223
23.888889
56
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/lgssm/kernels.py
import numpy as np from scipy.special import expit, logsumexp from ...particle_filters.kernels import LatentGaussianKernel # LGSSMKernels: # Prior Kernel class LGSSMPriorKernel(LatentGaussianKernel): """ Prior Kernel for LGSSM K(x_{t+1} | x_t) = Pr(x_{t+1} | x_t, parameters) """ def rv(self, x_t, *...
7,345
34.487923
82
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/lgssm/sampler.py
import numpy as np from ...sgmcmc_sampler import SGMCMCSampler, SeqSGMCMCSampler from .parameters import LGSSMPrior, LGSSMPreconditioner from .helper import LGSSMHelper class LGSSMSampler(SGMCMCSampler): def __init__(self, n, m, observations=None, prior=None, parameters=None, forward_message=None, back...
3,592
34.574257
81
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/lgssm/helper.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...sgmcmc_sampler import SGMCMCHelper from .kernels import ( LGSSMPriorKernel, LGSSMOptimalKernel, LGSSMHighDimOptimalKernel, ) from ...particle_filters.buffered_smoother import ( buffered_pf_wrappe...
52,767
37.629575
81
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/lgssm/parameters.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...base_parameters import ( BaseParameters, BasePrior, BasePreconditioner, ) from ...variables import ( SquareMatrixParamHelper, SquareMatrixPriorHelper, SquareMatrixPrecondHelper, RectMatrixParamHe...
4,433
32.590909
86
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/lgssm/__init__.py
from .parameters import ( LGSSMParameters, LGSSMPrior, LGSSMPreconditioner, generate_lgssm_data, ) from .helper import LGSSMHelper from .kernels import ( LGSSMPriorKernel, LGSSMOptimalKernel, LGSSMHighDimOptimalKernel, ) from .sampler import LGSSMSampler, ...
337
21.533333
50
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/slds/sampler.py
import numpy as np from ...sgmcmc_sampler import SGMCMCSampler, SeqSGMCMCSampler from .parameters import SLDSPrior, SLDSParameters, SLDSPreconditioner from .helper import SLDSHelper class SLDSSampler(SGMCMCSampler): def __init__(self, num_states, n, m, observations=None, prior=None, parameters=None, ...
29,068
39.206086
86
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/slds/helper.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...sgmcmc_sampler import SGMCMCHelper from ..._utils import random_categorical, lower_tri_mat_inv class SLDSHelper(SGMCMCHelper): """ LGSSM Helper forward_message (dict) with keys x (dict): log_c...
53,484
39.153904
103
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/slds/parameters.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...base_parameters import ( BaseParameters, BasePrior, BasePreconditioner, ) from ...variables import ( TransitionMatrixParamHelper, TransitionMatrixPriorHelper, TransitionMatrixPrecondHelper, Squar...
5,953
34.023529
88
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/slds/__init__.py
from .parameters import ( SLDSParameters, SLDSPrior, SLDSPreconditioner, generate_slds_data, ) from .helper import SLDSHelper from .sampler import SLDSSampler
179
19
32
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/garch/kernels.py
import numpy as np from ...particle_filters.kernels import Kernel # GARCH Kernel: class GARCHPriorKernel(Kernel): # n = 2, first dimension is x_t, second is sigma2_t def sample_x0(self, prior_mean, prior_var, N, **kwargs): """ Initialize x_t Returns: x_t (N by n ndarray) ""...
5,770
30.535519
78
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/garch/sampler.py
import numpy as np from ...sgmcmc_sampler import SGMCMCSampler, SeqSGMCMCSampler from .parameters import GARCHPrior, GARCHParameters from .helper import GARCHHelper class GARCHSampler(SGMCMCSampler): def __init__(self, n=1, m=1, observations=None, prior=None, parameters=None, forward_message=None, nam...
2,499
30.25
80
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/garch/helper.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...sgmcmc_sampler import SGMCMCHelper from .kernels import GARCHPriorKernel, GARCHOptimalKernel from ...particle_filters.buffered_smoother import ( buffered_pf_wrapper, average_statistic, ) class GARCHHelper(SGMCM...
15,844
35.425287
84
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/garch/parameters.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...base_parameters import ( BaseParameters, BasePrior, BasePreconditioner, ) from ...variables import ( CovarianceParamHelper, CovariancePriorHelper, ) from ...variables.garch_var import ( GARCHPara...
4,397
29.971831
74
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/garch/__init__.py
from .parameters import ( GARCHParameters, GARCHPrior, generate_garch_data, ) from .helper import GARCHHelper from .kernels import GARCHPriorKernel, GARCHOptimalKernel from .sampler import GARCHSampler, SeqGARCHSampler
248
23.9
57
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/svm/kernels.py
import numpy as np from ...particle_filters.kernels import LatentGaussianKernel # SVM Kernels: class SVMPriorKernel(LatentGaussianKernel): def set_parameters(self, parameters): self.parameters = parameters if np.abs(parameters.A) > 1: raise ValueError("Current AR parameter is |A| = {0} ...
2,117
31.090909
76
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/svm/sampler.py
import numpy as np from ...sgmcmc_sampler import SGMCMCSampler, SeqSGMCMCSampler from .parameters import SVMPrior, SVMParameters from .helper import SVMHelper class SVMSampler(SGMCMCSampler): def __init__(self, n, m, observations=None, prior=None, parameters=None, forward_message=None, name="SVMSampler...
2,745
32.487805
76
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/svm/helper.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...sgmcmc_sampler import SGMCMCHelper from .kernels import SVMPriorKernel from ...particle_filters.buffered_smoother import ( buffered_pf_wrapper, average_statistic, ) from ..lgssm.helper import gaussian_sufficient...
14,913
36.472362
82
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/svm/parameters.py
import numpy as np import logging logger = logging.getLogger(name=__name__) from ...base_parameters import ( BaseParameters, BasePrior, BasePreconditioner, ) from ...variables import ( SquareMatrixParamHelper, SquareMatrixPriorHelper, SquareMatrixPrecondHelper, RectMatrixParamHe...
4,148
29.065217
78
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/models/svm/__init__.py
from .parameters import ( SVMParameters, SVMPrior, generate_svm_data, ) from .helper import SVMHelper from .kernels import SVMPriorKernel from .sampler import SVMSampler, SeqSVMSampler
214
20.5
46
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/variables/covariance.py
import numpy as np import scipy.stats import logging from ..base_parameters import ( ParamHelper, PriorHelper, PrecondHelper, get_value_func, get_hyperparam_func, get_dim_func, set_value_func, set_hyperparam_func, ) from .._utils import ( array_wishart_rvs, pos_def_mat_in...
28,228
39.384835
82
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/variables/matrices.py
import numpy as np import scipy.stats from ..base_parameters import ( ParamHelper, PriorHelper, PrecondHelper, get_value_func, get_hyperparam_func, get_dim_func, set_value_func, set_hyperparam_func, ) from .._utils import ( normal_logpdf, matrix_normal_logpdf, pos...
57,109
39.417551
81
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/variables/__init__.py
from .matrices import ( VectorParamHelper, VectorPriorHelper, VectorPrecondHelper, VectorsParamHelper, VectorsPriorHelper, VectorsPrecondHelper, SquareMatrixParamHelper, SquareMatrixPriorHelper, SquareMatrixPrecondHelper, SquareMatricesPara...
1,077
28.135135
38
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/variables/probweight.py
import numpy as np import scipy.stats from scipy.special import logit, expit, logsumexp from ..base_parameters import ( ParamHelper, PriorHelper, PrecondHelper, get_value_func, get_hyperparam_func, get_dim_func, set_value_func, set_hyperparam_func, ) import logging logger = logging.getLo...
21,332
39.099624
101
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/variables/garch_var.py
import numpy as np import scipy.stats from scipy.special import expit, logit from ..base_parameters import ( ParamHelper, PriorHelper, PrecondHelper, get_value_func, get_hyperparam_func, get_dim_func, set_value_func, set_hyperparam_func, ) from .._utils import ( normal_logpdf, ...
6,592
33.518325
81
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/particle_filters/custom_kernels.py
""" Advanced Kernels for particle filters """ from .kernels import * from scipy.optimize import root_scalar from scipy.special import logsumexp, roots_hermitenorm class SVMLaplaceKernel(LatentGaussianKernel): def __init__(self, **kwargs): self.approx_param=dict(mean=0, var=1) super().__init__(**kw...
14,606
36.841969
103
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/particle_filters/kernels.py
""" Kernels for particle filters """ import numpy as np from scipy.special import expit, logsumexp # Kernel class Kernel(object): def __init__(self, **kwargs): self.parameters = kwargs.get('parameters', None) self.y_next = kwargs.get('y_next', None) return def set_parameters(self, par...
4,159
27.888889
74
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/particle_filters/buffered_smoother.py
""" Wrapper Helper Class around PaRIS """ import numpy as np import functools from .pf import ( paris_smoother, nemeth_smoother, poyiadjis_smoother, pf_filter, log_normalize, ) def pf_wrapper( observations, parameters, N, kernel, smoother, additive_statistic_func...
7,476
34.268868
80
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/particle_filters/__init__.py
0
0
0
py
sgmcmc_ssm_code
sgmcmc_ssm_code-master/sgmcmc_ssm/particle_filters/pf.py
""" Bootstrap Particle Filter """ import numpy as np import functools def pf(particles, log_weights, kernel): """ Algorithm 1 of PaRIS {particles_t, weights_t} -> {particles_{t+1}, weights_{t+1}} Args: particles (ndarray): N by n, latent states (xi_t) log_weights (ndarray): N, log importa...
14,308
36.360313
121
py
Retrieving-Top-Weighted-Triangles-in-Graphs
Retrieving-Top-Weighted-Triangles-in-Graphs-master/src/print_table.py
import os import numpy as np files = [ 'tags-stack-overflow', 'threads-stack-overflow', 'wikipedia', 'eth', 'aminer', 'temporal-reddit-reply', 'MAG', 'spotify' ] datasets = [ 'tags-stack-overflow', 'threads-stack-overflow', 'Wikipedia-clickstream', 'Ethereum', 'Aminer', 'reddit-reply', ...
6,198
35.251462
107
py
Retrieving-Top-Weighted-Triangles-in-Graphs
Retrieving-Top-Weighted-Triangles-in-Graphs-master/src/plot_static_hl_tradeoff.py
import matplotlib.pyplot as plt import numpy as np def make_plot(thresholds, accs, times, k, dataset): thresholds = [0] + thresholds times = [0] + times accs = [0] + accs fig, ax = plt.subplots() # plt.subplot(2, 1, 1) plt.yticks(fontsize=18) plt.xticks(fontsize=18) for y in np.arange(0, 1, 0.2): ...
2,327
32.73913
102
py
Retrieving-Top-Weighted-Triangles-in-Graphs
Retrieving-Top-Weighted-Triangles-in-Graphs-master/src/plot_edge_weights.py
import matplotlib.patches as mpatches import matplotlib.pyplot as plt import numpy as np import powerlaw from scipy.stats import binned_statistic def drop_zeros(a_list): return [i for i in a_list if i>0] # https://stackoverflow.com/questions/16489655/plotting-log-binned-network-degree-distributions def log_bi...
3,021
38.246753
155
py
Retrieving-Top-Weighted-Triangles-in-Graphs
Retrieving-Top-Weighted-Triangles-in-Graphs-master/src/print_parallel_edge_times.py
import argparse import os files = [ 'tags-stack-overflow', 'threads-stack-overflow', 'wikipedia', 'eth', 'aminer', 'temporal-reddit-reply', 'MAG', 'spotify' ] parser = argparse.ArgumentParser() parser.add_argument('-k') args = parser.parse_args() for fname in files: path = os.path.join('../output/c...
1,123
25.139535
81
py