repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
Agent007/deepchem
examples/binding_pockets/binding_pocket_datasets.py
9
6311
""" PDBBind binding pocket dataset loader. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os import numpy as np import pandas as pd import shutil import time import re from rdkit import Chem import deepchem as dc def compute_binding_pocket_fea...
mit
Artimi/waktu
waktu/waktu-gui.py
1
21576
#!/usr/bin/env python2.7 #-*- coding: UTF-8 -*- from gi.repository import Gtk, Gdk, GLib, GObject from waktu import Waktu import category from timetracker import TimeTracker from matplotlib.figure import Figure from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas from datetime import t...
mit
commaai/panda
tests/automated/helpers.py
1
6630
import os import time import random import _thread import faulthandler from functools import wraps from panda import Panda from panda_jungle import PandaJungle # pylint: disable=import-error from nose.tools import assert_equal from parameterized import parameterized, param from .timeout import run_with_timeout SPEED_...
mit
LiaoPan/scikit-learn
examples/applications/plot_species_distribution_modeling.py
254
7434
""" ============================= Species distribution modeling ============================= Modeling species' geographic distributions is an important problem in conservation biology. In this example we model the geographic distribution of two south american mammals given past observations and 14 environmental varia...
bsd-3-clause
justinfinkle/pydiffexp
data/motif_library/gnw_generate_data.py
1
9339
import functools import multiprocessing as mp import operator import os import subprocess import time import itertools as it import networkx as nx import pandas as pd import numpy as np from pydiffexp.gnw.simulation import GnwNetwork, mk_ch_dir def count_combos(dg): combos = {0: 1, 1: 2, 2: 8} n_in = [combos...
gpl-3.0
phobson/statsmodels
examples/python/contrasts.py
33
8722
## Contrasts Overview from __future__ import print_function import numpy as np import statsmodels.api as sm # This document is based heavily on this excellent resource from UCLA http://www.ats.ucla.edu/stat/r/library/contrast_coding.htm # A categorical variable of K categories, or levels, usually enters a regressio...
bsd-3-clause
arjunkhode/ASP
lectures/03-Fourier-properties/plots-code/convolution-2.py
24
1259
import matplotlib.pyplot as plt import numpy as np from scipy.fftpack import fft, fftshift plt.figure(1, figsize=(9.5, 7)) M = 64 N = 64 x1 = np.hanning(M) x2 = np.cos(2*np.pi*2/M*np.arange(M)) y1 = x1*x2 mY1 = 20 * np.log10(np.abs(fftshift(fft(y1, N)))) plt.subplot(3,2,1) plt.title('x1 (hanning)') plt.plot(np.arange...
agpl-3.0
aravart/poolmate
poolmate/test/dummy.py
2
1137
import sys import numpy as np from sklearn.datasets import make_classification from sklearn.metrics import zero_one_loss from sklearn.neighbors import KNeighborsClassifier def inline(inputfile, outputfile): # data = np.loadtxt(sys.stdin) data = np.loadtxt(inputfile, delimiter=',') if np.ndim(data) == 1: ...
mit
LiaoPan/scikit-learn
examples/cluster/plot_segmentation_toy.py
258
3336
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
sugartom/tensorflow-alien
tensorflow/python/estimator/inputs/queues/feeding_queue_runner_test.py
116
5164
# Copyright 2017 The TensorFlow 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 applica...
apache-2.0
Myasuka/scikit-learn
examples/linear_model/plot_ols_3d.py
350
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
avistous/QSTK
quicksim/strategies/MonthlyRebalancing.py
4
2190
''' (c) 2011, 2012 Georgia Tech Research Corporation This source code is released under the New BSD license. Please see http://wiki.quantsoftware.org/index.php?title=QSTK_License for license details. Created on Jan 1, 2011 @author:Drew Bratcher @contact: dbratcher@gatech.edu @summary: Contains tutorial for...
bsd-3-clause
Lawrence-Liu/scikit-learn
examples/linear_model/plot_sgd_separating_hyperplane.py
260
1219
""" ========================================= SGD: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a linear Support Vector Machines classifier trained using SGD. """ print(__doc__) import numpy as n...
bsd-3-clause
matbra/bokeh
bokeh/crossfilter/models.py
40
30635
from __future__ import absolute_import import logging import six import pandas as pd import numpy as np from ..plotting import curdoc from ..models import ColumnDataSource, GridPlot, Panel, Tabs, Range from ..models.widgets import Select, MultiSelect, InputWidget # crossfilter plotting utilities from .plotting impo...
bsd-3-clause
josenavas/QiiTa
qiita_pet/handlers/study_handlers/tests/test_sample_template.py
1
31592
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
bsd-3-clause
mtrbean/scipy
scipy/stats/_multivariate.py
35
69253
# # Author: Joris Vankerschaver 2013 # from __future__ import division, print_function, absolute_import import numpy as np import scipy.linalg from scipy.misc import doccer from scipy.special import gammaln, psi, multigammaln from scipy._lib._util import check_random_state __all__ = ['multivariate_normal', 'dirichle...
bsd-3-clause
samzhang111/scikit-learn
sklearn/cluster/tests/test_dbscan.py
176
12155
""" Tests for DBSCAN clustering algorithm """ import pickle import numpy as np from scipy.spatial import distance from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing im...
bsd-3-clause
HolgerPeters/scikit-learn
sklearn/metrics/scorer.py
33
17925
""" The :mod:`sklearn.metrics.scorer` submodule implements a flexible interface for model selection and evaluation using arbitrary score functions. A scorer object is a callable that can be passed to :class:`sklearn.model_selection.GridSearchCV` or :func:`sklearn.model_selection.cross_val_score` as the ``scoring`` par...
bsd-3-clause
great-expectations/great_expectations
tests/rule_based_profiler/test_profiler.py
1
11083
import datetime import os from typing import List, Optional import pandas as pd import pytest from ruamel.yaml import YAML from great_expectations import DataContext from great_expectations.core import ExpectationSuite from great_expectations.core.batch import BatchRequest from great_expectations.rule_based_profiler....
apache-2.0
dkushner/zipline
tests/risk/answer_key.py
39
11989
# # Copyright 2014 Quantopian, Inc. # # 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 wr...
apache-2.0
vermouthmjl/scikit-learn
examples/neighbors/plot_regression.py
349
1402
""" ============================ Nearest Neighbors regression ============================ Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpolation of the target using both barycenter and constant weights. """ print(__doc__) # Author: Alexandre Gramfort <alexandre.gramfort@...
bsd-3-clause
xclxxl414/rqalpha
rqalpha/utils/arg_checker.py
1
17616
# -*- coding: utf-8 -*- # # Copyright 2017 Ricequant, Inc # # 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 ...
apache-2.0
ameyavilankar/social-network-recommendation
matrix-factorization/calc.py
1
2773
import numpy as np import random from sklearn.cross_validation import train_test_split import numpy as np from sklearn.metrics import roc_auc_score # IN_FILE = "facebook.1_of_1" IN_FILE = "facebook.1_of_1" USER_FILE = "facebook.U.1_of_1" ITEM_FILE = "facebook.V.1_of_1" TRAIN_FILE = "train.txt" # Read the data from th...
bsd-2-clause
pratapvardhan/pandas
pandas/core/series.py
1
135882
""" Data structure for 1-dimensional cross-sectional and time series data """ from __future__ import division # pylint: disable=E1101,E1103 # pylint: disable=W0703,W0622,W0613,W0201 import types import warnings from textwrap import dedent import numpy as np import numpy.ma as ma from pandas.core.accessor import Cac...
bsd-3-clause
mattcaldwell/zipline
zipline/data/loader.py
2
12089
# # Copyright 2013 Quantopian, Inc. # # 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 wr...
apache-2.0
awanke/bokeh
bokeh/tests/test_sources.py
26
3245
from __future__ import absolute_import import unittest from unittest import skipIf import warnings try: import pandas as pd is_pandas = True except ImportError as e: is_pandas = False from bokeh.models.sources import DataSource, ColumnDataSource, ServerDataSource class TestColumnDataSourcs(unittest.Test...
bsd-3-clause
pablooliveira/cere
src/cere/cere_selectinv.py
2
6526
#!/usr/bin/env python # This file is part of CERE. # # Copyright (c) 2013-2016, Universite de Versailles St-Quentin-en-Yvelines # # CERE is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 ...
lgpl-3.0
Git3251/trading-with-python
lib/cboe.py
76
4433
# -*- coding: utf-8 -*- """ toolset working with cboe data @author: Jev Kuznetsov Licence: BSD """ from datetime import datetime, date import urllib2 from pandas import DataFrame, Index from pandas.core import datetools import numpy as np import pandas as pd def monthCode(month): """ perfo...
bsd-3-clause
travisfcollins/gnuradio
gr-digital/examples/example_costas.py
49
5316
#!/usr/bin/env python # # Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your optio...
gpl-3.0
CVML/scikit-learn
sklearn/decomposition/truncated_svd.py
199
7744
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck <L.J.Buitinck@uva.nl> # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sp...
bsd-3-clause
rvraghav93/scikit-learn
sklearn/__check_build/__init__.py
345
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
sarathid/Learning
Intro_to_ML/final_project/poi_id.py
9
2364
#!/usr/bin/python import sys import pickle sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit from tester import dump_classifier_and_data ### Task 1: Select what features you'll use. ### features_list is a list of strings, each of which is a feature name. ### The first feature ...
gpl-3.0
xyguo/scikit-learn
sklearn/manifold/tests/test_t_sne.py
26
21787
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.neighbors import BallTree from sklearn.utils.testing import assert_less_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from skle...
bsd-3-clause
madjelan/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
57
16523
from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.cross_validation import train_test_split from sklearn.externals import joblib from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_...
bsd-3-clause
RapidApplicationDevelopment/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/tensorflow_dataframe.py
75
29377
# Copyright 2016 The TensorFlow 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 applica...
apache-2.0
boegel/easybuild-easyconfigs
test/easyconfigs/easyconfigs.py
1
65364
## # Copyright 2013-2021 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), # Flemish Research Foundation (F...
gpl-2.0
paultcochrane/bokeh
bokeh/compat/mplexporter/exporter.py
32
12403
""" Matplotlib Exporter =================== This submodule contains tools for crawling a matplotlib figure and exporting relevant pieces to a renderer. """ import warnings import io from . import utils import matplotlib from matplotlib import transforms from matplotlib.backends.backend_agg import FigureCanvasAgg clas...
bsd-3-clause
sdrendall/mea_analysis
pymea/filter_supplement.py
2
4308
import pandas as pd import itertools as it import seaborn as sns import numpy as np from pymea import matlab_compatibility as mc from matplotlib import pyplot as plt from matplotlib import mlab as mlab import random from datetime import datetime, timedelta def filter_neurons_homeostasis(cat_table, baseline_table, stim...
mit
f3r/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
junbochen/pylearn2
pylearn2/scripts/datasets/browse_norb.py
44
15741
#!/usr/bin/env python """ A browser for the NORB and small NORB datasets. Navigate the images by choosing the values for the label vector. Note that for the 'big' NORB dataset, you can only set the first 5 label dimensions. You can then cycle through the 3-12 images that fit those labels. """ import sys import os imp...
bsd-3-clause
asurve/systemml
src/main/python/tests/test_mllearn_numpy.py
12
8831
#!/usr/bin/python #------------------------------------------------------------- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this f...
apache-2.0
NelisVerhoef/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
hsuantien/scikit-learn
sklearn/datasets/tests/test_samples_generator.py
67
14842
from __future__ import division from collections import defaultdict from functools import partial import numpy as np from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal fr...
bsd-3-clause
gsmcmullin/libswiftnav
python/docs/extensions/ipython_directive.py
31
27191
# -*- coding: utf-8 -*- """Sphinx directive to support embedded IPython code. This directive allows pasting of entire interactive IPython sessions, prompts and all, and their code will actually get re-executed at doc build time, with all prompts renumbered sequentially. It also allows you to input code as a pure pytho...
lgpl-3.0
ewulczyn/ewulczyn.github.io
ipython/How_Naive_AB_Testing_Goes_Wrong/abtest_util.py
1
3278
import matplotlib.pyplot as plt import numpy as np from numpy.random import multinomial from numpy.random import beta as beta_dist from pprint import pprint import pandas as pd from statsmodels.stats.power import tt_ind_solve_power class SimStream(object): """ Encapsulates a simulated stream of banner d...
mit
jardians/sp17-i524
project/S17-IR-P012/code/binarize.py
21
1096
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Apr 4 15:56:31 2017 I524 Project: OCR Preprocessing Binarization @author: saber """ import numpy as np import cv2 import matplotlib.pyplot as plt image_path = 'sample1.png' image_arr = cv2.imread(image_path, 0) plt.figure(1) plt.subplot(311) # Plot hi...
apache-2.0
PortfolioEffect/PortfolioEffectHFT-Python
hft/portfolio.py
2
38495
""" This module provides a container class for storing portfolio parameters. """ from position import * import matplotlib.pyplot as plt import sys import numpy as np # # Portfolio Methods # class Portfolio: """Container class for storing portfolio parameters.""" def __init__(self, fromTime=None, toTime=N...
gpl-3.0
lab3000/deeplearngene
src/clade.py
1
3650
import numpy as np import os import pandas as pd import random class Clade: """Class for loading data and defining, compiling, and fitting a a population of keras models for genetic algorithm-driven optimization of high-performing model architectures""" def __init__(self, config, current_generation=0...
gpl-3.0
ledo01/Bulle-simulation
animation.py
1
1358
import numpy as np # Manipulation des arraysm import matplotlib matplotlib.use("Agg") from matplotlib.pyplot import * # Graphiques import matplotlib.animation as manimation FFMpegWriter = manimation.writers['ffmpeg'] metadata = dict(title='Movie Test', artist='Matplotlib',comment='Movie support!') writer = FFMpegWrite...
mit
Mega-DatA-Lab/mxnet
example/reinforcement-learning/ddpg/strategies.py
42
2473
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
yorkerlin/shogun
examples/undocumented/python_modular/graphical/classifier_perceptron_graphical.py
26
2311
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt import latex_plot_inits parameter_list = [[20, 5, 1., 1000, 1, None, 5], [100, 5, 1., 1000, 1, None, 10]] def classifier_perceptron_graphical(n=100, distance=5, learn_rate=1., max_iter=1000, num_threads=1, seed=None, nperceptrons=5): from mods...
gpl-3.0
claraya/SMRx
mapColor.py
1
21901
#!/usr/bin/env python # This is a PyMol script that colors atoms/residues in a PDB structure using an input file and a target column. # Note: Input must contain a target values column, position numbers, and a position adjustment factor if necessary. # Usage: First, load the script within PyMol as follows: # # ...
mit
tcheehow/MissionPlanner
Lib/site-packages/numpy/fft/fftpack.py
59
39653
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1) ifft(a, n=None, axis=-1) rfft(a, n=None, axis=-1) irfft(a, n=None, axis=-1) hfft(a, n=None, axis=-1) ihfft(a, n=None, axis=-1) fftn(a, s=None, axes=None) ifftn(a, s=None, axes=None) rfftn(a, s=None, axes=None) irfftn(a, s=None, axes=None...
gpl-3.0
mattgiguere/scikit-learn
sklearn/utils/tests/test_shortest_path.py
42
2894
from collections import defaultdict import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.utils.graph import (graph_shortest_path, single_source_shortest_path_length) def floyd_warshall_slow(graph, directed=False): N = graph.shape[0] #set nonzer...
bsd-3-clause
ltiao/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
jingwangian/tutorial
python/pandas_tutorial/test1.py
1
1059
#!/usr/bin/env python3 import numpy as np import pandas as pd import matplotlib.pyplot as plt import math import os import random import re import sys numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" # Complete the minimu...
gpl-3.0
songjs1993/DeepLearning
5Project/disease_classification/Disease_LeNet2.py
1
12541
# Auther: Alan """ """ import tensorflow as tf import random import os import scipy.io as sio # import matplotlib.pyplot as plt # plt import matplotlib.image as mpimg # mpimg import numpy as np # import Image import math from PIL import Image import xlrd class Disease: def __init__(self): print("init") ...
apache-2.0
ClimbsRocks/scikit-learn
sklearn/tests/test_multioutput.py
39
6609
import numpy as np import scipy.sparse as sp from sklearn.utils import shuffle from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regex from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing impor...
bsd-3-clause
davidwaroquiers/pymatgen
pymatgen/analysis/diffraction/tem.py
1
27148
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. # Credit to Dr. Shyue Ping Ong for the template of the calculator """ This module implements a TEM pattern calculator. """ import json import os from collections import namedtuple from fractions import Fractio...
mit
theoryno3/scikit-learn
benchmarks/bench_sparsify.py
323
3372
""" Benchmark SGD prediction time with dense/sparse coefficients. Invoke with ----------- $ kernprof.py -l sparsity_benchmark.py $ python -m line_profiler sparsity_benchmark.py.lprof Typical output -------------- input data sparsity: 0.050000 true coef sparsity: 0.000100 test data sparsity: 0.027400 model sparsity:...
bsd-3-clause
guziy/basemap
examples/polarmaps.py
2
2869
from __future__ import (absolute_import, division, print_function) # make plots of etopo bathymetry/topography data on # various map projections, drawing coastlines, state and # country boundaries, filling continents and drawing # parallels/meridians # illustrates special-case polar-centric projections. from mpl_too...
gpl-2.0
farthir/msc-project
snippets/average_net_output_sam.py
1
2689
import sys import math import pandas as pd import matplotlib.pyplot as plt from matplotlib import rcParams def main(): input_filename = sys.argv[1] num_networks = int(sys.argv[2]) df = pd.read_csv('results/%s.csv' % input_filename).round(10) new_df = pd.DataFrame(dtype=float) duplicate = df.dupl...
mit
wolfram74/numerical_methods_iserles_notes
venv/lib/python2.7/site-packages/numpy/lib/recfunctions.py
41
35014
""" Collection of utilities to manipulate structured arrays. Most of these functions were initially implemented by John Hunter for matplotlib. They have been rewritten and extended for convenience. """ from __future__ import division, absolute_import, print_function import sys import itertools import numpy as np im...
mit
maggieli96/35-Final-Project
Machine Learning/training_tuning.py
1
4837
import numpy as np from sklearn import cross_validation from sklearn import tree from sklearn.neighbors import KNeighborsClassifier from data_processing_ml import * def ten_fold_CV(classifier, x_train, y_train): """ This function takes three arguments: 1) classifier, an just initialized classifier we ...
mit
gverdian/cuda-convnet2
convdata.py
174
14675
# Copyright 2014 Google Inc. 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...
apache-2.0
bsipocz/statsmodels
statsmodels/tools/print_version.py
23
7951
#!/usr/bin/env python from __future__ import print_function from statsmodels.compat.python import reduce import sys from os.path import dirname def safe_version(module, attr='__version__'): if not isinstance(attr, list): attr = [attr] try: return reduce(getattr, [module] + attr) except Att...
bsd-3-clause
ingokegel/intellij-community
python/helpers/pydev/_pydevd_bundle/pydevd_utils.py
6
21002
from __future__ import nested_scopes import os import traceback import warnings import pydevd_file_utils try: from urllib import quote except: from urllib.parse import quote # @UnresolvedImport try: from collections import OrderedDict except: OrderedDict = dict import inspect from _pydevd_bundle.p...
apache-2.0
cbclab/MDT
mdt/visualization/maps/base.py
1
70091
import warnings from copy import copy, deepcopy import numbers import matplotlib.font_manager import nibabel import numpy as np import yaml import mdt import mdt.visualization.layouts from mdt.lib.nifti import load_nifti, NiftiInfoDecorated from mdt.visualization.dict_conversion import StringConversion, \ SimpleCl...
lgpl-3.0
glouppe/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
103
22297
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
HrWangChengdu/CS231n
assignment3_tianjun/exp_gradient.py
1
5907
# As usual, a bit of setup import time, os, json import numpy as np import skimage.io import matplotlib.pyplot as plt from cs231n.classifiers.pretrained_cnn import PretrainedCNN from cs231n.data_utils import load_tiny_imagenet from cs231n.image_utils import blur_image, deprocess_image #%matplotlib inline plt.rcParam...
mit
hmtai6/universe_NeonRace-v0
src/test_env.py
1
1949
import argparse import logging import sys import cv2 import matplotlib.pyplot as plt import gym import universe # register the universe environments from universe import wrappers import numpy as np import tensorflow as tf import gym, time, random, threading from keras.models import * from keras.layers import * fr...
mit
FAB4D/humanitas
analysis/preproc/merge_series.py
1
6091
import pandas as pd import numpy as np import matplotlib.pyplot as plt import os description = ''' This script merges series of the same product within each region. Also for plotting. Author: Ching-Chia ''' wholesale_daily = True retail_daily = False retail_weekly = False output_by_city = F...
bsd-3-clause
iismd17/scikit-learn
sklearn/linear_model/ridge.py
60
44642
""" Ridge regression """ # Author: Mathieu Blondel <mathieu@mblondel.org> # Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com> # Fabian Pedregosa <fabian@fseoane.net> # Michael Eickenberg <michael.eickenberg@nsup.org> # License: BSD 3 clause from abc import ABCMeta, abstractmethod impor...
bsd-3-clause
shahankhatch/scikit-learn
sklearn/semi_supervised/tests/test_label_propagation.py
307
1974
""" test the label propagation module """ import nose import numpy as np from sklearn.semi_supervised import label_propagation from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal ESTIMATORS = [ (label_propagation.LabelPropagation, {'kernel': 'rbf'}), (label_propa...
bsd-3-clause
r-mart/scikit-learn
sklearn/cluster/tests/test_k_means.py
63
26190
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
alvarofierroclavero/scikit-learn
examples/linear_model/plot_logistic_l1_l2_sparsity.py
384
2601
""" ============================================== L1 Penalty and Sparsity in Logistic Regression ============================================== Comparison of the sparsity (percentage of zero coefficients) of solutions when L1 and L2 penalty are used for different values of C. We can see that large values of C give mo...
bsd-3-clause
crisbarros/trading-with-python
lib/backtest.py
74
7381
#------------------------------------------------------------------------------- # Name: backtest # Purpose: perform routine backtesting tasks. # This module should be useable as a stand-alone library outide of the TWP package. # # Author: Jev Kuznetsov # # Created: 03/07/2014 ...
bsd-3-clause
alexeyum/scikit-learn
sklearn/linear_model/tests/test_omp.py
76
7752
# Author: Vlad Niculae # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equa...
bsd-3-clause
devanshdalal/scikit-learn
examples/linear_model/plot_robust_fit.py
147
3050
""" Robust linear estimator fitting =============================== Here a sine function is fit with a polynomial of order 3, for values close to zero. Robust fitting is demoed in different situations: - No measurement errors, only modelling errors (fitting a sine with a polynomial) - Measurement errors in X - M...
bsd-3-clause
tosolveit/scikit-learn
sklearn/metrics/pairwise.py
49
44088
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Robert Layton <robertlayton@gmail.com> # Andreas Mueller <amueller@ais.uni-bonn.de> # Philippe Gervais <philippe.gervais@inria.fr> # Lars Buitinck ...
bsd-3-clause
dssg/wikienergy
disaggregator/build/pandas/pandas/tests/test_expressions.py
4
16414
# -*- coding: utf-8 -*- from __future__ import print_function # pylint: disable-msg=W0612,E1101 import nose import re from numpy.random import randn import operator import numpy as np from numpy.testing import assert_array_equal from pandas.core.api import DataFrame, Panel from pandas.computation import expressions...
mit
neilswainston/development-py
synbiochemdev/ms/test/analyse.py
1
1333
''' synbiochem (c) University of Manchester 2017 All rights reserved. @author: neilswainston ''' # pylint: disable=invalid-name import re import sys import pandas as pd def analyse(df): '''analyse.''' result_df = df.groupby(['plasmid', 'strain', 'trea...
mit
keras-team/keras-tuner
setup.py
1
2018
# Copyright 2019 The Keras Tuner Authors # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
apache-2.0
trankmichael/scikit-learn
sklearn/utils/setup.py
296
2884
import os from os.path import join from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('utils', parent_package, top_path) config.add_subpackage('sparsetools') ...
bsd-3-clause
Averroes/statsmodels
statsmodels/sandbox/tests/test_predict_functional.py
29
12873
from statsmodels.sandbox.predict_functional import predict_functional import numpy as np import pandas as pd import statsmodels.api as sm from numpy.testing import dec # If true, the output is written to a multi-page pdf file. pdf_output = False try: import matplotlib.pyplot as plt import matplotlib have_...
bsd-3-clause
myuuuuun/various
ContinuousAlgorithm/HW3/HW3-1.py
2
4385
#-*- encoding: utf-8 -*- """ solve ordinary differential equations Copyright (c) 2016 @myuuuuun Released under the MIT license. """ import math import numpy as np import pandas as pd import functools import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.cm as cm EPSIRON = 1.0e-8 np.set_printoption...
mit
mne-tools/mne-python
mne/io/fiff/tests/test_raw_fiff.py
4
72663
# -*- coding: utf-8 -*- # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) from copy import deepcopy from functools import partial from io import BytesIO import os import os.path as op import pathlib import pickle import shutil imp...
bsd-3-clause
weixuanfu2016/tpot
tpot/config/classifier_sparse.py
3
3726
# -*- coding: utf-8 -*- """This file is part of the TPOT library. TPOT was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - Weixuan Fu (weixuanf@upenn.edu) - Daniel Angell (dpa34@drexel.edu) - and many more generous open source contributors TPOT is f...
lgpl-3.0
richardliaw/ray
rllib/contrib/bandits/examples/LinTS_train_wheel_env.py
2
1504
""" Example of using Linear Thompson Sampling on WheelBandit environment. For more information on WheelBandit, see https://arxiv.org/abs/1802.09127 . """ import numpy as np from matplotlib import pyplot as plt from ray.rllib.contrib.bandits.agents import LinTSTrainer from ray.rllib.contrib.bandits.envs import Whee...
apache-2.0
ajayhk/quant
algos/contest_ph_bup1_sup5_nofundamentals.py
1
13111
""" Trading Strategy using Fundamental Data 1. Take list of only pharma stocks 2. Finalize number of stocks to track and buy 3. Buy the stock if it is showing potential of rising. Buy if it is 1% more than last 5 minute's price 4. Sell the stock if it rises 5% above the cost price 5. Dont b...
apache-2.0
wvangeit/AllenSDK
allensdk/test/api/cache_tests.py
1
2559
import unittest from mock import MagicMock from allensdk.api.cache import Cache from allensdk.api.queries.rma_api import RmaApi import allensdk.core.json_utilities as ju import pandas as pd import pandas.io.json as pj class CacheTests(unittest.TestCase): def __init__(self, *args, **kwargs): super(CacheTes...
gpl-3.0
stefanhenneking/mxnet
example/ssd/dataset/pycocotools/coco.py
29
19564
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
szaiser/pandas-qt
pandasqt/models/SupportedDtypes.py
4
5656
import numpy as np from pandasqt.compat import QtCore class SupportedDtypesTranslator(QtCore.QObject): """Represents all supported datatypes and the translations (i18n). """ def __init__(self, parent=None): """Constructs the object with the given parent. Args: parent (QtCore.Q...
mit
aasensio/pyiacsun
pyiacsun/atlas/Delbouille73.py
1
1381
# cdiazbas@iac.es def Delbouille73(ini, endi, atlasdir=None): """ Extract spectral data from the original disk-center intensity atlas recorded at the Jungfraujoch Observatory: Delbouille, Neven, Roland (1973) Wavelength range: 3000 - 10.000 A Wavelength step (visible): 0.002 A ...
mit
Srisai85/scikit-learn
sklearn/metrics/scorer.py
211
13141
""" The :mod:`sklearn.metrics.scorer` submodule implements a flexible interface for model selection and evaluation using arbitrary score functions. A scorer object is a callable that can be passed to :class:`sklearn.grid_search.GridSearchCV` or :func:`sklearn.cross_validation.cross_val_score` as the ``scoring`` parame...
bsd-3-clause
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/numpy/lib/recfunctions.py
148
35012
""" Collection of utilities to manipulate structured arrays. Most of these functions were initially implemented by John Hunter for matplotlib. They have been rewritten and extended for convenience. """ from __future__ import division, absolute_import, print_function import sys import itertools import numpy as np im...
gpl-2.0
leesavide/pythonista-docs
Documentation/matplotlib/mpl_examples/pylab_examples/fill_betweenx_demo.py
12
1576
import matplotlib.mlab as mlab from matplotlib.pyplot import figure, show import numpy as np ## Copy of fill_between.py but using fill_betweenx() instead. x = np.arange(0.0, 2, 0.01) y1 = np.sin(2*np.pi*x) y2 = 1.2*np.sin(4*np.pi*x) fig = figure() ax1 = fig.add_subplot(311) ax2 = fig.add_subplot(312, sharex=ax1) ax3...
apache-2.0
calum-chamberlain/EQcorrscan
eqcorrscan/utils/plotting.py
1
89233
""" Utility code for most of the plots used as part of the EQcorrscan package. :copyright: EQcorrscan developers. :license: GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html) """ import numpy as np import logging import datetime as dt import copy import os import matp...
gpl-3.0
gph82/PyEMMA
pyemma/plots/markovtests.py
1
5109
# This file is part of PyEMMA. # # Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER) # # PyEMMA is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either vers...
lgpl-3.0
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/io/tests/parser/test_textreader.py
7
12917
# -*- coding: utf-8 -*- """ Tests the TextReader class in parsers.pyx, which is integral to the C engine in parsers.py """ from pandas.compat import StringIO, BytesIO, map from pandas import compat import os import sys import nose from numpy import nan import numpy as np from pandas import DataFrame from pandas.io...
apache-2.0