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
liangz0707/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
251
1895
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
bsd-3-clause
bdh1011/wau
venv/lib/python2.7/site-packages/pandas/tests/test_multilevel.py
1
87291
# -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101,W0141 import datetime import itertools import nose from numpy.random import randn import numpy as np from pandas.core.index import Index, MultiIndex from pandas import Panel, DataFrame, Series, notnull, isnull, Timestamp from pandas.util.testing import (asser...
mit
zoranzhao/NoSSim
NoS_ECG/ga_dse.py
1
7996
#!/usr/bin/env python2.7 # NoSSim exploration framework # Author: Zhuoran Zhao # Date: 2017/03/18 # This GA-based exploration is developed with DEAP library # Single/Multi-Object GA are encapsulated in different functions main_ga, main_moga import random import array import json import numpy import pprint...
bsd-3-clause
MartinDelzant/scikit-learn
examples/gaussian_process/gp_diabetes_dataset.py
223
1976
#!/usr/bin/python # -*- coding: utf-8 -*- """ ======================================================================== Gaussian Processes regression: goodness-of-fit on the 'diabetes' dataset ======================================================================== In this example, we fit a Gaussian Process model onto...
bsd-3-clause
Nyker510/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
amolkahat/pandas
pandas/tests/indexes/interval/test_interval.py
1
47391
from __future__ import division from itertools import permutations import pytest import numpy as np import re from pandas import ( Interval, IntervalIndex, Index, isna, notna, interval_range, Timestamp, Timedelta, date_range, timedelta_range) from pandas.compat import lzip import pandas.core.common as com from...
bsd-3-clause
yuliang419/K2tools
ecentroid.py
1
3828
""" Plots any selected star(s) to use as reference star(s) for detrending. Writes good frame numbers into file named ref_cad.dat, and centroids into ref_centroid.dat (for one chosen star only, but we can probably average a few). """ from pixel2flux import * import matplotlib.pyplot as plt plt.ion() import numpy as np ...
mit
olologin/scikit-learn
examples/classification/plot_classifier_comparison.py
36
5123
#!/usr/bin/python # -*- coding: utf-8 -*- """ ===================== Classifier comparison ===================== A comparison of a several classifiers in scikit-learn on synthetic datasets. The point of this example is to illustrate the nature of decision boundaries of different classifiers. This should be taken with ...
bsd-3-clause
idlead/scikit-learn
examples/linear_model/plot_ard.py
18
2827
""" ================================================== Automatic Relevance Determination Regression (ARD) ================================================== Fit regression model with Bayesian Ridge Regression. See :ref:`bayesian_ridge_regression` for more information on the regressor. Compared to the OLS (ordinary l...
bsd-3-clause
pylayers/pylayers
pylayers/simul/link.py
1
78614
# # -*- coding: utf-8 -*- # from __future__ import print_function r""" .. currentmodule:: pylayers.simul.link .. autosummary:: :members: """ try: from tvtk.api import tvtk from mayavi.sources.vtk_data_source import VTKDataSource from mayavi import mlab except: print('Layout:Mayavi is not install...
mit
pkruskal/scikit-learn
sklearn/cross_decomposition/pls_.py
187
28507
""" The :mod:`sklearn.pls` module implements Partial Least Squares (PLS). """ # Author: Edouard Duchesnay <edouard.duchesnay@cea.fr> # License: BSD 3 clause from ..base import BaseEstimator, RegressorMixin, TransformerMixin from ..utils import check_array, check_consistent_length from ..externals import six import w...
bsd-3-clause
ContinuumIO/blaze
blaze/compute/sql.py
3
49986
""" >>> from blaze import * >>> accounts = symbol('accounts', 'var * {name: string, amount: int}') >>> deadbeats = accounts[accounts['amount'] < 0]['name'] >>> from sqlalchemy import Table, Column, MetaData, Integer, String >>> t = Table('accounts', MetaData(), ... Column('name', String, primary_key = True...
bsd-3-clause
sbg2133/miscellaneous_projects
carina/planck_lic.py
1
4381
from getIQU import IQU from subprocess import call import sys, os import numpy as np import matplotlib.pyplot as plt from astropy.convolution import convolve, Gaussian2DKernel from astropy.io import fits from astropy.wcs import WCS import scipy.ndimage from skimage import filters plt.ion() stokes = ['I', 'Q', 'U'] pl...
gpl-3.0
shipci/sympy
examples/intermediate/mplot3d.py
14
1261
#!/usr/bin/env python """Matplotlib 3D plotting example Demonstrates plotting with matplotlib. """ import sys from sample import sample from sympy import sin, Symbol from sympy.external import import_module def mplot3d(f, var1, var2, show=True): """ Plot a 3d function using matplotlib/Tk. """ im...
bsd-3-clause
kagayakidan/scikit-learn
sklearn/utils/tests/test_random.py
230
7344
from __future__ import division import numpy as np import scipy.sparse as sp from scipy.misc import comb as combinations from numpy.testing import assert_array_almost_equal from sklearn.utils.random import sample_without_replacement from sklearn.utils.random import random_choice_csc from sklearn.utils.testing import ...
bsd-3-clause
bellwethers-in-se/defects
src/old/Test Oracle/Prediction.py
1
1996
from __future__ import division from sklearn.ensemble import RandomForestClassifier from methods1 import * from smote import * def formatData(tbl): """ Convert Tbl to Pandas DataFrame :param tbl: Thing object created using function createTbl :returns table in a DataFrame format """ Rows = [i.ce...
mit
grhawk/ASE
ase/io/png.py
4
1758
from ase.io.eps import EPS class PNG(EPS): def write_header(self): from matplotlib.backends.backend_agg import RendererAgg try: from matplotlib.transforms import Value except ImportError: dpi = 72 else: dpi = Value(72) self.renderer = R...
gpl-2.0
e-koch/VLA_Lband
14B-088/HI/imaging/imaging_tests/HI_testing_analysis.py
1
2781
''' Split from HI_testing_comparison because I didn't feel like getting statsmodels to play nice within CASA. ''' import os import pandas as pd import statsmodels.formula.api as sm data_path = os.path.expanduser("~/MyRAID/M33/14B-088/HI/channel_testing") data = pd.read_csv(os.path.join(data_path, "property_values.c...
mit
shahankhatch/scikit-learn
examples/neural_networks/plot_rbm_logistic_classification.py
258
4609
""" ============================================================== Restricted Boltzmann Machine features for digit classification ============================================================== For greyscale image data where pixel values can be interpreted as degrees of blackness on a white background, like handwritten...
bsd-3-clause
mromanello/CitationExtractor
citation_extractor/ned/matchers.py
1
39974
# -*- coding: utf-8 -*- # author: Matteo Romanello, matteo.romanello@gmail.com, Matteo Filipponi """Contains various implementations of citation matchers.""" from __future__ import print_function import os import pickle import sys import pdb import time import logging import multiprocessing from operator import itemg...
gpl-3.0
lpsinger/astropy
astropy/nddata/ccddata.py
5
27852
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module implements the base CCDData class.""" import itertools import numpy as np from .compat import NDDataArray from .nduncertainty import ( StdDevUncertainty, NDUncertainty, VarianceUncertainty, InverseVariance) from astropy.io import fits...
bsd-3-clause
ODM2/ODM2YODAParser
yodatools/excelparser/excelParser.py
2
22474
import os import re from collections import defaultdict from uuid import uuid4 import wx from datetime import datetime from pubsub import pub from pandas import isnull, DataFrame, NaT from sqlalchemy.exc import IntegrityError from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm.session import Session impor...
bsd-3-clause
Stargrazer82301/CAAPR
CAAPR/CAAPR_AstroMagic/PTS/pts/core/plot/grids.py
1
6267
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
mit
fyffyt/scikit-learn
sklearn/covariance/tests/test_graph_lasso.py
272
5245
""" Test the graph_lasso module. """ import sys import numpy as np from scipy import linalg from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_less from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV, empirical_...
bsd-3-clause
kreczko/rootpy
setup.py
1
4867
#!/usr/bin/env python # Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License import sys # check Python version if sys.version_info < (2, 6): sys.exit("rootpy only supports python 2.6 and above") # check that ROOT can be imported try: import ROOT except ImportEr...
gpl-3.0
samuroi/SamuROI
samuroi/gui/widgets/traceview.py
1
5505
import numpy from PyQt5 import QtCore, QtGui from PyQt5.QtWidgets import QDockWidget, QWidget, QHBoxLayout from .canvasbase import CanvasBase class TraceViewCanvas(CanvasBase): """Plot a set of traces for a selection defined by a QtSelectionModel""" def __init__(self, segmentation, selectionmodel): ...
mit
zooniverse/aggregation
experimental/algorithms/serengeti_2.py
2
3778
#!/usr/bin/env python __author__ = 'greg' import pymongo import matplotlib.pyplot as plt import numpy import math import random import csv import scipy.stats as stats # import numpy as np import pylab as pl import scipy.special as ss from scipy.stats import beta as beta_func # load subject data from CSV subjects_index...
apache-2.0
bavardage/statsmodels
statsmodels/sandbox/examples/ex_cusum.py
3
3212
# -*- coding: utf-8 -*- """ Created on Fri Apr 02 11:41:25 2010 Author: josef-pktd """ import numpy as np from scipy import stats from numpy.testing import assert_almost_equal import statsmodels.api as sm from statsmodels.sandbox.regression.onewaygls import OneWayLS from statsmodels.stats.diagnostic import recursive...
bsd-3-clause
xuewei4d/scikit-learn
examples/miscellaneous/plot_johnson_lindenstrauss_bound.py
14
7785
r""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected i...
bsd-3-clause
MalkIPP/ipp_work
ipp_work/simulations/charges_deductibles.py
1
3436
# -*- coding: utf-8 -*- """ Created on Tue May 5 11:54:08 2015 @author: malkaguillot """ # -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team # https://github.com/openfisca # # This file...
agpl-3.0
tkaitchuck/nupic
external/linux64/lib/python2.6/site-packages/matplotlib/artist.py
69
33042
from __future__ import division import re, warnings import matplotlib import matplotlib.cbook as cbook from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath from path import Path ## Note, matplotlib artists use the doc strings for set and get # methods to enable the introspection methods of ...
gpl-3.0
riddhishb/ipython-notebooks
Poisson Editing/seamlesscloning.py
1
1270
import cv2 import numpy as np import matplotlib.pyplot as plt im_cloned = cv2.imread("stinkbug_cloned.png", cv2.IMREAD_GRAYSCALE) im_mask = cv2.imread("stinkbug_cloned_mask.png", cv2.IMREAD_GRAYSCALE) it = 500; # Set number of iterations im_temp = im_cloned.copy() im_seamless = im_temp.copy() sigma = [] for i in ra...
gpl-3.0
nettorta/yandex-tank
yandextank/plugins/Phantom/tests/test_reader.py
2
2081
from threading import Event import pandas as pd from yandextank.common.util import FileMultiReader from yandextank.plugins.Phantom.reader import PhantomReader, PhantomStatsReader, string_to_df_microsec class TestPhantomReader(object): def setup_class(self): stop = Event() self.multireader = File...
lgpl-2.1
jmargeta/scikit-learn
sklearn/tests/test_preprocessing.py
3
25863
import warnings import numpy as np import numpy.linalg as la import scipy.sparse as sp from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils...
bsd-3-clause
nhuntwalker/astroML
book_figures/chapter5/fig_posterior_gaussgauss.py
3
4803
""" Gaussian Distribution with Gaussian Errors ------------------------------------------ Figure 5.8 The solid lines show marginalized posterior pdfs for :math:`\mu` (left) and :math:`\sigma` (right) for a Gaussian distribution with heteroscedastic Gaussian measurement errors (i.e., integrals over :math:`\sigma` and :...
bsd-2-clause
phageParser/phageParser
populate.py
3
6935
#!/usr/bin/env python import argparse import os import pickle import pandas import requests from Bio import Entrez, SeqIO from lxml import html, etree from tqdm import tqdm os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'phageAPI.settings') import django django.setup() from util.acc import read_accession_file fro...
mit
roxyboy/scikit-learn
sklearn/metrics/tests/test_common.py
83
41144
from __future__ import division, print_function from functools import partial from itertools import product import numpy as np import scipy.sparse as sp from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import LabelBinarizer from sklearn.utils.multiclass import type_of_target fro...
bsd-3-clause
LingboTang/LearningFiles
load_dat.py
1
7385
import os import sys import re import numpy as np import random import getopt import time import matplotlib.pyplot as plt from scipy.interpolate import splrep, pchip, splmake, splev, spline, interp1d import signal # ========================================= Exception ================================================= #...
apache-2.0
alexeyum/scikit-learn
sklearn/decomposition/dict_learning.py
42
46134
""" Dictionary learning """ from __future__ import print_function # Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort # License: BSD 3 clause import time import sys import itertools from math import sqrt, ceil import numpy as np from scipy import linalg from numpy.lib.stride_tricks import as_strided from ..b...
bsd-3-clause
warmspringwinds/scikit-image
doc/examples/plot_watershed.py
4
2335
""" ====================== Watershed segmentation ====================== The watershed is a classical algorithm used for **segmentation**, that is, for separating different objects in an image. Starting from user-defined markers, the watershed algorithm treats pixels values as a local topography (elevation). The algo...
bsd-3-clause
xuewei4d/scikit-learn
examples/release_highlights/plot_release_highlights_0_22_0.py
10
10186
""" ======================================== Release Highlights for scikit-learn 0.22 ======================================== .. currentmodule:: sklearn We are pleased to announce the release of scikit-learn 0.22, which comes with many bug fixes and new features! We detail below a few of the major features of this r...
bsd-3-clause
zorroblue/scikit-learn
benchmarks/bench_plot_parallel_pairwise.py
127
1270
# Author: Mathieu Blondel <mathieu@mblondel.org> # License: BSD 3 clause import time import matplotlib.pyplot as plt from sklearn.utils import check_random_state from sklearn.metrics.pairwise import pairwise_distances from sklearn.metrics.pairwise import pairwise_kernels def plot(func): random_state = check_rand...
bsd-3-clause
wogsland/QSTK
Bin/Data_CSV.py
5
3301
#File to read the data from mysql and push into CSV. # Python imports import datetime as dt import csv import copy import os import pickle # 3rd party imports import numpy as np import matplotlib.pyplot as plt import pandas as pd # QSTK imports from QSTK.qstkutil import qsdateutil as du import QSTK.qstkutil.DataEvol...
bsd-3-clause
arokem/nipy
nipy/labs/viz_tools/maps_3d.py
3
14510
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ 3D visualization of activation maps using Mayavi """ # Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org> # License: BSD import os import tempfile # Standard scientific libraries impo...
bsd-3-clause
Lab603/PicEncyclopedias
jni-build/jni/include/tensorflow/contrib/learn/python/learn/tests/dataframe/in_memory_source_test.py
30
3738
# 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...
mit
nok/sklearn-porter
sklearn_porter/estimator/classifier/AdaBoostClassifier/__init__.py
1
12399
# -*- coding: utf-8 -*- import os from json import encoder from json import dumps from sklearn.tree.tree import DecisionTreeClassifier from sklearn_porter.estimator.classifier.Classifier import Classifier class AdaBoostClassifier(Classifier): """ See also -------- sklearn.ensemble.AdaBoostClassifie...
mit
htimko/ArcPIC
pic2d/GLEanalysis/2Dpic_current_PerProcess.py
1
17220
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2010-2015 CERN and Helsinki Institute of Physics. # This software is distributed under the terms of the # GNU General Public License version 3 (GPL Version 3), # copied verbatim in the file LICENCE.md. In applying this # license, CERN does not waive the privil...
gpl-3.0
andrewbolster/thesis
posters/PDW-15/figures/figgen.py
1
1760
import matplotlib.pyplot as plt import networkx as nx import scipy.constants w=5 cut = 1.06 nodedict = {"A":(25,35),"B":(30,30),"C":(25,25),"D":(35,25),"E":(35,35)} direct = {'type':'Direct', 'color':'g', 'weight':4} indirect = {'type':'Indirect', 'color':'r', 'weight':2} recommend = {'type':'Recommendation', 'colo...
epl-1.0
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/ipython-2.2.0-py2.7.egg/IPython/qt/console/rich_ipython_widget.py
5
14894
#----------------------------------------------------------------------------- # Copyright (c) 2010, IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #--------------------------------------------------...
apache-2.0
aetilley/scikit-learn
sklearn/linear_model/tests/test_ridge.py
130
22974
import numpy as np import scipy.sparse as sp from scipy import linalg from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
great-expectations/great_expectations
tests/data_context/test_data_context_config_ui.py
1
52921
import copy import os from typing import Dict, Optional import pytest from great_expectations import DataContext from great_expectations.data_context import BaseDataContext from great_expectations.data_context.types.base import ( BaseStoreBackendDefaults, DatabaseStoreBackendDefaults, DataContextConfig, ...
apache-2.0
ajaech/username_analytics
MyClassifier.py
1
9130
import code import collections import gzip import math import morfessor import numpy import pandas import random import segmenter import sklearn.metrics from matplotlib import pylab random.seed(666) model = None def LoadUsernames(filename, maxload=400000000): if filename.endswith('.gz'): f = gzip.open(filename...
gpl-2.0
fredhusser/scikit-learn
sklearn/tests/test_base.py
216
7045
# Author: Gael Varoquaux # License: BSD 3 clause import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn.utils.testing impo...
bsd-3-clause
Adai0808/scikit-learn
examples/classification/plot_lda.py
164
2224
""" ==================================================================== Normal and Shrinkage Linear Discriminant Analysis for classification ==================================================================== Shows how shrinkage improves classification. """ from __future__ import division import numpy as np import...
bsd-3-clause
dsm054/pandas
asv_bench/benchmarks/io/stata.py
5
1526
import numpy as np from pandas import DataFrame, date_range, read_stata import pandas.util.testing as tm from ..pandas_vb_common import BaseIO class Stata(BaseIO): params = ['tc', 'td', 'tm', 'tw', 'th', 'tq', 'ty'] param_names = ['convert_dates'] def setup(self, convert_dates): self.fname = '_...
bsd-3-clause
ngoix/OCRF
examples/linear_model/plot_lasso_and_elasticnet.py
73
2074
""" ======================================== Lasso and Elastic Net for Sparse Signals ======================================== Estimates Lasso and Elastic-Net regression models on a manually generated sparse signal corrupted with an additive noise. Estimated coefficients are compared with the ground-truth. """ print(...
bsd-3-clause
bavardage/statsmodels
statsmodels/sandbox/panel/mixed.py
4
20977
""" Mixed effects models Author: Jonathan Taylor Author: Josef Perktold License: BSD-3 Notes ------ It's pretty slow if the model is misspecified, in my first example convergence in loglike is not reached within 2000 iterations. Added stop criteria based on convergence of parameters instead. With correctly specifi...
bsd-3-clause
hhain/sdap17
notebooks/pawel_ueb2/filters.py
1
2457
import pandas as pd import numpy as np import matplotlib.pyplot as plt from features import * from utility import * ## filter functions def distortion_filter(data, column_key = "_ifft_0", label = 'target', std_thresh = 100.): """ replaces distortions in the data by checking for high std replaceme...
mit
neurosnap/mudicom
mudicom/image.py
1
4474
# -*- coding: utf-8 -*- """ mudicom.image ~~~~~~~~~~~~~ Primary image module that converts DICOM pixel data into a numpy array as well as saving the image using Matplotlib or Pillow. """ import os.path import sys import numpy import gdcm class Image(object): """ This class attempts to extract an i...
mit
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/sklearn/ensemble/tests/test_gradient_boosting.py
6
39791
""" Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting). """ import warnings import numpy as np from itertools import product from scipy.sparse import csr_matrix from scipy.sparse import csc_matrix from scipy.sparse import coo_matrix from sklearn import datasets from sklearn.base import clo...
gpl-2.0
frank-tancf/scikit-learn
sklearn/utils/tests/test_seq_dataset.py
47
2486
# Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # # License: BSD 3 clause import numpy as np import scipy.sparse as sp from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset from sklearn.datasets import load_iris from numpy.testing import assert_array_equal from nose.tools import assert_equal iris =...
bsd-3-clause
lbeltrame/mnegri-ov170
programs/extract_shared_mutations.py
1
20417
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2014 Luca Beltrame <luca.beltrame@marionegri.it> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License,...
gpl-2.0
evgchz/scikit-learn
sklearn/ensemble/tests/test_weight_boosting.py
9
15843
"""Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np from sklearn.utils.testing import assert_array_equal, assert_array_less from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_raises, assert_rais...
bsd-3-clause
BryanCutler/spark
python/pyspark/pandas/tests/test_config.py
1
6435
# # 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
Extintor/piva
practica4/p4script5.py
1
1108
# -*- coding: utf-8 -*- """ Created on Wed Apr 6 18:04:51 2016 @author: paul """ from __future__ import division import matplotlib.pyplot as plt import numpy as np def turn_to_grayscale(img): try: red = img[:,:,0] green = img[:,:,1] blue = img[:,:,2] img = np.uint8(np.add(np.add(...
gpl-3.0
ltiao/networkx
examples/graph/unix_email.py
26
2678
#!/usr/bin/env python """ Create a directed graph, allowing multiple edges and self loops, from a unix mailbox. The nodes are email addresses with links that point from the sender to the recievers. The edge data is a Python email.Message object which contains all of the email message data. This example shows the po...
bsd-3-clause
automl/paramsklearn
tests/components/feature_preprocessing/test_select_percentile_classification.py
1
4693
import unittest import numpy as np import scipy.sparse import sklearn.preprocessing from ParamSklearn.components.feature_preprocessing.select_percentile_classification import SelectPercentileClassification from ParamSklearn.util import _test_preprocessing, get_dataset class SelectPercentileClassificationTest(unitte...
bsd-3-clause
Myasuka/scikit-learn
examples/mixture/plot_gmm.py
248
2817
""" ================================= Gaussian Mixture Model Ellipsoids ================================= Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet process. Both models have access to five components with which to fit the data. Note that the EM model will necessari...
bsd-3-clause
wlamond/scikit-learn
examples/mixture/plot_concentration_prior.py
16
5657
""" ======================================================================== Concentration Prior Type Analysis of Variation Bayesian Gaussian Mixture ======================================================================== This example plots the ellipsoids obtained from a toy dataset (mixture of three Gaussians) fitte...
bsd-3-clause
matbra/bokeh
bokeh/tests/test_protocol.py
42
3959
from __future__ import absolute_import import unittest from unittest import skipIf import numpy as np try: import pandas as pd is_pandas = True except ImportError as e: is_pandas = False class TestBokehJSONEncoder(unittest.TestCase): def setUp(self): from bokeh.protocol import BokehJSONEnc...
bsd-3-clause
diana-hep/carl
tests/distributions/test_exponential.py
1
1703
# Carl is free software; you can redistribute it and/or modify it # under the terms of the Revised BSD License; see LICENSE file for # more details. import numpy as np import scipy.stats as st from numpy.testing import assert_array_almost_equal from sklearn.utils import check_random_state from carl.distributions imp...
bsd-3-clause
bert9bert/statsmodels
statsmodels/tsa/filters/bk_filter.py
4
3244
from __future__ import absolute_import import numpy as np from scipy.signal import fftconvolve from ._utils import _maybe_get_pandas_wrapper def bkfilter(X, low=6, high=32, K=12): """ Baxter-King bandpass filter Parameters ---------- X : array-like A 1 or 2d ndarray. If 2d, variables are ...
bsd-3-clause
RomainBrault/scikit-learn
sklearn/neighbors/__init__.py
71
1025
""" The :mod:`sklearn.neighbors` module implements the k-nearest neighbors algorithm. """ from .ball_tree import BallTree from .kd_tree import KDTree from .dist_metrics import DistanceMetric from .graph import kneighbors_graph, radius_neighbors_graph from .unsupervised import NearestNeighbors from .classification impo...
bsd-3-clause
pdebuyl/RMPCDMD
experiments/03-single-janus/plot_planar.py
2
1110
#!/usr/bin/env python """ Display the planar concentration and velocity fields of a RMPCDMD simulation. """ import argparse parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('file', help="H5MD file") parser.add_argument('--species', type=int, default=0) args = parser.parse_args() import h5py i...
bsd-3-clause
linksuccess/linksuccess
parsingframework/structural_statistics.py
1
28185
from __future__ import division import numpy as np from graph_tool.all import * from matplotlib import pyplot as plt import pickle import powerlaw import fitpowerlaw as fp from wsd.database import MySQLDatabase from graph_tool.all import * from conf import * from matplotlib import style style.use('acm-2col-bmh') i...
mit
MartinSavc/scikit-learn
sklearn/feature_extraction/text.py
110
50157
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
murali-munna/scikit-learn
benchmarks/bench_sgd_regression.py
283
5569
""" Benchmark for SGD regression Compares SGD regression against coordinate descent and Ridge on synthetic data. """ print(__doc__) # Author: Peter Prettenhofer <peter.prettenhofer@gmail.com> # License: BSD 3 clause import numpy as np import pylab as pl import gc from time import time from sklearn.linear_model i...
bsd-3-clause
yerkesobservatory/seo
modules/resource/server.py
1
4061
import io import flask import base64 import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from typing import Dict from routines import plots from config import config import logging import colorlog #from flask_cors import CORS class ResourceServer(object): """ This class is a REST endpoint desi...
gpl-3.0
cinepost/Copperfield_FX
copper/cop/cop_file.py
1
10021
import matplotlib.image from PIL import Image import pyopencl as cl import numpy import os import logging from copper.core.op.node_type import NodeTypeBase from copper.core.op.node_type_category import Cop2NodeTypeCategory from copper.core.op.op_data_socket import OP_DataSocket from copper.core.data.image_data impor...
unlicense
mortada/scipy
scipy/integrate/quadrature.py
25
27849
from __future__ import division, print_function, absolute_import __all__ = ['fixed_quad','quadrature','romberg','trapz','simps','romb', 'cumtrapz','newton_cotes'] from scipy.special.orthogonal import p_roots from scipy.special import gammaln from numpy import sum, ones, add, diff, isinf, isscalar, \ a...
bsd-3-clause
RealTimeWeb/datasets
preprocess/energy/process.py
1
3434
import pandas as pd import json import states from tqdm import tqdm df = pd.read_csv('Complete_SEDS.csv') codes = df['MSN'].unique() sources = [c[:2] for c in codes] uses = [c[2:4] for c in codes] purposes = [c[4] for c in codes] #print(list(sorted(set(sources)))) #print(list(sorted(set(uses)))) #print(list(sorted(s...
gpl-2.0
e-mission/e-mission-server
bin/analysis/get_app_analytics.py
3
4793
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 * import logging import emission.core.get_database as edb import emission.stora...
bsd-3-clause
wesm/ibis
ibis/sql/sqlite/tests/test_functions.py
1
14619
# Copyright 2015 Cloudera 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 writing, so...
apache-2.0
choldgraf/download
setup.py
1
1959
#! /usr/bin/env python # # Copyright (C) 2015 Chris Holdgraf # <choldgraf@gmail.com> # # Adapted from MNE-Python import os from setuptools import setup descr = """A quick module to help downloading files using python.""" with open("./download/__init__.py", "r") as ff: lines = ff.readlines() for line in lines...
mit
ceholden/yatsm
yatsm/utils.py
1
7712
from __future__ import division from datetime import datetime as dt import fnmatch import os import re import sys import numpy as np import pandas as pd import six try: from scandir import walk except: from os import walk from .log_yatsm import logger # JOB SPECIFIC FUNCTIONS def distribute_jobs(job_numbe...
mit
biokit/biokit
biokit/viz/corrplot.py
1
18115
""".. rubric:: Corrplot utilities :author: Thomas Cokelaer :references: http://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html """ import string from colormap import cmap_builder import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.patches import Ellipse...
bsd-2-clause
sniemi/SamPy
sandbox/webserver/cgi-bin/pages.py
1
15221
'''HTML Pages''' import os, sys, glob import time, datetime import matplotlib from matplotlib import dates as MD from matplotlib import ticker as MT matplotlib.use('Agg') import numpy as N import pylab as P from math import * def page1(output, camera, year, response): # Introduction print "<html>" print "...
bsd-2-clause
xcgoner/dist-mxnet
example/svm_mnist/svm_mnist.py
44
4094
# 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
btabibian/scikit-learn
sklearn/feature_extraction/hashing.py
5
6830
# Author: Lars Buitinck # License: BSD 3 clause import numbers import warnings import numpy as np import scipy.sparse as sp from . import _hashing from ..base import BaseEstimator, TransformerMixin def _iteritems(d): """Like d.iteritems, but accepts any collections.Mapping.""" return d.iteritems() if hasat...
bsd-3-clause
QuantCrimAtLeeds/PredictCode
open_cp/scripted/analysis.py
1
9254
""" analysis.py ~~~~~~~~~~~ Various routines to perform standard analysis, and/or visualisation, tasks. """ import matplotlib.pyplot as _plt import matplotlib.collections as _mpl_collections import descartes as _descartes import csv as _csv import collections as _collections import scipy.stats as _stats import open_c...
artistic-2.0
WillieMaddox/numpy
doc/example.py
81
3581
"""This is the docstring for the example.py module. Modules names should have short, all-lowercase names. The module name may have underscores if this improves readability. Every module should have a docstring at the very top of the file. The module's docstring may extend over multiple lines. If your docstring doe...
bsd-3-clause
mne-tools/mne-tools.github.io
0.21/_downloads/a5d4e64d0843ff17526c0588f9967f97/plot_covariance_whitening_dspm.py
16
6905
""" .. _ex-covariance-whitening-dspm: =================================================== Demonstrate impact of whitening on source estimates =================================================== This example demonstrates the relationship between the noise covariance estimate and the MNE / dSPM source amplitudes. It c...
bsd-3-clause
mcdeoliveira/pyctrl
examples/simulated_motor_2.py
3
3579
#!/usr/bin/env python3 def main(): # import python's standard math module and numpy import math, numpy, sys # import Controller and other blocks from modules from pyctrl.timer import Controller from pyctrl.block import Interp, Logger, Constant from pyctrl.block.system import System, Diffe...
apache-2.0
georgid/SourceFilterContoursMelody
smstools/software/transformations_interface/hpsMorph_function.py
24
7354
# function for doing a morph between two sounds using the hpsModel 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(os.path.realpath...
gpl-3.0
pearsonlab/nipype
doc/conf.py
6
8363
# emacs: -*- coding: utf-8; mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set fileencoding=utf-8 ft=python sts=4 ts=4 sw=4 et: # # nipype documentation build configuration file, created by # sphinx-quickstart on Mon Jul 20 12:30:18 2009. # # This file is execfile()d with the current directory set t...
bsd-3-clause
initNirvana/Easyphotos
env/lib/python3.4/site-packages/IPython/config/loader.py
4
29399
# encoding: utf-8 """A simple configuration system.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import argparse import copy import logging import os import re import sys import json from ast import literal_eval from IPython.utils.path import filefind, get_i...
mit
Nikea/scikit-xray
doc/sphinxext/plot_generator.py
8
10150
""" Sphinx plugin to run example scripts and create a gallery page. Taken from seaborn project, which is turn was lightly modified from the mpld3 project. """ from __future__ import division import os import os.path as op import re import glob import token import tokenize import shutil import json import matplotlib ...
bsd-3-clause
neogis-de/PPPP_utilities
pointcloud/patch_to_raster.py
2
8028
# -*- coding: utf-8 -*- """ Created on Fri Jan 23 16:38:01 2015 @author: remi """ import pg_pointcloud_classes as pc reload(pc) def translatePointArray(pt_arr, schema, pixel_size): """this function simply extract X,Y,Z and translate x and y and compute and allocate pixel array""" import numpy as np import...
lgpl-3.0
olinguyen/shogun
examples/undocumented/python/graphical/interactive_clustering_demo.py
5
11271
""" Shogun demo, based on PyQT Demo by Eli Bendersky Christian Widmer Soeren Sonnenburg License: GPLv3 """ import numpy import sys, os, csv from PyQt4.QtCore import * from PyQt4.QtGui import * import matplotlib from matplotlib.colorbar import make_axes, Colorbar from matplotlib.backends.backend_qt4agg import FigureCa...
gpl-3.0
domagalski/pocketcorr
scripts/pocketcorr_adc.py
1
9505
#!/usr/bin/env python2 ################################################################################ ## This script is for simple ADC caputer to test the a pocket correlator. ## Copyright (C) 2014 Rachel Simone Domagalski: domagalski@berkeley.edu ## ## This program is free software: you can redistribute it and/or ...
gpl-3.0