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
correlate
correlate-master/regret.py
import numpy as np import pandas as pd from config import target_label, verbosity_thesis def get_last_outcome(ts_measured_actual, n_samples_per_generation): """ in the last n_samples_per_generation of ts_measured_actual get value of the target_label """ outcome_last = np.array(ts_measured_actual.loc[...
3,012
44.651515
155
py
correlate
correlate-master/apis/weather.py
import json import time import urllib.request import numpy as np import pandas as pd from keys import key_open_weather def flatten_data(y): """flatten json""" out = {} def flatten(x, name=''): if type(x) is dict: for a in x: flatten(x[a], name + a + '_') elif ...
4,049
38.320388
143
py
correlate
correlate-master/venvCorrleateOnly3.9Fuck/lib/python3.9/site-packages/tigramite/plotting.py
"""Tigramite plotting package.""" # Author: Jakob Runge <[email protected]> # # License: GNU General Public License v3.0 import numpy as np import matplotlib from matplotlib.colors import ListedColormap import matplotlib.transforms as transforms from matplotlib import pyplot, ticker from matplotlib.ticker import F...
110,838
33.680538
109
py
correlate
correlate-master/venvCorrleateOnly3.9Fuck/lib/python3.9/site-packages/tigramite/independence_tests/independence_tests_base.py
"""Tigramite causal discovery for time series.""" # Author: Jakob Runge <[email protected]> # # License: GNU General Public License v3.0 from __future__ import print_function import warnings import math import abc import numpy as np import six from hashlib import sha1 @six.add_metaclass(abc.ABCMeta) class CondI...
38,744
36.616505
151
py
correlate
correlate-master/intervention_proposal/test_get_intervention.py
import pickle import numpy as np from config import checkpoint_path from intervention_proposal.get_intervention import find_optimistic_intervention, \ drop_redundant_information_due_to_symmetry, get_ambiguous_graph_locations, create_all_graph_combinations, \ graph_to_scm, lin_f, make_redundant_information_wit...
5,350
45.12931
139
py
correlate
correlate-master/intervention_proposal/simulate.py
3
0
0
py
correlate
correlate-master/intervention_proposal/propose_from_eq.py
import numpy as np from config import target_label, verbosity_thesis def drop_unintervenable_variables(target_eq, measured_labels): """ drop variables from equations which can't be intervened upon """ # names of unintervenable vars # targetlabel unintervenable_vars = ['u_'+str(target_label)...
3,319
34.319149
112
py
correlate
correlate-master/intervention_proposal/get_intervention.py
import itertools from multiprocessing import Pool from matplotlib import pyplot as plt from scipy.stats import norm from tigramite import plotting as tp from tqdm import tqdm from config import private_folder_path, show_plots import numpy as np import pandas as pd from config import verbosity_thesis, target_label, t...
25,836
42.496633
203
py
correlate
correlate-master/causal_discovery/preprocessing.py
# Imports ## use `%matplotlib notebook` for interactive figures # plt.style.use('ggplot') from datetime import timedelta import numpy as np import pandas as pd def remove_nan_seq_from_top_and_bot(df): for column in df: # reset index df = df.set_index('Date') df = df.reset_index() ...
2,986
30.442105
103
py
correlate
correlate-master/causal_discovery/gen_configs.py
import numpy as np from config import n_scms def define_settings(): """ generate settings for simulation study """ settings_default_and_list = { # n obs before first intervention 'n_ini_obs': [50, [10, 50, 100]], # n measured vars 'n_vars_measured': [5, np.arange(5, ...
5,113
38.643411
125
py
correlate
correlate-master/causal_discovery/interventional_discovery.py
import numpy as np import pandas as pd import pingouin as pg from scipy.stats import pearsonr from config import verbosity_thesis, tau_max, target_label, interventional_discovery_on from data_generation import labels_to_ints def interventional_pass_filter(ts, was_intervened, tau): """ return only data with i...
16,762
42.427461
178
py
correlate
correlate-master/causal_discovery/helper.py
import numpy as np def parabola(x, a, b, c): x = np.array(x) return a * x ** 2 + b * x + c def arg_closest(lst, x): lst = np.subtract(lst, x) return np.where(lst == min(lst, key=abs))[0][0] # def reduce_tau_max(correlations): # # 3d-> 2D via reshape, 2D->1D via amax, abs # abs_max_corr_coe...
1,695
41.4
115
py
correlate
correlate-master/causal_discovery/scratch_pad.py
0
0
0
py
correlate
correlate-master/causal_discovery/read_results.py
import math import pickle import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from config import checkpoint_path, n_scms, plots_path def boxplot_from_df(regret_of_setting_df, x_label, y_label, save_name): n_settings = regret_of_setting_df.shape[1] data_values =...
7,413
37.414508
145
py
correlate
correlate-master/causal_discovery/test_interventional_discovery.py
import numpy as np import pandas as pd from pandas.testing import assert_frame_equal from causal_discovery import interventional_discovery from causal_discovery.interventional_discovery import remove_weaker_links_of_contempt_cycles, \ get_interv_tau_aligned_cause_eff_df from config import checkpoint_path class T...
10,390
45.388393
120
py
correlate
correlate-master/causal_discovery/LPCMCI/compute_experiments.py
# """ # research module causal discovery: # simulate data, causal discovery, evaluate # # """ # import math # import os # import pickle # import random as rd # import time # # import numpy as np # import tigramite.data_processing as pp # from matplotlib import pyplot as plt # from tigramite import plotting as tp # from...
20,531
38.790698
187
py
correlate
correlate-master/causal_discovery/LPCMCI/plan.py
import pickle import numpy as np import pandas as pd from tqdm import tqdm from causal_discovery.LPCMCI.observational_discovery import observational_causal_discovery from causal_discovery.gen_configs import define_settings from causal_discovery.interventional_discovery import get_independencies_from_interv_data from ...
18,416
41.144165
215
py
correlate
correlate-master/causal_discovery/LPCMCI/svarrfci.py
# import numpy as np # from itertools import product, combinations # import os # # class SVARRFCI(): # r""" # This class implements an adapation of the RFCI algorithm to stationary time series with the assumption of no selection variables. The RFCI algorithm was introduced in: # # Colombo, D., Maathuis,...
106,886
46.696118
702
py
correlate
correlate-master/causal_discovery/LPCMCI/plot_experiments.py
import matplotlib as mpl # print([key for key in list(mpl.rcParams.keys()) if 'pad' in key]) params = { 'figure.figsize': (8, 10), 'legend.fontsize': 8, # 'title.fontsize': 8, 'lines.color':'black', 'lines.linewidth':1, 'xtick.labelsize':4, 'xtick.majo...
28,125
35.814136
165
py
correlate
correlate-master/causal_discovery/LPCMCI/test_observational_discovery.py
import pickle from matplotlib import pyplot as plt from tigramite import plotting as tp from tigramite.independence_tests import ParCorr from causal_discovery.LPCMCI.lpcmci import LPCMCI from config import checkpoint_path class TestLPCMCI: def test_orient_with_interv_data(self): interv_independencies ...
6,955
52.507692
155
py
correlate
correlate-master/causal_discovery/LPCMCI/utilities.py
from collections import OrderedDict from itertools import product import numpy as np import tigramite.data_processing as pp from causal_discovery.LPCMCI.svarfci import SVARFCI class OracleCI: r"""Oracle of conditional independence test X _|_ Y | Z given a graph. Class around link_coeff causal ground truth....
32,514
38.700855
117
py
correlate
correlate-master/causal_discovery/LPCMCI/generate_data_mod.py
from collections import defaultdict import numpy as np def check_stationarity(links): """Returns stationarity according to a unit root test Assuming a Gaussian Vector autoregressive process Three conditions are necessary for stationarity of the VAR(p) model: - Absence of mean shifts; - The nois...
15,012
30.606316
124
py
correlate
correlate-master/causal_discovery/LPCMCI/observational_discovery.py
from time import time import numpy as np from tigramite import data_processing as pp from tigramite.independence_tests import ParCorr from tigramite.pcmci import PCMCI from tigramite import plotting as tp import matplotlib.pyplot as plt from causal_discovery.LPCMCI.lpcmci import LPCMCI from config import causal_discov...
8,472
41.365
136
py
correlate
correlate-master/causal_discovery/LPCMCI/metrics_mod.py
import numpy as np def get_masks(true_graphs): n_realizations, N, N, taumaxplusone = true_graphs.shape tau_max = taumaxplusone - 1 cross_mask = np.repeat(np.identity(N).reshape(N, N, 1) == False, tau_max + 1, axis=2).astype('bool') cross_mask[range(N), range(N), 0] = False contemp_cross_mask_tril...
18,678
58.677316
149
py
correlate
correlate-master/causal_discovery/LPCMCI/simulate_discrete_scm.py
# import numpy as np # from numpy.random import binomial # from scipy.special import expit # from tigramite.data_processing import Graph # # def binomial_scp(links, T, n_binom, random_state = None, extremity = 4/5, scale = 1/2, # centralize = True, cut_off = True): # # if random_state is None: # random_...
5,084
35.321429
128
py
correlate
correlate-master/causal_discovery/LPCMCI/discG2.py
# import numpy as np # from scipy.stats import chi2 # from scipy.special import xlogy # from tigramite.independence_tests import CondIndTest # # class DiscG2(CondIndTest): # # @property # def measure(self): # """ # Concrete property to return the measure of the independence test # """ # ...
4,975
40.815126
97
py
correlate
correlate-master/causal_discovery/LPCMCI/svarfci.py
import numpy as np from itertools import product, combinations import os class SVARFCI(): r""" This class implements the SVAR-FCI algorithm introduced in: Malinsky, D. and Spirtes, P. (2018). Causal Structure Learning from Multivariate Time Series in Settings with Unmeasured Confounding. In Le, T. D.,...
98,763
45.985728
672
py
correlate
correlate-master/causal_discovery/LPCMCI/lpcmci.py
from itertools import product, combinations import numpy as np class LPCMCI(): r""" This class implements the LPCMCI algorithm for constraint-based causal discovery on stationary times series with latent confounders and without selection variables, which we introduce in the main text of this submission. ...
162,086
47.601799
552
py
correlate
correlate-master/1_data_extraction/weather.py
import os from datetime import datetime import pandas as pd from helper import histograms """ go through csv files create aggregation df for each file select which aggregation is needed: max, min, mean, sum append to data frame write dataframe """ path_to_csv_files = '/home/chrei/code/quantifiedSelfData/2022/' outpu...
3,373
36.488889
119
py
correlate
correlate-master/1_data_extraction/netatmo.py
from datetime import datetime from math import isnan from tqdm import tqdm from config import private_folder_path from helper import histograms import numpy as np import pandas as pd """ 1. export: https://my.netatmo.com/app/station -> settings -> data management -> download -> format csv -> download 3 months junks...
6,756
37.392045
109
py
correlate
correlate-master/1_data_extraction/mfp.py
from datetime import datetime import numpy as np import pandas as pd from config import private_folder_path output_name = str(private_folder_path)+'mfp_daily_summaries.csv' df = pd.read_csv('/home/chrei/PycharmProjects/correlate/0_data_raw/MFP/meals.csv') # , index_col=0 currentDay = datetime.strptime(df.columns[0]...
1,912
29.854839
104
py
correlate
correlate-master/1_data_extraction/gFit_to_dailyAggrgations.py
import os import pandas as pd from tqdm import tqdm from helper import histograms """ go through csv files create aggregation df for each file select which aggregation is needed: max, min, mean, sum append to data frame write dataframe """ path_to_csv_files = '/home/chrei/code/quantifiedSelfData/2022/takeout-2022050...
14,365
48.367698
127
py
correlate
correlate-master/1_data_extraction/exist_to_csv_2021_06_15.py
import pandas as pd import os """ correlate load data form json, into df, correlation matrix, visualize """ path_to_json_files = '/home/chrei/code/quantifiedSelfData/2022/ChrisG_a7bdb31dddb7586bea95f752ca7883740c77ae2dde615633ca99b40c74ef9192' verbose = False excludedFiles = ['averages.json', 'correlations.json', 'w...
2,188
31.191176
135
py
correlate
correlate-master/1_data_extraction/google_meditation.py
import os from datetime import datetime, timedelta import json import dateutil import pandas as pd from math import floor path_to_json_files = '/home/chrei/PycharmProjects/correlate/0_data_raw/google/takeout-20210625T075514Z-001/Takeout/Fit/All Sessions' output_filename = 'google_meditation.csv' verbose = True exclu...
2,527
31.831169
132
py
correlate
correlate-master/1_data_extraction/fitbit_vo2max_json_to_csv.py
import os from datetime import datetime, timedelta import pandas as pd path_to_json_files = '/home/chrei/code/quantifiedSelfData/walter_fitbit/2022/MyFitbitData/Walter/Physical Activity' output_filename = 'walter_fitbit_vo2max.csv' verbose = True excludedFiles = [''] if verbose: print('start running...') def ...
2,687
35.324324
115
py
correlate
correlate-master/1_data_extraction/fitbit_sleep_json_to_csv.py
import math import os from datetime import datetime, timedelta import pandas as pd """ MyFitbitData/ChrisRe/Sleep/sleep_score.csv reverse sorting: add column with numbers to sort -> add order numbers -> select all cells -> data -> sort... -> select column to sort check for missing dates or zeros responsiveness point...
5,576
34.75
133
py
correlate
correlate-master/1_data_extraction/moonIlluminationByDate.py
import datetime import pylunar """ This script is used to extract the moon illumination data for all dates between "base" and "today". data is printed and can be copy pasted in to csv. uncomment printing date-list temporarily and check at https://www.timeanddate.com/moon/phases/germany/stuttgart if correct """ mi = py...
710
27.44
122
py
correlate
correlate-master/prediction/fully_connected.py
import math import numpy as np import torch import torch.utils.data as data_utils from sklearn.preprocessing import MinMaxScaler from torch import nn from torch.utils.tensorboard import SummaryWriter from config import target_label, fully_connected_nn_prediction_on writer = SummaryWriter() epochs = 4115 lr = 0.0001...
4,817
32.227586
108
py
correlate
correlate-master/prediction/linear_regression.py
import numpy as np import pandas as pd from sklearn.linear_model import ElasticNet from sklearn.model_selection import TimeSeriesSplit from config import target_label, ensemble_weights, multiple_linear_regression_ensemble_on, \ regularization_strengths, l1_ratios, private_folder_path from helper import histograms,...
8,120
57.007143
111
py
ClariQ
ClariQ-master/src/clariq_eval_tool.py
import pandas as pd import argparse import pickle from os import path import json from statistics import mean from sklearn.metrics import precision_score from sklearn.metrics import recall_score from sklearn.metrics import f1_score def evaluate_clarification_need(experiment_type, data_dir, run_file, out_file, leaderb...
13,590
48.421818
124
py
DeepOnto
DeepOnto-main/src/deeponto/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
1,805
38.26087
96
py
DeepOnto
DeepOnto-main/src/deeponto/probe/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
589
44.384615
74
py
DeepOnto
DeepOnto-main/src/deeponto/probe/ontolama/inference.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
9,867
34.624549
114
py
DeepOnto
DeepOnto-main/src/deeponto/probe/ontolama/data_processor.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
4,208
39.864078
111
py
DeepOnto
DeepOnto-main/src/deeponto/probe/ontolama/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
627
40.866667
74
py
DeepOnto
DeepOnto-main/src/deeponto/probe/ontolama/subsumption_sampler.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
13,498
47.383513
150
py
DeepOnto
DeepOnto-main/src/deeponto/subs/__init__.py
# Copyright 2021 Yuan He (KRR-Oxford). All rights reserved. # 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 applicable l...
602
45.384615
74
py
DeepOnto
DeepOnto-main/src/deeponto/subs/bertsubs/pipeline_inter.py
# Copyright 2023 Jiaoyan Chen. All rights reserved. # 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 applicable law or ag...
16,303
50.432177
152
py
DeepOnto
DeepOnto-main/src/deeponto/subs/bertsubs/pipeline_intra.py
# Copyright 2023 Jiaoyan Chen. All rights reserved. # 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 applicable law or ag...
17,435
44.76378
120
py
DeepOnto
DeepOnto-main/src/deeponto/subs/bertsubs/__init__.py
# Copyright 2023 Jiaoyan Chen. All rights reserved. # 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 applicable law or ag...
796
45.882353
76
py
DeepOnto
DeepOnto-main/src/deeponto/subs/bertsubs/text_semantics.py
# Copyright 2023 Jiaoyan Chen. All rights reserved. # 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 applicable law or ag...
25,122
43.702847
146
py
DeepOnto
DeepOnto-main/src/deeponto/subs/bertsubs/bert_classifier.py
# Copyright 2023 Jiaoyan Chen. All rights reserved. # 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 applicable law or ag...
5,560
38.721429
116
py
DeepOnto
DeepOnto-main/src/deeponto/onto/ontology.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
41,129
46.384793
211
py
DeepOnto
DeepOnto-main/src/deeponto/onto/normalisation.py
# The original code is licensed under the following: # BSD 3-Clause License # Copyright (c) 2022, Bio-Ontology Research Group # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions ...
7,223
40.28
149
py
DeepOnto
DeepOnto-main/src/deeponto/onto/verbalisation.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
28,640
46.262376
910
py
DeepOnto
DeepOnto-main/src/deeponto/onto/projection.py
# The original code is licensed under the following: # BSD 3-Clause License # Copyright (c) 2022, Bio-Ontology Research Group # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions ...
4,274
44
116
py
DeepOnto
DeepOnto-main/src/deeponto/onto/pruning.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
3,170
40.181818
188
py
DeepOnto
DeepOnto-main/src/deeponto/onto/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
831
42.789474
74
py
DeepOnto
DeepOnto-main/src/deeponto/utils/logging.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
2,609
34.27027
119
py
DeepOnto
DeepOnto-main/src/deeponto/utils/data_utils.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
1,215
37
88
py
DeepOnto
DeepOnto-main/src/deeponto/utils/text_utils.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
7,121
41.142012
138
py
DeepOnto
DeepOnto-main/src/deeponto/utils/file_utils.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
5,752
37.871622
128
py
DeepOnto
DeepOnto-main/src/deeponto/utils/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
719
39
74
py
DeepOnto
DeepOnto-main/src/deeponto/utils/decorators.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
2,271
32.411765
94
py
DeepOnto
DeepOnto-main/src/deeponto/align/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
590
41.214286
74
py
DeepOnto
DeepOnto-main/src/deeponto/align/evaluation.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
4,843
42.63964
116
py
DeepOnto
DeepOnto-main/src/deeponto/align/mapping.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
28,009
50.583794
182
py
DeepOnto
DeepOnto-main/src/deeponto/align/bertmap/mapping_prediction.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
15,548
49.980328
161
py
DeepOnto
DeepOnto-main/src/deeponto/align/bertmap/mapping_refinement.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
16,390
46.648256
146
py
DeepOnto
DeepOnto-main/src/deeponto/align/bertmap/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
797
38.9
74
py
DeepOnto
DeepOnto-main/src/deeponto/align/bertmap/text_semantics.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
28,876
48.702238
168
py
DeepOnto
DeepOnto-main/src/deeponto/align/bertmap/pipeline.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
16,546
48.247024
161
py
DeepOnto
DeepOnto-main/src/deeponto/align/bertmap/bert_classifier.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
10,098
44.084821
150
py
DeepOnto
DeepOnto-main/src/deeponto/align/bertsubs/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
646
45.214286
74
py
DeepOnto
DeepOnto-main/src/deeponto/align/logmap/__init__.py
# Copyright 2021 Yuan He. All rights reserved. # 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 applicable law or agreed ...
1,527
36.268293
84
py
DeepOnto
DeepOnto-main/src/deeponto/align/logmap/java-dependencies/__init__.py
# Copyright 2021 Yuan He (KRR-Oxford). All rights reserved. # 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 applicable l...
602
45.384615
74
py
DeepOnto
DeepOnto-main/scripts/bertmap.py
# Copyright 2021 Yuan He (KRR-Oxford). All rights reserved. # 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 applicable l...
1,675
36.244444
82
py
DeepOnto
DeepOnto-main/scripts/bertsubs_intra_evaluate.py
# Copyright 2023 Jiaoyan Chen. All rights reserved. # 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 applicable law or ag...
8,070
49.761006
124
py
DeepOnto
DeepOnto-main/scripts/bertsubs_simple_test.py
# Copyright 2023 Jiaoyan Chen. All rights reserved. # 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 applicable law or ag...
2,647
43.133333
133
py
ACE
ACE-main/example.py
import torch import torch.nn.functional as F import timm from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from ace import attack_confidence_estimation def attack_example(file_name, true_label, transform, normalization): image = Image.open(f'....
1,864
57.28125
149
py
ACE
ACE-main/ace.py
import torch def softmax_response(logits): return torch.nn.functional.softmax(logits, dim=1) def attack_confidence_estimation(model, input, label, normalization, proxy=None, epsilon=0.005, epsilon_decay=0.5, max_iterations=15, confidence_score_function=softmax_response, device='cuda'): input = input.to(devic...
2,151
42.04
193
py
Fengshenbang-LM
Fengshenbang-LM-main/setup.py
from setuptools import setup, find_packages setup( name="fengshen", version="0.0.1", description="fengshen", long_description="fengshen", license="MIT Licence", url="https://idea.edu.cn", author="gaoxinyu", author_email="[email protected]", packages=find_packages(), include_...
733
21.9375
69
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/__init__.py
# coding=utf-8 # Copyright 2021 The IDEA Authors. All rights reserved. # 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 a...
849
41.5
74
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/cli/fengshen_pipeline.py
import sys from importlib import import_module from datasets import load_dataset import argparse def main(): if len(sys.argv) < 3: raise Exception( 'args len < 3, example: fengshen_pipeline text_classification predict xxxxx') pipeline_name = sys.argv[1] method = sys.argv[2] pipelin...
1,161
32.2
94
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/strategies/megatron_deepspeed.py
# Copyright The Lightning AI 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 applicable law or agreed to in wri...
18,750
45.8775
120
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/API/main.py
import uvicorn import click import argparse import json from importlib import import_module from fastapi import FastAPI, WebSocket from starlette.middleware.cors import CORSMiddleware from utils import user_config, api_logger, setup_logger, RequestDataStructure # 命令行启动时只输入一个参数,即配置文件的名字,eg: text_classification.json # 其...
2,051
25.649351
102
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/API/utils.py
from dataclasses import dataclass, field import os import json import logging from argparse import Namespace from typing import List, Literal, Optional, Union from pydantic import AnyHttpUrl, BaseSettings, HttpUrl, validator, BaseModel CURRENT_DIR_PATH = os.path.dirname(os.path.abspath(__file__)) # request body # 使用...
6,002
34.732143
139
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/pretrain_t5/process_data.py
# coding=utf8 import argparse import sys import os from concurrent.futures import ProcessPoolExecutor def _generate_cache_arrow(index, ds, path): print('saving dataset shard {}'.format(index)) ds.save_to_disk(os.path.join(path, 'part_{}'.format(index))) return 'saving dataset shard {} done'.format(index) ...
2,746
40.621212
117
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/pretrain_t5/pretrain_t5.py
import time from builtins import print import sys import os import torch import argparse import json import pytorch_lightning as pl from transformers import MT5Config, MT5Tokenizer from pytorch_lightning import Trainer, loggers from transformers import MT5ForConditionalGeneration from pytorch_lightning.callbacks import...
8,139
45.25
110
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/pretrain_t5/convert_ckpt_to_bin.py
import time from builtins import print import argparse import torch # os.environ["CUDA_VISIBLE_DEVICES"] = '3' def get_time_str(): return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) def main(): total_parser = argparse.ArgumentParser("Pretrain Unsupervise.") total_parser.add_argument('--ckpt_pa...
1,071
27.210526
68
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/pretrain_t5/finetune_t5.py
import time from builtins import print import sys import os import torch import argparse import pytorch_lightning as pl from pytorch_lightning import Trainer, loggers from transformers import MT5ForConditionalGeneration from pytorch_lightning.callbacks import LearningRateMonitor # os.environ["CUDA_VISIBLE_DEVICES"] = '...
6,184
41.655172
110
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/stable_diffusion_dreambooth/train.py
# -*- encoding: utf-8 -*- ''' Copyright 2022 The International Digital Economy Academy (IDEA). CCNL team. All rights reserved. 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.o...
11,678
41.162455
118
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/zen2_finetune/fengshen_token_level_ft_task.py
# coding=utf-8 # Copyright 2021 The IDEA Authors. All rights reserved. # 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 a...
28,463
40.920471
163
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/zen2_finetune/fengshen_sequence_level_ft_task.py
# coding=utf-8 # Copyright 2021 The IDEA Authors. All rights reserved. # 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 a...
27,189
40.830769
130
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/classification/finetune_classification.py
# coding=utf-8 # Copyright 2021 The IDEA Authors. All rights reserved. # 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 a...
15,787
39.482051
117
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/DAVAE/generate.py
# -*- encoding: utf-8 -*- ''' Copyright 2022 The International Digital Economy Academy (IDEA). CCNL team. All rights reserved. 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.o...
1,595
42.135135
157
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/disco_project/st_disco.py
# from disco_huge import Diffuser # from utils import * from disco import Diffuser import streamlit as st from io import BytesIO from PIL import Image from disco import steps @st.cache(show_spinner=False, allow_output_mutation=True) # 加装饰器, 只加载一次。 class ST_Diffuser(Diffuser): def __init__(self, custom_path): ...
2,215
37.877193
87
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/disco_project/disco.py
import os import sys # sys.path.insert(0, f'{PROJECT_DIR}/guided-diffusion') # 加在前面,不再读取库文件的东西。 import subprocess import io import torch.nn as nn from torch.nn import functional as F import torch import torchvision.transforms.functional as TF import torchvision.transforms as T import math import requests import cv2 f...
29,225
38.709239
150
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/disco_project/guided_diffusion/__init__.py
0
0
0
py
Fengshenbang-LM
Fengshenbang-LM-main/fengshen/examples/disco_project/guided_diffusion/guided_diffusion/resample.py
from abc import ABC, abstractmethod import numpy as np import torch as th import torch.distributed as dist def create_named_schedule_sampler(name, diffusion): """ Create a ScheduleSampler from a library of pre-defined samplers. :param name: the name of the sampler. :param diffusion: the diffusion ob...
5,689
35.709677
87
py