repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
Tong-Chen/scikit-learn
examples/linear_model/plot_sgd_comparison.py
8
1639
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import pylab as pl from sk...
bsd-3-clause
newville/scikit-image
doc/examples/plot_shapes.py
22
1913
""" ====== Shapes ====== This example shows how to draw several different shapes: - line - Bezier curve - polygon - circle - ellipse Anti-aliased drawing for: - line - circle """ import math import numpy as np import matplotlib.pyplot as plt from skimage.draw import (line, polygon, circle, ...
bsd-3-clause
JohnCEarls/DataDirac
datadirac/aggregator/resultset.py
1
13038
import boto.sqs import logging import time import boto import json import numpy as np import tempfile import hashlib from collections import defaultdict from boto.sqs.message import Message from boto.s3.key import Key import base64 import datetime from boto.dynamodb2.exceptions import ConditionalCheckFailedException im...
gpl-3.0
zooniverse/aggregation
experimental/condor/retireBlank.py
2
2893
#!/usr/bin/env python __author__ = 'greghines' import numpy as np import matplotlib.pyplot as plt import csv import sys import os import pymongo import matplotlib.cbook as cbook import cPickle as pickle sys.path.append("/home/greg/github/pyIBCC/python") import ibcc client = pymongo.MongoClient() db = client['condor...
apache-2.0
linebp/pandas
pandas/io/pytables.py
1
161539
""" High level interface to PyTables for reading and writing pandas data structures to disk """ # pylint: disable-msg=E1101,W0613,W0603 from datetime import datetime, date import time import re import copy import itertools import warnings import os from pandas.core.dtypes.common import ( is_list_like, is_cate...
bsd-3-clause
florianbeyer/Extract_Landsat_Data
ExtractLandsat.py
1
2172
''' #### Florian Beyers script to extract Landsat-Data vom *.tar.gz in a folder ### with Python 2.7 ## 2017-05-24 # mail@flobeyer.de Copyright 2015 Florian Beyer Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You ...
gpl-3.0
ryanjmccall/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/colors.py
69
31676
""" A module for converting numbers or color arguments to *RGB* or *RGBA* *RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the range 0-1. This module includes functions and classes for color specification conversions, and for mapping numbers to colors in a 1-D array of colors called a colormap. Color...
gpl-3.0
aabadie/scikit-learn
benchmarks/bench_plot_randomized_svd.py
57
17557
""" Benchmarks on the power iterations phase in randomized SVD. We test on various synthetic and real datasets the effect of increasing the number of power iterations in terms of quality of approximation and running time. A number greater than 0 should help with noisy matrices, which are characterized by a slow spectr...
bsd-3-clause
eclee25/flu-SDI-simulations-age
age_perc_vaxcov.py
1
8484
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 8/8/13 ###Function: ##### 1) odds ratio by vax coverage ###Import data: urban_edges_Sarah.csv, urban_ages_Sarah.csv ###Command Line: python age_perc_vaxcov.py ########################################...
mit
andaag/scikit-learn
sklearn/lda.py
72
17751
""" Linear Discriminant Analysis (LDA) """ # Authors: Clemens Brunner # Martin Billinger # Matthieu Perrot # Mathieu Blondel # License: BSD 3-Clause from __future__ import print_function import warnings import numpy as np from scipy import linalg from .externals.six import string_types f...
bsd-3-clause
rishikksh20/scikit-learn
examples/decomposition/plot_sparse_coding.py
60
4016
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
harshaneelhg/scikit-learn
examples/mixture/plot_gmm_selection.py
248
3223
""" ================================= Gaussian Mixture Model Selection ================================= This example shows that model selection can be performed with Gaussian Mixture Models using information-theoretic criteria (BIC). Model selection concerns both the covariance type and the number of components in th...
bsd-3-clause
chrsrds/scikit-learn
examples/cluster/plot_affinity_propagation.py
46
2307
""" ================================================= Demo of affinity propagation clustering algorithm ================================================= Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Points", Science Feb. 2007 """ print(__doc__) from sklearn.cluster impor...
bsd-3-clause
wasade/qiita
qiita_db/metadata_template.py
1
82170
r""" Metadata template objects (:mod: `qiita_db.metadata_template) ============================================================= ..currentmodule:: qiita_db.metadata_template This module provides the MetadataTemplate base class and the subclasses SampleTemplate and PrepTemplate. Classes ------- ..autosummary:: :...
bsd-3-clause
tudo-astroparticlephysics/starry_night
tests/test_skycam.py
1
2454
from starry_night import skycam from nose.tools import eq_ import numpy as np import pandas as pd def test_findLocalMaxPos(): img = np.zeros((480,640)) img[10,30] = 1 # find max value if we are on top of it pos = skycam.findLocalMaxPos(img, 30,10,1) eq_((pos.maxX,pos.maxY), (30,10), 'Right on Maxi...
mit
tapomayukh/projects_in_python
sandbox_tapo/src/skin_related/BMED_8813_HAP/Features/multiple_features/best_kNN_PC/cross_validate_categories_kNN_PC_BMED_8813_HAP_scaled_method_II_area_shape.py
1
4445
# Principal Component Analysis Code : from numpy import mean,cov,double,cumsum,dot,linalg,array,rank,size,flipud from pylab import * import numpy as np import matplotlib.pyplot as pp #from enthought.mayavi import mlab import scipy.ndimage as ni import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3') import ro...
mit
HarrisonKramer/optiland
wavefront.py
1
4234
# -*- coding: utf-8 -*- """ Created on Mon Jun 12 22:18:00 2017 @author: kramer """ from trace import trace import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D class wavefront(object): def __init__(self, lens, distribution, Hx=0, Hy=0, wave=0): self.lens = lens...
gpl-3.0
soulmachine/scikit-learn
examples/covariance/plot_lw_vs_oas.py
248
2903
""" ============================= Ledoit-Wolf vs OAS estimation ============================= The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and Wolf proposed a close formula to compute the asymptotically optimal shrinkage parameter (minimizing a MSE criterion), yielding th...
bsd-3-clause
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/numpy/lib/polynomial.py
32
37972
""" Functions to operate on polynomials. """ from __future__ import division, absolute_import, print_function __all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd', 'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d', 'polyfit', 'RankWarning'] import re import warnings import numpy.core....
gpl-3.0
tesera/pygypsy
tests/test_disagg.py
1
1260
#pylint: disable=missing-docstring, no-member import os import pandas as pd import numpy as np from pygypsy.disaggregate import ( sp_prop_total, disaggregate_simulation ) from conftest import DATA_DIR def test_sp_prop_total(): perc_sp = [ ('Aw', 50), ('Sw', 30), ('Pb', 20), ('', 0), ...
mit
bert9bert/statsmodels
statsmodels/tsa/descriptivestats.py
33
2304
# -*- coding: utf-8 -*- """Descriptive Statistics for Time Series Created on Sat Oct 30 14:24:08 2010 Author: josef-pktd License: BSD(3clause) """ import numpy as np from . import stattools as stt #todo: check subclassing for descriptive stats classes class TsaDescriptive(object): '''collection of descriptive ...
bsd-3-clause
ycaihua/scikit-learn
sklearn/tests/test_cross_validation.py
1
45051
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy import stats from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn...
bsd-3-clause
sinmaniphel/py_isear_dataset
main.py
1
1317
#!/usr/bin/env python import sys import os from py_isear.isear_loader import IsearLoader import itertools from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.pipeline import Pipeline from sklearn.linear_model import SGDClassifier import...
gpl-3.0
bsipocz/statsmodels
statsmodels/examples/l1_demo/short_demo.py
33
3737
""" You can fit your LikelihoodModel using l1 regularization by changing the method argument and adding an argument alpha. See code for details. The Story --------- The maximum likelihood (ML) solution works well when the number of data points is large and the noise is small. When the ML solution starts "bre...
bsd-3-clause
almarklein/bokeh
sphinx/source/tutorial/solutions/boxplot.py
1
3003
import numpy as np import pandas as pd from bokeh.plotting import figure, output_file, show # Generate some synthetic time series for six different categories cats = list("abcdef") score = np.random.randn(2000) g = np.random.choice(cats, 2000) for i, l in enumerate(cats): score[g == l] += i // 2 df = pd.DataFrame...
bsd-3-clause
jayflo/scikit-learn
sklearn/neighbors/approximate.py
128
22351
"""Approximate nearest neighbor search""" # Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # Joel Nothman <joel.nothman@gmail.com> import numpy as np import warnings from scipy import sparse from .base import KNeighborsMixin, RadiusNeighborsMixin from ..base import BaseEstimator from ..utils.va...
bsd-3-clause
prheenan/Research
Perkins/Projects/Primers/Demos/2016_4_21_Order_Linear_Primers/LinearMp13_1607F_3520R_Order.py
1
1317
# force floating point division. Can still use integer with // from __future__ import division # This file is used for importing the common utilities classes. import numpy as np import matplotlib.pyplot as plt import sys baseDir = "../../" sys.path.append(baseDir) import networkx import PrimerDesign.OverHangingPrime...
gpl-3.0
edux300/research
data/cbisv2.py
1
3667
# -*- coding: utf-8 -*- """ Created on Mon Oct 9 19:22:38 2017 cbisv2 @author: eduardo """ import sys sys.path.append("/home/eduardo/research/research/") import os import glob import pickle as pkl import auxiliary_funcs as auxilf import funcs.xml_reader as xmlr from matplotlib import pyplot as plt src_folder = "/med...
apache-2.0
imaculate/scikit-learn
examples/semi_supervised/plot_label_propagation_versus_svm_iris.py
50
2378
""" ===================================================================== Decision boundary of label propagation versus SVM on the Iris dataset ===================================================================== Comparison for decision boundary generated on iris dataset between Label Propagation and SVM. This demon...
bsd-3-clause
tomchor/pymicra
pymicra/tests.py
1
13840
""" This module contains functions that test certain conditions on pandas.dataframes to be used with the qcontrol(). They all return True for the columns that pass the test and False for the columns that fail the test. """ from __future__ import absolute_import, print_function, division from . import algs def check_r...
gpl-3.0
iliavolyova/evo-clustering
src/core.py
1
20837
from __future__ import division from matplotlib.pyplot import colormaps import textwrap import random import math import os import numpy as np from scipy import spatial from sklearn.cluster import * import time import log from sklearn import metrics from sklearn import preprocessing from dataset import * class Con...
mit
jreback/pandas
pandas/tests/indexes/multi/test_names.py
1
4966
import pytest import pandas as pd from pandas import MultiIndex import pandas._testing as tm def check_level_names(index, names): assert [level.name for level in index.levels] == list(names) def test_slice_keep_name(): x = MultiIndex.from_tuples([("a", "b"), (1, 2), ("c", "d")], names=["x", "y"]) asser...
bsd-3-clause
anirudhjayaraman/scikit-learn
examples/decomposition/plot_ica_vs_pca.py
306
3329
""" ========================== FastICA on 2D point clouds ========================== This example illustrates visually in the feature space a comparison by results using two different component analysis techniques. :ref:`ICA` vs :ref:`PCA`. Representing ICA in the feature space gives the view of 'geometric ICA': ICA...
bsd-3-clause
pligor/predicting-future-product-prices
00_skroutz_import/advanced_one_hot_encoder.py
1
2817
from sklearn.preprocessing import LabelEncoder, OneHotEncoder import numpy as np import pandas as pd class AdvancedOneHotEncoder(object): def encodePandasColAndMerge(self, data_frame, col_name, check_to_null=lambda vv: False): """check_to_null provided robustness against invalid values, simply filter thos...
agpl-3.0
wattlebird/pystruct
examples/plot_potts_model.py
5
1709
""" ================================================= Comparing inference times on a simple Potts model ================================================= Simple comparison of inference times on a Potts model (smoothing) on a 2d grid of random noise of 5 classes. The plots show the label results together with energies...
bsd-2-clause
Shaswat27/sympy
sympy/plotting/tests/test_plot.py
43
8577
from sympy import (pi, sin, cos, Symbol, Integral, summation, sqrt, log, oo, LambertW, I, meijerg, exp_polar, Max, Piecewise) from sympy.plotting import (plot, plot_parametric, plot3d_parametric_line, plot3d, plot3d_parametric_surface) from sympy.plotting.plot import unset...
bsd-3-clause
kshedstrom/pyroms
examples/NWGOA3/Fetch_Pacific/get_pacific_grid.py
1
4241
#import matplotlib #matplotlib.use('Agg') #import numpy as np import netCDF4 from datetime import datetime #import pyroms #import pyroms_toolbox #import sys # get HYCOM Northeast Pacific data from 2007 to 2011 invarname = 'angle' outvarname = 'angle' #read grid and variable attributes from the first file url='htt...
bsd-3-clause
htwangtw/Patterns-of-Thought
src/visualise.py
1
4634
import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd from mpl_toolkits.axes_grid1 import make_axes_locatable from src.utils import unflatten def rank_labels(pd_ser): ''' rank behaviour variables and ignore labels of sparsed variables. return label and a flatten array ...
mit
wegamekinglc/alpha-mind
alphamind/tests/portfolio/test_riskmodel.py
1
2187
# -*- coding: utf-8 -*- """ Created on 2018-5-29 @author: cheng.li """ import unittest import numpy as np import pandas as pd from alphamind.portfolio.riskmodel import FactorRiskModel from alphamind.portfolio.riskmodel import FullRiskModel class TestRiskModel(unittest.TestCase): def setUp(self): self...
mit
Gorbagzog/StageIAP
HorizonPhotometric.py
1
7778
#!/usr/bin/env python3 # -*-coding:Utf-8 -* """H-AGN LightCone photometric Catalog. Load catalog and make a match with the true lightcone catalog. """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import pyfits from scipy.spatial import cKDTree from timeit import default_timer as timer star...
gpl-3.0
wavelets/ThinkStats2
code/chap12ex_soln.py
68
4459
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import pandas import numpy as np import statsmodels.formula.api as smf import t...
gpl-3.0
madjelan/Data-Science-45min-Intros
choosing-k-in-kmeans/3d-example.py
25
2925
#!/usr/bin/env python # -*- coding: UTF-8 -*- __author__="Josh Montague" __license__="MIT License" """ This script is designed to run inline (%run 3d-example.py) in the corresponding IPython notebook. It generates a 3d scatter plot using scikit-learn data generation and with a number of samples and clusters determi...
unlicense
bzero/statsmodels
examples/python/robust_models_0.py
33
2992
## Robust Linear Models from __future__ import print_function import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std # ## Estimation # # Load data: data = sm.datasets.stackloss.load() data.exog = sm.add_constant(data.ex...
bsd-3-clause
efce/voltPy
manager/helpers/genetic_algorithm/best_result.py
1
1254
import numpy as np from scipy.interpolate import CubicSpline from scipy.interpolate import InterpolatedUnivariateSpline # import matplotlib.pyplot as plt def bestResult(bestChrom,signals,Pmax): [m,n] = signals.shape # dodanie pierwszego i ostatniego punktu bestChrom[0] = 1 bestChrom[n-1...
gpl-3.0
RomainBrault/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
83
5888
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
jjx02230808/project0223
sklearn/datasets/__init__.py
72
3807
""" The :mod:`sklearn.datasets` module includes utilities to load datasets, including methods to load and fetch popular reference datasets. It also features some artificial data generators. """ from .base import load_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
bsd-3-clause
dgies/incubator-airflow
airflow/hooks/base_hook.py
5
2571
# -*- coding: utf-8 -*- # # 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 writing, software ...
apache-2.0
Habasari/sms-tools
software/transformations_interface/stochasticTransformations_function.py
23
2689
# function call to the transformation function of relevance to the stochasticModel import numpy as np import matplotlib.pyplot as plt from scipy.signal import get_window import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/')) sys.path.append(os.path.join(os.path.dirname(...
agpl-3.0
pythonvietnam/scikit-learn
sklearn/datasets/tests/test_base.py
205
5878
import os import shutil import tempfile import warnings import nose import numpy from pickle import loads from pickle import dumps from sklearn.datasets import get_data_home from sklearn.datasets import clear_data_home from sklearn.datasets import load_files from sklearn.datasets import load_sample_images from sklearn...
bsd-3-clause
macsharma/FORKS
arabidopsis_python/FORKS_crossval.py
1
24696
# -*- coding: utf-8 -*- """ Created on Fri Nov 04 16:04:25 2016 @author: mayank """ #%% import os print (os.getcwd()) path1="D:\\Dropbox\\phd\\pseudotemporal\\arabidopsis_python" os.chdir(path1) print (os.getcwd()) #%% from forks_fcns import * #%% #import seaborn as sns #sns.set_style("darkgrid") ...
gpl-3.0
ekadhanda/bin
python/katRiseSet.py
1
5735
#! /usr/bin/env python # IMPORTANT: All times are in UTC. # # katRiseSet.py is based on Lindsay's # "Scheduling_catalogue_tester.ipynb" to compute source rise, transit # and set times. The input "source_catalogue.csv" is of the format in # katsdpcatalogue files. # # If no date and time is given, current UTC time is us...
mit
procoder317/scikit-learn
sklearn/covariance/tests/test_covariance.py
69
11116
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_alm...
bsd-3-clause
tdhopper/scikit-learn
sklearn/datasets/species_distributions.py
198
7923
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
myselfHimanshu/UdacityDSWork
Intro-To-Data-Science/Lesson2/PS2_3.py
2
1702
import pandas import pandasql def avg_weekend_temperature(filename): ''' This function should run a SQL query on a dataframe of weather data. The SQL query should return one column and one row - the average meantempi on days that are a Saturday or Sunday (i.e., the the average mean temperature on ...
gpl-2.0
Akshay0724/scikit-learn
examples/covariance/plot_lw_vs_oas.py
159
2951
""" ============================= Ledoit-Wolf vs OAS estimation ============================= The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and Wolf proposed a close formula to compute the asymptotically optimal shrinkage parameter (minimizing a MSE criterion), yielding th...
bsd-3-clause
IBT-FMI/COSgen
irf/design.py
1
3879
# -*- coding: utf-8 -*- import numpy as np from scipy import stats, signal import matplotlib.pyplot as plt def get_irf( a=2, b=10, resolution=1, ): my_x = np.linspace(0,100,100*resolution) my_y = stats.beta.pdf(my_x/100, a, b) my_z = np.linspace(0,0,100*resolution) my_z[:20*resolution]=1 irf = signal.deconv...
lgpl-3.0
lukeiwanski/tensorflow
tensorflow/contrib/factorization/python/ops/gmm_test.py
41
8716
# 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
eickenberg/scikit-learn
sklearn/mixture/tests/test_dpgmm.py
34
2573
import unittest import nose import numpy as np from sklearn.mixture import DPGMM, VBGMM from sklearn.mixture.dpgmm import log_normalize from sklearn.datasets import make_blobs from sklearn.utils.testing import assert_array_less from .test_gmm import GMMTester np.seterr(all='warn') def test_class_weights(): # ...
bsd-3-clause
napjon/moocs_solution
ml-udacity/pca/eigenfaces.py
1
5184
""" =================================================== Faces recognition example using eigenfaces and SVMs =================================================== The dataset used in this example is a preprocessed excerpt of the "Labeled Faces in the Wild", aka LFW_: http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (...
mit
Saurabh7/shogun
applications/easysvm/tutpaper/svm_params.py
26
12935
#from matplotlib import rc #rc('text', usetex=True) fontsize = 16 contourFontsize = 12 showColorbar = False xmin = -1 xmax = 1 ymin = -1.05 ymax = 1 import sys,os import numpy import shogun from shogun.Kernel import GaussianKernel, LinearKernel, PolyKernel from shogun.Features import RealFeatures, BinaryLabels from...
mit
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/matplotlib/axes/_subplots.py
10
8310
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import map from matplotlib.gridspec import GridSpec, SubplotSpec from matplotlib import docstring import matplotlib.artist as martist from matplotlib.axes._axes import Axes import wa...
gpl-3.0
Split-Screen/android_kernel_nvidia_shieldtablet
scripts/tracing/dma-api/plotting.py
96
4043
"""Ugly graph drawing tools""" import matplotlib.pyplot as plt import matplotlib.cm as cmap #import numpy as np from matplotlib import cbook # http://stackoverflow.com/questions/4652439/is-there-a-matplotlib-equivalent-of-matlabs-datacursormode class DataCursor(object): """A simple data cursor widget that displays...
gpl-2.0
YihaoLu/pyfolio
pyfolio/plotting.py
1
41802
# # Copyright 2015 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
pratapvardhan/scikit-learn
sklearn/utils/tests/test_shortest_path.py
303
2841
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
steffengraber/nest-simulator
pynest/examples/lin_rate_ipn_network.py
8
5702
# -*- coding: utf-8 -*- # # lin_rate_ipn_network.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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 2 of the Li...
gpl-2.0
sumsuddinshojib/openface
evaluation/lfw.py
1
9377
#!/usr/bin/env python3 # # Copyright 2015 Carnegie Mellon University # # 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 ...
apache-2.0
Toxad/TWDM-PON-Sim
run_plot_partially_done.py
1
1378
import sim import matplotlib.pyplot as plt sim.DEBUG = True # seed sim.random.seed(13) # default values sim.tg_default_size = lambda x: 250 sim.DBA_IPACT_default_bandwidth = 5000 max_onus = 3 # seed sim.random.seed(13) # for f in range(1,max_onus): # # override suffix writer # sim.packet_w = sim.Writer("#...
mit
jhamman/xarray
xarray/core/ops.py
1
11133
"""Define core operations for xarray objects. TODO(shoyer): rewrite this module, making use of xarray.core.computation, NumPy's __array_ufunc__ and mixin classes instead of the unintuitive "inject" functions. """ import operator import numpy as np from . import dtypes, duck_array_ops from .nputils import array_eq, ...
apache-2.0
mdrumond/tensorflow
tensorflow/contrib/training/python/training/feeding_queue_runner_test.py
76
5052
# Copyright 2015 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
neilhan/tensorflow
tensorflow/examples/skflow/iris_custom_model.py
12
2592
# 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 appl...
apache-2.0
Clyde-fare/scikit-learn
sklearn/metrics/cluster/tests/test_supervised.py
206
7643
import numpy as np from sklearn.metrics.cluster import adjusted_rand_score from sklearn.metrics.cluster import homogeneity_score from sklearn.metrics.cluster import completeness_score from sklearn.metrics.cluster import v_measure_score from sklearn.metrics.cluster import homogeneity_completeness_v_measure from sklearn...
bsd-3-clause
Scapogo/zipline
tests/utils/test_cache.py
6
1936
from unittest import TestCase from pandas import Timestamp, Timedelta from zipline.utils.cache import CachedObject, Expired, ExpiringCache class CachedObjectTestCase(TestCase): def test_cached_object(self): expiry = Timestamp('2014') before = expiry - Timedelta('1 minute') after = expir...
apache-2.0
google-research/google-research
neural_guided_symbolic_regression/utils/expression_generalization_metrics_test.py
1
7963
# coding=utf-8 # Copyright 2021 The Google Research 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
apache-2.0
evgchz/scikit-learn
sklearn/cluster/__init__.py
19
1215
""" The :mod:`sklearn.cluster` module gathers popular unsupervised clustering algorithms. """ from .spectral import spectral_clustering, SpectralClustering from .mean_shift_ import mean_shift, MeanShift, estimate_bandwidth, \ get_bin_seeds from .affinity_propagation_ import affinity_propagation, AffinityPropagatio...
bsd-3-clause
zachcp/qiime
tests/test_stats.py
15
101464
#!/usr/bin/env python from __future__ import division __author__ = "Michael Dwan" __copyright__ = "Copyright 2012, The QIIME project" __credits__ = ["Jai Ram Rideout", "Michael Dwan", "Logan Knecht", "Damien Coy", "Levi McCracken", "Andrew Cochran", "Will Van Treuren"] __license__ = "GPL"...
gpl-2.0
dolejarz/engsci_capstone_transport
python/DDM/ARPM_utils.py
1
5598
from collections import namedtuple import numpy as np from datetime import datetime, timedelta from matplotlib.pyplot import savefig from numpy import meshgrid, pi, power as pow, isnan, diag from numpy.linalg import svd, inv, det from scipy.interpolate import LinearNDInterpolator, interp2d from scipy.special import gam...
mit
rnowling/asaph
setup.py
2
1136
""" Copyright 2020 Ronald J. Nowling 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 writing, softw...
apache-2.0
richlewis42/scikit-chem
skchem/core/atom.py
1
19470
#! /usr/bin/env python # # Copyright (C) 2015-2016 Rich Lewis <rl403@cam.ac.uk> # License: 3-clause BSD """ ## skchem.core.atom Defining atoms in scikit-chem. """ import numpy as np import pandas as pd from rdkit import Chem from rdkit.Chem.rdchem import GetPeriodicTable from rdkit.Chem.AtomPairs.Utils import NumP...
bsd-3-clause
techaddict/spark
python/pyspark/sql/tests/test_pandas_udf_window.py
21
12850
# # 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 us...
apache-2.0
luoyetx/mxnet
example/multivariate_time_series/src/lstnet.py
17
11583
# !/usr/bin/env 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 file # to you under the Apache License, Version 2.0 (the # "...
apache-2.0
jmcorgan/gnuradio
gr-filter/examples/fft_filter_ccc.py
47
4363
#!/usr/bin/env python # # Copyright 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 option) # ...
gpl-3.0
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/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...
mit
spinellic/Mission-Planner
Lib/site-packages/numpy/lib/polynomial.py
58
35930
""" Functions to operate on polynomials. """ __all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd', 'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d', 'polyfit', 'RankWarning'] import re import warnings import numpy.core.numeric as NX from numpy.core import isscalar, abs, finfo, atleas...
gpl-3.0
OXPHOS/shogun
examples/undocumented/python/graphical/so_multiclass_BMRM.py
11
2823
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from shogun import RealFeatures from shogun import MulticlassModel, MulticlassSOLabels, RealNumber, DualLibQPBMSOSVM from shogun import BMRM, PPBMRM, P3BMRM from shogun import StructuredAccuracy def fill_data(cnt, minv, maxv): x1 = np.linspace...
gpl-3.0
sunil07t/e-mission-server
emission/analysis/result/metrics/time_grouping.py
1
9767
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import range from builtins import * import enum import pandas as pd import arrow as ar...
bsd-3-clause
akhilari7/pa-dude
lib/python2.7/site-packages/nltk/sentiment/util.py
3
30992
# coding: utf-8 # # Natural Language Toolkit: Sentiment Analyzer # # Copyright (C) 2001-2015 NLTK Project # Author: Pierpaolo Pantone <24alsecondo@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ Utility methods for Sentiment Analysis. """ from copy import deepcopy import codecs imp...
mit
eWaterCycle/ewatercycle
tests/observation/test_grdc.py
1
4364
from datetime import datetime import pandas as pd import pytest import numpy as np from pandas.testing import assert_frame_equal from ewatercycle import CFG from ewatercycle.observation.grdc import get_grdc_data @pytest.fixture def sample_grdc_file(tmp_path): fn = tmp_path / '42424242_Q_Day.Cmd.txt' # Sampl...
apache-2.0
Akshen/workshop_booking
statistics_app/views.py
1
22195
from workshop_app.forms import ( UserRegistrationForm, UserLoginForm, ProfileForm, CreateWorkshop, ProposeWorkshopDateForm ) from workshop_app.models import ( Profile, User, has_profile, Workshop, WorkshopType, RequestedWorkshop, BookedWorkshop, ProposeWorkshopDate, Testimonial ) from dj...
gpl-3.0
TariqAHassan/BioVida
biovida/support_tools/printing.py
1
12309
# coding: utf-8 """ Printing Tools ~~~~~~~~~~~~~~ """ import pandas as pd # General Support Tools from biovida.support_tools.support_tools import cln, pstr, items_null, remove_line_breaks # Suppress Pandas' SettingWithCopyWarning pd.options.mode.chained_assignment = None # -------------------------------...
bsd-3-clause
fredhusser/scikit-learn
sklearn/cluster/tests/test_spectral.py
262
7954
"""Testing for Spectral Clustering methods""" from sklearn.externals.six.moves import cPickle dumps, loads = cPickle.dumps, cPickle.loads import numpy as np from scipy import sparse from sklearn.utils import check_random_state from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
KSchoenleber/urbs
urbs/input.py
1
25369
import pandas as pd import os import glob from xlrd import XLRDError import pyomo.core as pyomo from .features.modelhelper import * from .identify import * def read_input(input_files, year): """Read Excel input file and prepare URBS input dict. Reads the Excel spreadsheets that adheres to the structure shown...
gpl-3.0
benhoff/vexbot
vexbot/entity_extraction.py
2
3561
import sklearn_crfsuite import spacy class EntityExtraction: def __init__(self, language_model=None): values = {'algorithm': 'lbfgs', # coefficient for L1 penalty 'c1': 1, # coefficient for L2 penalty 'c2': 1e-3, 'ma...
gpl-3.0
openfisca/openfisca-france-indirect-taxation
openfisca_france_indirect_taxation/examples/all_indirect_taxes/plot_regressivite.py
4
3282
# -*- coding: utf-8 -*- """ Created on Thu Feb 04 11:28:12 2016 @author: thomas.douenne """ # Import de modules généraux from __future__ import division import pandas import seaborn # Import de modules spécifiques à Openfisca from openfisca_france_indirect_taxation.examples.utils_example import graph_builder_bar fr...
agpl-3.0
zorroblue/scikit-learn
sklearn/kernel_approximation.py
29
19022
""" The :mod:`sklearn.kernel_approximation` module implements several approximate kernel feature maps base on Fourier transforms. """ # Author: Andreas Mueller <amueller@ais.uni-bonn.de> # # License: BSD 3 clause import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import svd from .base im...
bsd-3-clause
tosolveit/scikit-learn
benchmarks/bench_plot_ward.py
290
1260
""" Benchmark scikit-learn's Ward implement compared to SciPy's """ import time import numpy as np from scipy.cluster import hierarchy import pylab as pl from sklearn.cluster import AgglomerativeClustering ward = AgglomerativeClustering(n_clusters=3, linkage='ward') n_samples = np.logspace(.5, 3, 9) n_features = n...
bsd-3-clause
obreitwi/nest-simulator
testsuite/manualtests/stdp_check.py
4
4615
# -*- coding: utf-8 -*- # # stdp_check.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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 2 of the License, or ...
gpl-2.0
stefanosbou/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
smartscheduling/scikit-learn-categorical-tree
sklearn/linear_model/ransac.py
22
14007
# coding: utf-8 # Author: Johannes Schönberger # # License: BSD 3 clause import numpy as np from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone from ..utils import check_random_state, check_array, check_consistent_length from ..utils.random import sample_without_replacement from ..utils.valid...
bsd-3-clause
airanmehr/bio
Scripts/TimeSeriesPaper/RealData/GeneAnalysis.py
1
20033
''' Copyleft Jun 16, 2016 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com ''' import numpy as np; import pylab as plt np.set_printoptions(linewidth=200, precision=5, suppress=True) import pandas as pd; import seaborn as sns sns.set_style("whitegrid", {"grid.color": "1", 'axes.linewid...
mit
darshanthaker/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/projections/geo.py
69
19738
import math import numpy as np import numpy.ma as ma import matplotlib rcParams = matplotlib.rcParams from matplotlib.artist import kwdocd from matplotlib.axes import Axes from matplotlib import cbook from matplotlib.patches import Circle from matplotlib.path import Path from matplotlib.ticker import Formatter, Locat...
agpl-3.0