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
Augmentation-Adapted-Retriever
Augmentation-Adapted-Retriever-main/src/Retriever/retriever/__init__.py
from .dense_retriever import Retriever, SuccessiveRetriever from .reranker import RRPredictDataset, Reranker
108
53.5
59
py
Augmentation-Adapted-Retriever
Augmentation-Adapted-Retriever-main/src/Retriever/retriever/reranker.py
import logging import os from contextlib import nullcontext from typing import Dict import torch from torch.cuda import amp from torch.nn import functional as F from torch.utils.data import DataLoader, Dataset, IterableDataset from tqdm import tqdm from transformers import PreTrainedTokenizer from transformers.trainer...
4,921
35.731343
115
py
Augmentation-Adapted-Retriever
Augmentation-Adapted-Retriever-main/src/Retriever/retriever/dense_retriever.py
import gc import glob import logging import os import pickle from contextlib import nullcontext from typing import Dict, List import faiss import numpy as np import torch from torch.cuda import amp from torch.utils.data import DataLoader, IterableDataset from tqdm import tqdm from ..arguments import InferenceArgument...
10,514
38.382022
155
py
tifresi
tifresi-master/setup.py
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name='tifresi', version='0.1.5', description='Time Frequency Spectrogram Inversion', url='https://github.com/andimarafioti/tifresi', author='Andrés Marafioti, Nathanael Perraudin, Nicki Holligha...
1,478
38.972973
99
py
tifresi
tifresi-master/tifresi/stft.py
from ltfatpy import dgtreal, idgtreal from ltfatpy.gabor.gabdual import gabdual import numpy as np from tifresi.hparams import HParams as p from tifresi.phase.modGabPhaseGrad import modgabphasegrad from tifresi.phase.pghi import pghi class GaussTF(object): """Time frequency transform object based on a Gauss wind...
4,423
40.735849
101
py
tifresi
tifresi-master/tifresi/utils.py
import numpy as np import librosa from tifresi.hparams import HParams as p # This function might need another name def preprocess_signal(y, M=p.M): """Trim and cut signal. The function ensures that the signal length is a multiple of M. """ # Trimming y, _ = librosa.effects.trim(y) # Pre...
920
21.463415
67
py
tifresi
tifresi-master/tifresi/hparams.py
import librosa import numpy as np class HParams(object): # Signal parameters sr = 22050 # Sampling frequency of the signal M = 1024 # Ensure that the signal will be a multiple of M # STFT parameters stft_channels = 1024 # Number of frequency channels hop_size = 256 # Hop size ...
841
30.185185
100
py
tifresi
tifresi-master/tifresi/metrics.py
import numpy as np from tifresi.transforms import inv_log_spectrogram __author__ = 'Andres' def projection_loss(target_spectrogram, original_spectrogram): magnitude_error = np.linalg.norm(np.abs(target_spectrogram) - np.abs(original_spectrogram), 'fro') / \ np.linalg.norm(np.abs(target_spectrogram), 'fro') ...
1,127
36.6
114
py
tifresi
tifresi-master/tifresi/__init__.py
try: import matplotlib.pyplot as pyplot except: import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as pyplot from tifresi import stft from tifresi import hparams from tifresi import metrics from tifresi import utils
251
20
38
py
tifresi
tifresi-master/tifresi/transforms.py
import librosa import numpy as np from tifresi.hparams import HParams as p __author__ = 'Andres' def log_spectrogram(spectrogram, dynamic_range_dB=p.stft_dynamic_range_dB): """Compute the log spectrogram representation from a spectrogram.""" spectrogram = np.abs(spectrogram) # for safety minimum_relativ...
2,168
47.2
129
py
tifresi
tifresi-master/tifresi/phase/pghi.py
import numpy as np import heapq import numba from numba import njit __author__ = 'Andres' @njit def pghi(spectrogram, tgrad, fgrad, a, M, L, tol=1e-7): """"Implementation of "A noniterativemethod for reconstruction of phase from STFT magnitude". by Prusa, Z., Balazs, P., and Sondergaard, P. Published in IEEE/ACM...
3,471
40.831325
245
py
tifresi
tifresi-master/tifresi/phase/modGabPhaseGrad.py
# -*- coding: utf-8 -*- # ######### COPYRIGHT ######### # Credits # ####### # # Copyright(c) 2015-2018 # ---------------------- # # * `LabEx Archimède <http://labex-archimede.univ-amu.fr/>`_ # * `Laboratoire d'Informatique Fondamentale <http://www.lif.univ-mrs.fr/>`_ # (now `Laboratoire d'Informatique et Systèmes <ht...
15,380
33.956818
81
py
tifresi
tifresi-master/tifresi/phase/pghi_masked.py
import numpy as np import heapq import numba from numba import njit __author__ = 'Andres' @njit def pghi(spectrogram, tgrad, fgrad, a, M, L, mask, tol=1e-7, phase=None): """"Implementation of "A noniterativemethod for reconstruction of phase from STFT magnitude". by Prusa, Z., Balazs, P., and Sondergaard, P. Pub...
4,078
40.622449
244
py
tifresi
tifresi-master/tifresi/phase/__init__.py
from tifresi.phase import modGabPhaseGrad from tifresi.phase import pghi_masked from tifresi.phase import pghi
110
36
41
py
tifresi
tifresi-master/tifresi/tests/test_stft.py
import sys # sys.path.append('../') import numpy as np from tifresi.stft import GaussTF, GaussTruncTF def test_stft_different_length(a = 128, M = 1024, trunc=False): L = 128 * 1024 if trunc: tfsystem = GaussTruncTF(a, M) else: tfsystem = GaussTF(a, M) x = np.random.rand(L) ...
2,917
30.042553
65
py
tifresi
tifresi-master/tifresi/tests/__init__.py
0
0
0
py
tifresi
tifresi-master/tifresi/tests/test_transforms.py
import librosa import numpy as np import sys # sys.path.append('../') from tifresi.transforms import log_spectrogram, inv_log_spectrogram, log_mel_spectrogram, mel_spectrogram __author__ = 'Andres' def test_log_spectrogram(): x = np.random.rand(1024 * 1024).reshape([1024, 1024]) log_x = log_spectrogram(x, ...
1,922
25.342466
105
py
tifresi
tifresi-master/tifresi/pipelines/LJspeech.py
import numpy as np import librosa from tifresi.stft import GaussTF, GaussTruncTF from tifresi.pipelines.LJparams import LJParams as p from tifresi.transforms import mel_spectrogram, log_spectrogram from tifresi.utils import downsample_tf_time, preprocess_signal, load_signal def compute_mag_mel_from_path(path): y, ...
1,611
32.583333
113
py
tifresi
tifresi-master/tifresi/pipelines/LJparams.py
from tifresi.hparams import HParams from tifresi.utils import downsample_tf_time import librosa import numpy as np class LJParams(HParams): # Signal parameters sr = 22050 # Sampling frequency of the signal M = 2*1024 # Ensure that the signal will be a multiple of M # STFT parameters stft_...
1,044
32.709677
100
py
tifresi
tifresi-master/tifresi/pipelines/__init__.py
from tifresi.pipelines import LJspeech
38
38
38
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_iemocap_gemaps_ccc.py
# Dimensional speech emotion recognition # To evaluate loss function (MSE vs CCC) # Coded by Bagus Tris Atmaja (bagus@ep.its.ac.id) # changelog # 2020-02-13: Modified from gemaps-paa hfs # 2020-02-14: Use 'tanh' activation to lock the output range in [-1, 1] # with RMSprop optimizer import numpy as np impo...
4,905
34.042857
123
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_iemocap_gemaps_mse.py
# Dimensional speech emotion recognition # To evaluate loss function (MSE vs CCC) # Coded by Bagus Tris Atmaja (bagus@ep.its.ac.id) # changelog # 2020-02-13: Modified from gemaps-paa hfs import numpy as np import pickle import pandas as pd import keras.backend as K from keras.models import Model from keras.layers imp...
4,769
34.333333
123
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_improv_gemaps_mse.py
# ser_improv_paa_ccc.py # speech emotion recognition for MSP-IMPROV dataset with pyAudioAnalysis # HFS features using CCC-based loss function # coded by Bagus Tris Atmaja (bagus@ep.its.ac.id) # changelog: # 2020-02-13: Inital code, modified from deepMLP repo import numpy as np import pickle import pandas as pd impor...
4,639
32.868613
123
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_iemocap_paa_ccc.py
# Dimensional speech emotion recognition from acoustic # Changelog: # 2019-09-01: initial version # 2019-10-06: optimizer MTL parameters with linear search (in progress) # 2020-12-25: modified fot ser_iemocap_loso_hfs.py # feature is either std+mean or std+mean+silence (uncomment line 44) # 2020-02-13: Modi...
4,495
35.552846
123
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_improv_paa_ccc.py
# ser_improv_paa_ccc.py # speech emotion recognition for MSP-IMPROV dataset with pyAudioAnalysis # HFS features using CCC-based loss function # coded by Bagus Tris Atmaja (bagus@ep.its.ac.id) # changelog: # 2020-02-13: Inital code, modified from deepMLP repo import numpy as np import pickle import pandas as pd impor...
4,666
32.818841
123
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_improv_paa_mse.py
# ser_improv_paa_ccc.py # speech emotion recognition for MSP-IMPROV dataset with pyAudioAnalysis # HFS features using CCC-based loss function # coded by Bagus Tris Atmaja (bagus@ep.its.ac.id) # changelog: # 2020-02-13: Inital code, modified from deepMLP repo import numpy as np import pickle import pandas as pd impor...
4,663
32.797101
123
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_improv_gemaps_ccc.py
# ser_improv_paa_ccc.py # speech emotion recognition for MSP-IMPROV dataset with pyAudioAnalysis # HFS features using CCC-based loss function # coded by Bagus Tris Atmaja (bagus@ep.its.ac.id) # changelog: # 2020-02-13: Inital code, modified from deepMLP repo import numpy as np import pickle import pandas as pd impor...
4,545
32.426471
123
py
ccc_mse_ser
ccc_mse_ser-master/code/ser_iemocap_paa_mse.py
# CSL Paper: Dimensional speech emotion recognition from acoustic and text # Changelog: # 2019-09-01: initial version # 2019-10-06: optimizer MTL parameters with linear search (in progress) # 2012-12-25: modified fot ser_iemocap_loso_hfs.py # feature is either std+mean or std+mean+silence (uncomment line 44...
4,452
35.203252
123
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/audio_process/audio_cut.py
''' The code is to get the audio in the video and downsample it to 16Khz. ''' import os import subprocess from tqdm import tqdm # Setting audio Parameters sr = 16000 # sample rate start_time = 0.0 # cut start time length_time = 2.0 # cut audio length outpath = '../raw_audio' os.makedirs(outpath, exist_ok=True) train...
2,692
38.028986
118
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/audio_process/check_file.py
file = open('mix_2_spk_tt.txt', 'r').readlines() lines = [] for l in file: lines.append(l.replace('\n', '')) non_same = [] for line in lines: line = line.split(' ') if line[0] not in non_same: non_same.append(line[0]) if line[2] not in non_same: non_same.append(line[2]) print(len(no...
328
18.352941
48
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/audio_process/audio_check.py
from tqdm import tqdm file = open('mix_2_spk_tt.txt', 'r').readlines() index = [] for line in file: line = line.split(' ') s1 = line[0].split('/')[-1] s2 = line[2].replace('\n','').split('/')[-1] if s1 not in index: index.append(s1) if s2 not in index: index.append(s2) print(len...
328
18.352941
48
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/audio_process/audio_path.py
''' This part of the code is mainly to generate a txt file of mixed audio, the file format is: spk1 SDR spk2 SDR. ''' import os import random import decimal # step1: get all audio path train_audio = [] val_audio = [] test_audio = [] path = '/data2/likai/AV-Model-lrs3/AV_data/raw_audio' for root, dirs, files in os.w...
5,128
30.466258
134
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/audio_process/.ipynb_checkpoints/audio_mix-checkpoint.py
import os import librosa import numpy as np from tqdm import tqdm data_type = ['tr', 'cv', 'tt'] dataroot = '../raw_audio' output_dir16k = '../audio_mouth/2speakers/wav16k' output_dir8k = '../audio_mouth/2speakers/wav8k' # create data path for i_type in data_type: # 16k os.makedirs(os.path.join(output_dir16k, ...
2,795
41.363636
111
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/video_process/video_process.py
import cv2 import os import matplotlib.pyplot as plt import dlib import numpy as np from tqdm import tqdm import subprocess import face_recognition def get_frames(pathlist, fps=25): # pathlist type list for path in tqdm(pathlist): index = path.split('/')[-2]+'_'+path.split('/')[-1].split('.')[0] ...
6,490
39.56875
111
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/video_process/video_to_np.py
''' reading image file to npz file ''' import numpy as np import os import cv2 from tqdm import tqdm root = '../mouth' save_path = '../npz' #save_path = './' os.makedirs(save_path, exist_ok=True) mouth = open('valid_mouth.txt', 'r').readlines() if_use_mouth = True # if use mouth image(True: use mouth, False: use ...
2,814
28.631579
83
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/video_process/.ipynb_checkpoints/video_to_np-checkpoint.py
''' reading image file to npz file ''' import numpy as np import os import cv2 from tqdm import tqdm root = '../mouth' #save_path = '../video_mouth' save_path = '../video/' os.makedirs(save_path, exist_ok=True) mouth = open('valid_mouth.txt', 'r').readlines() if_use_mouth = True # if use mouth image(True: use mou...
3,037
27.933333
82
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/video_process/.ipynb_checkpoints/video_process-checkpoint.py
import cv2 import os import matplotlib.pyplot as plt import dlib import numpy as np from tqdm import tqdm import subprocess import face_recognition def get_frames(file, fps=25): # file: path of video txt pathlist = [] with open(file, 'r') as f: lines = f.readlines() for line in lines: ...
6,427
39.683544
111
py
LRS3-For-Speech-Separation
LRS3-For-Speech-Separation-master/video_process/.ipynb_checkpoints/check_mouth-checkpoint.py
''' Check if all mouths contain 50 frames. ''' import os from tqdm import tqdm file = open('valid_mouth.txt', 'w') mouth = '../mouth' folder = os.listdir(mouth) for f in tqdm(folder): flag = True for i in range(1, 51): fi = os.path.join(mouth, f, '{:02d}.png').format(i) if not os.path.exists(fi...
434
18.772727
59
py
LDU
LDU-main/monocular_depth_estimation/utils/eval_with_pngs.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
8,447
35.89083
153
py
LDU
LDU-main/monocular_depth_estimation/utils/extract_official_train_test_set_from_mat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ####################################################################################### # The MIT License # Copyright (c) 2014 Hannes Schulz, University of Bonn <schulz@ais.uni-bonn.de> # Copyright (c) 2013 Benedikt Waldvogel, University of Bonn <mail@bwaldvog...
3,664
37.989362
106
py
LDU
LDU-main/monocular_depth_estimation/utils/download_from_gdrive.py
# Source: https://stackoverflow.com/a/39225039 import requests def download_file_from_google_drive(id, destination): def get_confirm_token(response): for key, value in response.cookies.items(): if key.startswith('download_warning'): return value return None def s...
1,353
28.434783
82
py
LDU
LDU-main/monocular_depth_estimation/pytorch/distributed_sampler_no_evenly_divisible.py
import math import torch from torch.utils.data import Sampler import torch.distributed as dist class DistributedSamplerNoEvenlyDivisible(Sampler): """Sampler that restricts data loading to a subset of the dataset. It is especially useful in conjunction with :class:`torch.nn.parallel.DistributedDataParall...
2,659
35.438356
82
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts_live_3d.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
17,345
34.4
148
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts_main.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
28,993
47.976351
165
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts_ldu.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
19,379
47.693467
180
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts_test_kitti_ldu.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
11,451
40.492754
235
py
LDU
LDU-main/monocular_depth_estimation/pytorch/sparsification.py
import numpy as np import torch """Calculate the sparsification error. Calcualte the sparsification error for a given array according to a reference array. Args: unc_tensor: Flatten estimated uncertainty tensor. pred_tensor: Flatten depth prediction tensor. gt_tensor: Flatten ground...
3,034
42.357143
192
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts_dataloader.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
11,674
38.982877
122
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts_eval.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
12,104
38.819079
143
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts_test.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
9,732
43.040724
116
py
LDU
LDU-main/monocular_depth_estimation/pytorch/run_bts_eval_schedule.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
1,900
39.446809
109
py
LDU
LDU-main/monocular_depth_estimation/pytorch/bts.py
# Copyright (C) 2019 Jin Han Lee # # This file is a part of BTS. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
17,122
50.575301
180
py
ros-sharp
ros-sharp-master/ROS/unity_simulation_scene/scripts/mouse_to_joy.py
#!/usr/bin/env python # Siemens AG, 2018 # Author: Berkay Alp Cakal (berkay_alp.cakal.ct@siemens.com) # 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,113
28.774648
74
py
ros-sharp
ros-sharp-master/ROS/gazebo_simulation_scene/scripts/joy_to_twist.py
#!/usr/bin/env python # Siemens AG, 2018 # Author: Berkay Alp Cakal (berkay_alp.cakal.ct@siemens.com) # 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-...
1,921
26.855072
75
py
PSE
PSE-master/PSEv1/variant.py
## \package PSEv1.variant # classes representing the variant class to facilitate box_resize from hoomd.PSEv1 import _PSEv1 from hoomd.PSEv1 import shear_function from hoomd import variant from hoomd import _hoomd import hoomd import sys ## Variant class holding a functional form of shear field # Used as an argument...
1,327
39.242424
130
py
PSE
PSE-master/PSEv1/integrate.py
# First, we need to import the C++ module. It has the same name as this module (plugin_template) but with an underscore # in front from hoomd.PSEv1 import _PSEv1 from hoomd.PSEv1 import shear_function # Next, since we are extending an integrator, we need to bring in the base class integrator and some other parts from ...
5,578
43.277778
154
py
PSE
PSE-master/PSEv1/__init__.py
# this file exists to mark this directory as a python module # need to import all submodules defined in this directory from hoomd.PSEv1 import integrate from hoomd.PSEv1 import shear_function from hoomd.PSEv1 import variant
224
36.5
60
py
PSE
PSE-master/PSEv1/shear_function.py
## \package PSEv1.shear_function # classes representing shear functions, which can be input of an integrator and variant # to shear the box of a simulation from hoomd.PSEv1 import _PSEv1 import hoomd ## shear function interface representing shear flow field described by a function class _shear_function: ## Const...
5,763
49.121739
144
py
PSE
PSE-master/examples/run.py
import hoomd; from hoomd import _hoomd from hoomd.md import _md import hoomd.PSEv1 import os; import math hoomd.context.initialize(''); # Time stepping information dt = 1e-3 # time step tf = 1e0 # the final time of the simulation (in units of bare particle diffusion time) nrun = tf / dt # number of steps #...
2,068
33.483333
136
py
online-active-model-selection
online-active-model-selection-master/__init__.py
from . import *
16
7.5
15
py
online-active-model-selection
online-active-model-selection-master/src/__init__.py
0
0
0
py
online-active-model-selection
online-active-model-selection-master/src/methods/model_picker.py
import numpy as np """This code runs stream based model picker (proposed algorithm).""" def model_picker(data, idx_budget, streaming_data_indices, tuning_par, mode): """ :param data: :param streaming_data_indices: :param tuning_par: :param mode: modes include {predictive} :return: """ #...
4,004
32.375
129
py
online-active-model-selection
online-active-model-selection-master/src/methods/query_by_committee.py
import numpy as np import scipy.stats as stats def query_by_committee(data, idx_budget, streaming_data_indices, tuning_par): # Set vals, params if idx_budget == 'tuning mode': budget = data._num_instances else: budget = data._budgets[idx_budget] # Edit the input data accordingly with ...
1,601
31.693878
91
py
online-active-model-selection
online-active-model-selection-master/src/methods/efficient_active_learning.py
import numpy as np import sys import mpmath sys.modules['sympy.mpmath'] = mpmath from sympy.solvers.solvers import * def efficient_active_learning(data, idx_budget, streaming_data_indices, c0, constant_efal): # Set vals, params c1 = 1 c2 = c1 if idx_budget == 'tuning mode': budget = data._nu...
4,531
24.60452
97
py
online-active-model-selection
online-active-model-selection-master/src/methods/importance_weighted_active_learning.py
import numpy as np import numpy.matlib def importance_weighted_active_learning(data, idx_budget, streaming_data_indices, tuning_par, constant_iwal): # Set vals, params if idx_budget == 'tuning mode': budget = data._num_instances else: budget = data._budgets[idx_budget] # Edit the inp...
4,912
31.322368
126
py
online-active-model-selection
online-active-model-selection-master/src/methods/random_sampling_disagreement.py
import numpy as np """Random sampling code for stream based model selection.""" def random_sampling_disagreement(data, idx_budget, streaming_data_indices, tuning_par_rs): """ :param data: :param streaming_data_indices: :return: """ # Set params num_instances = data._num_instances budget...
1,975
32.491525
100
py
online-active-model-selection
online-active-model-selection-master/src/methods/__init__.py
from . import *
16
7.5
15
py
online-active-model-selection
online-active-model-selection-master/src/methods/random_sampling.py
import numpy as np """Random sampling code for stream based model selection (unused).""" def random_sampling(data, idx_budget, streaming_data_indices): """ :param data: :param streaming_data_indices: :return: """ # Set params num_instances = data._num_instances budget = data._budgets[id...
612
25.652174
69
py
online-active-model-selection
online-active-model-selection-master/src/methods/structural_query_by_committee.py
import numpy as np import scipy.stats as stats def structural_query_by_committee(data, idx_budget, streaming_data_indices, tuning_par, constant_sqbc): # Set vals, params if idx_budget == 'tuning mode': budget = data._num_instances else: budget = data._budgets[idx_budget] # Edit the i...
2,392
32.704225
103
py
online-active-model-selection
online-active-model-selection-master/src/evaluation/evaluate_base.py
"""Base class for the evaluations.""" from src.evaluation.evaluation_pipeline.evaluate_main import * class Evals: def __init__(self, data, client=None): """Evaluate methods""" eval_results = evaluate_main(data, client=client) """Assigns evaluations to the self""" self._prob_succ ...
842
31.423077
71
py
online-active-model-selection
online-active-model-selection-master/src/evaluation/__init__.py
from . import *
16
7.5
15
py
online-active-model-selection
online-active-model-selection-master/src/evaluation/evaluation_pipeline/evaluate_realizations.py
from src.evaluation.aux.compute_precision_measures import * import tqdm import zlib, cloudpickle def evaluate_realizations(log_slice, predictions, oracle, freq_window_size, method): """ This function evaluates the method in interest for given realization of the pool/streaming instances Parameters: :pa...
7,747
39.778947
168
py
online-active-model-selection
online-active-model-selection-master/src/evaluation/evaluation_pipeline/evaluate_main.py
# from src.evaluation.evaluation_pipeline.evaluate_method import * from src.evaluation.evaluation_pipeline.evaluate_realizations import * from src.evaluation.aux.load_results import * from dask.distributed import Client, as_completed from tqdm.auto import tqdm, trange import cloudpickle, zlib def evaluate_main(data,...
8,318
41.015152
206
py
online-active-model-selection
online-active-model-selection-master/src/evaluation/evaluation_pipeline/__init__.py
0
0
0
py
online-active-model-selection
online-active-model-selection-master/src/evaluation/aux/load_results.py
import numpy as np def load_results(data, idx_budget): """ This function loads the experiment results in the results folder for a given budget """ # Load data experiment_results = np.load(str(data._resultsdir) + '/experiment_results_'+ 'budget'+str(data._budgets[idx_budget]) + '.npz') # Extrac...
749
38.473684
130
py
online-active-model-selection
online-active-model-selection-master/src/evaluation/aux/compute_precision_measures.py
import numpy as np import numpy.matlib def compute_precisions(pred, orac, num_models): """ This function computes the agreements """ # Replicate oracle realization orac_rep = np.matlib.repmat(orac.reshape(np.size(orac), 1), 1, num_models) # Compute errors true_pos = (pred == orac_rep) * 1 ...
3,628
26.08209
98
py
online-active-model-selection
online-active-model-selection-master/src/publish_evals/publish_evals.py
import matplotlib.pyplot as plt plt.rc('text', usetex=True) plt.style.use('classic') plt.style.use('default') import seaborn as sns import numpy as np sns.set() """This function plots the evaluation results for the streaming setting.""" def publish_evals(resultsdir): """ :param resultsdir: :return: "...
2,742
34.166667
135
py
online-active-model-selection
online-active-model-selection-master/dev/cluster-up.py
#!/usr/bin/env python3 import os import paramiko import sys print(os.environ.keys()) SCHEDULER_HOST = os.environ.get("SCHEDULER_HOST", None) if not SCHEDULER_HOST: raise ValueError("The variable SCHEDULER_HOST not defined.") print("SCHEDULER_HOST=%s" % SCHEDULER_HOST) WORKER_HOSTS = os.environ.get("WORKER_HOSTS...
1,951
32.084746
118
py
online-active-model-selection
online-active-model-selection-master/dev/cluster-down.py
#!/usr/bin/env python3 import os import paramiko import sys print(os.environ.keys()) SCHEDULER_HOST = os.environ.get("SCHEDULER_HOST", None) if not SCHEDULER_HOST: raise ValueError("The variable SCHEDULER_HOST not defined.") print("SCHEDULER_HOST=%s" % SCHEDULER_HOST) WORKER_HOSTS = os.environ.get("WORKER_HOSTS...
1,949
32.050847
117
py
online-active-model-selection
online-active-model-selection-master/experiments/run_experiment.py
from experiments.base.tune_hyperpar_base import * from experiments.base.experiments_base import * from src.evaluation.evaluate_base import * from experiments.base.set_data import * from src.publish_evals.publish_evals import * from datetime import datetime import time import os import shelve import sys from dask.distri...
6,687
39.533333
227
py
online-active-model-selection
online-active-model-selection-master/experiments/reproduce_experiment.py
from experiments.run_experiment import * from dask.distributed import LocalCluster def main(dataset_name, cluster=None): experiment = dataset_name load_hyperparameters = 'true' if experiment == 'EmoContext': # Emotion Detection DatasetName = 'emotion_detection' # StreamSiz...
4,600
27.937107
228
py
online-active-model-selection
online-active-model-selection-master/experiments/__init__.py
from . import *
16
7.5
15
py
online-active-model-selection
online-active-model-selection-master/experiments/base/tune_hyperpar_base.py
import numpy as np from src.methods.model_picker import * from src.methods.random_sampling import * from src.methods.query_by_committee import * from src.methods.efficient_active_learning import * from src.evaluation.aux.compute_precision_measures import * from src.methods.structural_query_by_committee import * from pa...
12,220
43.60219
192
py
online-active-model-selection
online-active-model-selection-master/experiments/base/set_data.py
"""Preprocess the model predictions""" from src.evaluation.aux.compute_precision_measures import * from pathlib import Path import numpy as np class SetData(): def __init__(self, data_set_name, pool_size, pool_setting, budgets, num_reals, eval_window_size, resultsdir, num_reals_tuning, grid_size, load_hyperparamet...
8,799
43
588
py
online-active-model-selection
online-active-model-selection-master/experiments/base/experiments_base.py
from src.methods.model_picker import * from src.methods.random_sampling import * from src.methods.query_by_committee import * from src.methods.efficient_active_learning import * from src.methods.random_sampling_disagreement import * from src.methods.importance_weighted_active_learning import * from src.methods.structur...
9,226
43.574879
167
py
online-active-model-selection
online-active-model-selection-master/experiments/base/__init__.py
from . import *
16
7.5
15
py
online-active-model-selection
online-active-model-selection-master/resources/__init__.py
from . import *
16
7.5
15
py
Turkish-Word2Vec
Turkish-Word2Vec-master/trainCorpus.py
from __future__ import print_function import logging import sys import multiprocessing from gensim.models import Word2Vec from gensim.models.word2vec import LineSentence if __name__ == '__main__': if len(sys.argv) < 3: print("Please provide two arguments, first one is path to the revised corpus, second one is pa...
770
29.84
130
py
Turkish-Word2Vec
Turkish-Word2Vec-master/preprocess.py
from __future__ import print_function import os.path import sys from gensim.corpora import WikiCorpus import xml.etree.ElementTree as etree import warnings import logging import string from gensim import utils def tokenize_tr(content,token_min_len=2,token_max_len=50,lower=True): if lower: lowerMap = {ord(u'A'): u'...
1,844
37.4375
494
py
DelayResolvedRL
DelayResolvedRL-main/Gym(Stochastic)/env_stochasticdelay.py
import gym # import gym_minigrid import numpy as np import random from collections import deque import copy class Environment: def __init__(self, seed, game_name, gamma, use_stochastic_delay, delay, min_delay): """Initialize Environment""" self.game_name = game_name self.env = gym.make(sel...
4,618
37.491667
108
py
DelayResolvedRL
DelayResolvedRL-main/Gym(Stochastic)/agent.py
import tensorflow as tf import numpy as np import random import copy from statistics import mean from collections import deque GPUs = tf.config.experimental.list_physical_devices('GPU') if GPUs: try: for gpu in GPUs: tf.config.experimental.set_memory_growth(gpu, True) except RuntimeError a...
12,554
41.849829
112
py
DelayResolvedRL
DelayResolvedRL-main/Gym(Stochastic)/plot.py
import numpy as np import matplotlib.pyplot as plt # import matplotlib.ticker as mtick import os import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 matplotlib.rcParams.update({'font.size': 13}) # ver = '6.0' def running_mean(x, n): cumulative_sum = np.cumsum(np.in...
9,961
40.508333
125
py
DelayResolvedRL
DelayResolvedRL-main/Gym(Stochastic)/train.py
import datetime import os import argparse import time os.environ['TF_CPP_MIN_LOG_LEVEL'] = "3" # Suppress Tensorflow Messages os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # Set CPU/GPU import numpy as np from agent import * from env_stochasticdelay import Environment parser = argparse.ArgumentParser() parser.add_argum...
4,643
35.28125
121
py
DelayResolvedRL
DelayResolvedRL-main/Gym(Stochastic)/env.py
import gym # import gym_minigrid import numpy as np from collections import deque class Environment: def __init__(self, game_name, delay, seed): """Initialize Environment""" self.game_name = game_name self.env = gym.make(self.game_name) self.env.seed(seed) np.random.seed(se...
2,014
31.5
103
py
DelayResolvedRL
DelayResolvedRL-main/W-Maze/DQN/env_stochasticdelay.py
import numpy as np from collections import deque import copy import random class Environment: """Initialize Environment""" def __init__(self, seed, gamma, use_stochastic_delay, delay, min_delay): np.random.seed(seed) random.seed(seed) self.call = 0 self.breadth = 7 self...
6,966
43.094937
115
py
DelayResolvedRL
DelayResolvedRL-main/W-Maze/DQN/agent.py
import tensorflow as tf import numpy as np import random import copy from statistics import mean from collections import deque GPUs = tf.config.experimental.list_physical_devices('GPU') if GPUs: try: for gpu in GPUs: tf.config.experimental.set_memory_growth(gpu, True) except RuntimeError a...
11,830
42.818519
134
py
DelayResolvedRL
DelayResolvedRL-main/W-Maze/DQN/plot.py
import numpy as np import matplotlib.pyplot as plt # import matplotlib.ticker as mtick import os import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 matplotlib.rcParams.update({'font.size': 13}) def running_mean(x, n): cumulative_sum = np.cumsum(np.insert(x, 0, 0)...
9,639
39.504202
120
py
DelayResolvedRL
DelayResolvedRL-main/W-Maze/DQN/train.py
import datetime import os import argparse import time '''Hyperparameters''' # W-Maze # Number of Runs:10 \\ # Number of Frames: 1 Million \\ # Batch Size: 32 \\ # $\gamma$: 0.99 \\ # Learning Rate: 1e-3 \\ # $\epsilon$-Start: 1.0 \\ # $\epsilon$-Stop: 1e-4 \\ # $\epsilon$-Decay: 1e-5 \\ # Hidden Units: [200] \\ # Repl...
5,018
33.854167
128
py
DelayResolvedRL
DelayResolvedRL-main/W-Maze/DQN/env.py
import numpy as np from collections import deque import random class Environment: """Initialize Environment""" def __init__(self, seed, delay): np.random.seed(seed) random.seed(seed) self.call = 0 self.breadth = 7 self.length = 11 self.state_space = np.empty([se...
4,592
41.925234
115
py
DelayResolvedRL
DelayResolvedRL-main/W-Maze/Tabular-Q/dr_agent.py
import numpy as np from collections import deque '''Q-learning agent for the augmented agent''' class Agent: def __init__(self, state_space, num_actions, delay): self.epsilon = 1.0 self.num_actions = num_actions self.delay = delay self.actions_in_buffer = deque(maxlen=self.delay) ...
1,859
38.574468
105
py