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 |
|---|---|---|---|---|---|
elkingtonmcb/bcbio-nextgen | bcbio/rnaseq/stringtie.py | 6 | 3037 | """
implements support for StringTie, intended to be a drop in replacement for
Cufflinks
http://ccb.jhu.edu/software/stringtie/
http://www.nature.com/nbt/journal/v33/n3/full/nbt.3122.html
manual: http://ccb.jhu.edu/software/stringtie/#contact
"""
import os
import pandas as pd
from bcbio.provenance import do
from bcbio... | mit |
ctb/cvxpy | examples/floor_packing.py | 11 | 3788 | from cvxpy import *
import pylab
import math
# Based on http://cvxopt.org/examples/book/floorplan.html
class Box(object):
""" A box in a floor packing problem. """
ASPECT_RATIO = 5.0
def __init__(self, min_area):
self.min_area = min_area
self.height = Variable()
self.width = Variabl... | gpl-3.0 |
shyamalschandra/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 |
anntzer/scikit-learn | sklearn/linear_model/_bayes.py | 8 | 26095 | """
Various bayesian regression
"""
# Authors: V. Michel, F. Pedregosa, A. Gramfort
# License: BSD 3 clause
from math import log
import numpy as np
from scipy import linalg
from ._base import LinearModel, _rescale_data
from ..base import RegressorMixin
from ..utils.extmath import fast_logdet
from scipy.linalg import... | bsd-3-clause |
altair-viz/altair | altair/vega/data.py | 1 | 1024 | import pandas as pd
from toolz import curried
from ..utils.core import sanitize_dataframe
from ..utils.data import (
MaxRowsError,
curry,
pipe,
sample,
to_csv,
to_json,
to_values,
check_data_type,
)
@curried.curry
def limit_rows(data, max_rows=5000):
"""Raise MaxRowsError if the da... | bsd-3-clause |
dnjohnstone/hyperspy | hyperspy/drawing/_widgets/label.py | 4 | 3759 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | gpl-3.0 |
kou/arrow | python/benchmarks/streaming.py | 10 | 2540 | # 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 |
nelango/ViralityAnalysis | model/lib/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')
... | mit |
ldirer/scikit-learn | benchmarks/bench_plot_nmf.py | 8 | 15618 | """
Benchmarks of Non-Negative Matrix Factorization
"""
# Authors: Tom Dupre la Tour (benchmark)
# Chih-Jen Linn (original projected gradient NMF implementation)
# Anthony Di Franco (projected gradient, Python and NumPy port)
# License: BSD 3 clause
from __future__ import print_function
from time imp... | bsd-3-clause |
kdebrab/pandas | pandas/core/tools/timedeltas.py | 1 | 6228 | """
timedelta support tools
"""
import numpy as np
import pandas as pd
from pandas._libs import tslibs
from pandas._libs.tslibs.timedeltas import (convert_to_timedelta64,
array_to_timedelta64)
from pandas.core.dtypes.common import (
ensure_object,
is_integer_dtype,
... | bsd-3-clause |
etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_mplconfig.py | 3 | 1498 | #-----------------------------------------------------------------------------
# Copyright (c) 2013-2020, PyInstaller Development Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# The full license is in the file COPYING.txt, ... | gpl-3.0 |
mfilippo/CitationExtractor | tests/test_eval.py | 1 | 5356 | # -*- coding: utf-8 -*-
# author: Matteo Romanello, matteo.romanello@gmail.com
import pdb
import pandas as pd
import pkg_resources
import pytest
from pytest import fixture
import pickle
import logging
import codecs
import parmap
import traceback
import multiprocessing as mp
import citation_extractor
from tabulate impo... | gpl-3.0 |
madjelan/scikit-learn | examples/tree/plot_tree_regression.py | 206 | 1476 | """
===================================================================
Decision Tree Regression
===================================================================
A 1D regression with decision tree.
The :ref:`decision trees <tree>` is
used to fit a sine curve with addition noisy observation. As a result, it
learns ... | bsd-3-clause |
cbertinato/pandas | pandas/tests/io/msgpack/test_limits.py | 1 | 3004 | # coding: utf-8
import pytest
from pandas.io.msgpack import ExtType, Packer, Unpacker, packb, unpackb
class TestLimits:
def test_integer(self):
x = -(2 ** 63)
assert unpackb(packb(x)) == x
msg = (r"((long |Python )?(int )?too (big|large) to convert"
r"( to C (unsigned )?lo... | bsd-3-clause |
Barmaley-exe/scikit-learn | sklearn/metrics/ranking.py | 8 | 21775 | """Metrics to assess performance on classification task given scores
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.... | bsd-3-clause |
fabianp/scikit-learn | sklearn/utils/graph.py | 289 | 6239 | """
Graph utilities and algorithms
Graphs are represented with their adjacency matrices, preferably using
sparse matrices.
"""
# Authors: Aric Hagberg <hagberg@lanl.gov>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Jake Vanderplas <vanderplas@astro.washington.edu>
# License: BSD 3 clause
impo... | bsd-3-clause |
Obus/scikit-learn | sklearn/linear_model/tests/test_perceptron.py | 378 | 1815 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_raises
from sklearn.utils import check_random_state
from sklearn.datasets import load_iris
from sklearn.linear_model import Pe... | bsd-3-clause |
amozie/amozie | studzie/tensorforce_test/mountain_car_v0.py | 1 | 2094 | import numpy as np
import time
import matplotlib.pyplot as plt
from tensorforce.agents import PPOAgent
from tensorforce.execution import Runner
from tensorforce.contrib.openai_gym import OpenAIGym
env = OpenAIGym('MountainCar-v0', visualize=False)
network_spec = [
dict(type='dense', size=16, activation='relu'),
... | apache-2.0 |
neale/softmax | softmax_regression.py | 1 | 7400 | #!/usr/bin/env python
import sys
import time
import numpy as np
import random
import matplotlib.pyplot as plt
from collections import defaultdict
cost = 0.0
lrate = .1
grad = np.array([])
lambda_factor = 0.0
nclasses = 2
def vector_to_collumn(vec):
length = len(vec)
A = np.array(vec)
for i in range(lengt... | unlicense |
larsmans/scipy | scipy/interpolate/fitpack.py | 25 | 46138 | #!/usr/bin/env python
"""
fitpack (dierckx in netlib) --- A Python-C wrapper to FITPACK (by P. Dierckx).
FITPACK is a collection of FORTRAN programs for curve and surface
fitting with splines and tensor product splines.
See
http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html
... | bsd-3-clause |
poryfly/scikit-learn | sklearn/svm/tests/test_sparse.py | 32 | 12988 | from nose.tools import assert_raises, assert_true, assert_false
import numpy as np
from scipy import sparse
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
from sklearn import datasets, svm, linear_model, base
from sklearn.datasets import make_classif... | bsd-3-clause |
olologin/scikit-learn | examples/neural_networks/plot_rbm_logistic_classification.py | 99 | 4608 | """
==============================================================
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 |
r-mart/scikit-learn | examples/semi_supervised/plot_label_propagation_digits_active_learning.py | 294 | 3417 | """
========================================
Label Propagation digits active learning
========================================
Demonstrates an active learning technique to learn handwritten digits
using label propagation.
We start by training a label propagation model with only 10 labeled points,
then we select the t... | bsd-3-clause |
ehogan/iris | lib/iris/tests/unit/plot/test_contourf.py | 11 | 3169 | # (C) British Crown Copyright 2014 - 2016, Met Office
#
# This file is part of Iris.
#
# Iris 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 of the License, or
# (at your option) any l... | lgpl-3.0 |
jenshnielsen/basemap | examples/testwmsimage.py | 1 | 2467 | """
example showing how to use OWSlib to retrieve an image
from a WMS server and display it on a map (using the
wmsimage convenience method)
"""
from mpl_toolkits.basemap import Basemap
import pyproj
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
serverurl='http://motherlode.ucar.edu... | gpl-2.0 |
adamgreenhall/scikit-learn | sklearn/calibration.py | 137 | 18876 | """Calibration of predicted probabilities."""
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Balazs Kegl <balazs.kegl@gmail.com>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# Mathieu Blondel <mathieu@mblondel.org>
#
# License: BSD 3 clause
from __future__ impo... | bsd-3-clause |
ibis-project/ibis | ibis/backends/pandas/execution/generic.py | 1 | 35994 | """Execution rules for generic ibis operations."""
import collections
import datetime
import decimal
import functools
import math
import numbers
import operator
from collections.abc import Sized
from typing import Optional
import numpy as np
import pandas as pd
import toolz
from pandas.api.types import DatetimeTZDtyp... | apache-2.0 |
LernerLabs/PyPAT | drivers/make_correlated_dynamics_plots.py | 1 | 5185 | #!/cluster/home2/mglerner/anaconda3/bin/python
#!/usr/bin/env python
'''
make all of our correl and covar plots with scipy.
'''
import sys,os
if __name__ == '__main__':
from pypat.plotting import make_correl_plots_for_movie
from pypat import tool_utils
from optparse import OptionParser
import pylab
... | apache-2.0 |
mcneela/Retina | retina/nldr/sammon.py | 1 | 1676 | import numpy as np
from sklearn.datasets import make_swiss_roll
from sklearn.metrics.pairwise import euclidean_distances
def sammon(data, target_dim=2, max_iterations=250, max_halves=10):
"""
Adopted from the Matlab implementation by Dr. Gavin C. Cawley.
Matlab source can be found here:
https://p... | bsd-3-clause |
zasdfgbnm/tensorflow | tensorflow/contrib/learn/python/learn/estimators/estimator.py | 3 | 61426 | # 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 |
maweigert/spimagine | tests/test_utils/test_alpha_shape.py | 1 | 2067 | """
mweigert@mpi-cbg.de
"""
from __future__ import absolute_import
import numpy as np
from spimagine import volfig, Mesh, qt_exec
from spimagine.utils import alpha_shape
import matplotlib
matplotlib.use("Qt5Agg")
def test_2d():
import matplotlib.pyplot as plt
plt.ion()
np.random.seed(0)
N = 500
... | bsd-3-clause |
miltonlab/course-python-datascience-ms | DAT210x/Module4/assignment4.py | 3 | 2274 | import pandas as pd
import numpy as np
import scipy.io
import random, math
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def Plot2D(T, title, x, y, num_to_plot=40):
# This method picks a bunch of random samples (images in your case)
# to plot onto the chart:
fig = plt.figure()
ax = f... | apache-2.0 |
DanHickstein/pyBASEX | examples/example_linbasex.py | 2 | 3486 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import abel
import os
import bz2
import matplotlib.pylab as plt
# This example demonstrates ``linbasex`` inverse Abel transform
# of a velocity-map image of photoel... | gpl-2.0 |
mwaskom/lyman | lyman/workflows/template.py | 1 | 15583 | import os.path as op
import numpy as np
import pandas as pd
from scipy import ndimage
import matplotlib as mpl
import nibabel as nib
from nipype import Workflow, Node, JoinNode, IdentityInterface, DataSink
from nipype.interfaces.base import traits, TraitedSpec
from nipype.interfaces import fsl, freesurfer as fs
from... | bsd-3-clause |
mrlb05/Nifty4Gemini | nifty/pipeline/steps/routines/nifsMakeTelluric.py | 4 | 13051 | import sys, glob, shutil, getopt, os, time, logging, glob, sgmllib, urllib, re, traceback, pkg_resources
import pexpect as p
from pyraf import iraf, iraffunctions
import astropy.io.fits
from astropy.io.fits import getdata, getheader
import numpy as np
from scipy.interpolate import interp1d
from scipy import arange, arr... | mit |
gallantlab/pycortex | cortex/svgoverlay.py | 1 | 35417 | import os
import re
import copy
import shlex
import tempfile
import itertools
import numpy as np
import subprocess as sp
from matplotlib.path import Path
from scipy.spatial import cKDTree
from builtins import zip, str
from distutils.version import LooseVersion
from lxml import etree
from lxml.builder import E
from ... | bsd-2-clause |
simon-pepin/scikit-learn | sklearn/grid_search.py | 103 | 36232 | """
The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters
of an estimator.
"""
from __future__ import print_function
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# ... | bsd-3-clause |
xcgoner/dist-mxnet | example/kaggle-ndsb1/training_curves.py | 52 | 1879 | # 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 |
sfletc/scram2_plot | scram_plot/compare_plot.py | 1 | 7867 | from pylab import * # @UnusedWildImport
import matplotlib.pyplot as plt # @Reimport
from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.io import output_notebook
from bokeh.models import HoverTool
from collections import OrderedDict
import csv
import profile_plot as pp
import math
import... | mit |
alexhenrie/poedit | deps/boost/libs/numeric/odeint/performance/plot_result.py | 43 | 2225 | """
Copyright 2011-2014 Mario Mulansky
Copyright 2011-2014 Karsten Ahnert
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
"""
import numpy as np
from matplotlib import pyplot as plt
plt.rc("font", size=16)
def g... | mit |
ahoyosid/scikit-learn | examples/mixture/plot_gmm_sin.py | 248 | 2747 | """
=================================
Gaussian Mixture Model Sine Curve
=================================
This example highlights the advantages of the Dirichlet Process:
complexity control and dealing with sparse data. The dataset is formed
by 100 points loosely spaced following a noisy sine curve. The fit by
the GMM... | bsd-3-clause |
liberorbis/libernext | env/lib/python2.7/site-packages/IPython/kernel/zmq/pylab/backend_inline.py | 8 | 5498 | """A matplotlib backend for publishing figures via display_data"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part ... | gpl-2.0 |
quadflor/Quadflor | Code/lucid_ml/utils/metrics.py | 1 | 2971 | from functools import partial
from warnings import warn
import networkx as nx
import numpy as np
import scipy.sparse as sp
from scipy.sparse.sputils import isdense
from sklearn.metrics import make_scorer
from sklearn.exceptions import UndefinedMetricWarning
from sklearn.utils.sparsefuncs import count_nonzero
def hie... | bsd-3-clause |
astropy/photutils | photutils/aperture/ellipse.py | 2 | 20572 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module defines elliptical and elliptical-annulus apertures in both
pixel and sky coordinates.
"""
import math
import astropy.units as u
import numpy as np
from .attributes import (AngleOrPixelScalarQuantity, AngleScalarQuantity,
... | bsd-3-clause |
alexmojaki/birdseye | tests/test_utils.py | 1 | 4250 | # coding=utf8
import ast
import unittest
from tempfile import mkstemp
import asttokens
import numpy as np
import pandas as pd
from cheap_repr import cheap_repr
from birdseye.utils import common_ancestor, short_path, flatten_list, is_lambda, source_without_decorators, PY3, \
read_source_file
def def_decorator(_... | mit |
bhargav/scikit-learn | build_tools/cythonize.py | 42 | 6375 | #!/usr/bin/env python
""" cythonize
Cythonize pyx files into C files as needed.
Usage: cythonize [root_dir]
Default [root_dir] is 'sklearn'.
Checks pyx files to see if they have been changed relative to their
corresponding C files. If they have, then runs cython on these files to
recreate the C files.
The script ... | bsd-3-clause |
rexshihaoren/scikit-learn | sklearn/metrics/cluster/__init__.py | 312 | 1322 | """
The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for
cluster analysis results. There are two forms of evaluation:
- supervised, which uses a ground truth class values for each sample.
- unsupervised, which does not and measures the 'quality' of the model itself.
"""
from .supervised import ... | bsd-3-clause |
CforED/Machine-Learning | examples/svm/plot_svm_kernels.py | 329 | 1971 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
SVM-Kernels
=========================================================
Three different types of SVM-Kernels are displayed below.
The polynomial and RBF are especially useful when the
data-points are not linearly sep... | bsd-3-clause |
CELMA-project/CELMA | celma/pickleTweaks/BScan/BScanBlobsPerTimeUnit.py | 1 | 3408 | #!/usr/bin/env python
"""
Gives blobs per unit time for the B-Scan.
"""
import pickle
import matplotlib.pylab as plt
import numpy as np
import os, sys
# If we add to sys.path, then it must be an absolute path
commonDir = os.path.abspath("./../../../common")
# Sys path is a list of system paths
sys.path.append(common... | lgpl-3.0 |
nikitasingh981/scikit-learn | sklearn/utils/tests/test_validation.py | 12 | 20989 | """Tests for input validation functions"""
import warnings
from tempfile import NamedTemporaryFile
from itertools import product
import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from sklearn.utils.testing import assert_true, assert_false, assert_equal
from sklearn.utils.test... | bsd-3-clause |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/sklearn/linear_model/tests/test_base.py | 33 | 17862 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from scipy import linalg
from itertools import product
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils... | mit |
nicain/dipde_dev | dipde/test/test_examples.py | 1 | 2516 | import numpy as np
import matplotlib
import logging
logging.disable(logging.CRITICAL)
matplotlib.use('Agg')
def test_singlepop():
from dipde.examples.singlepop import example
t, y = example(show=False)
np.testing.assert_almost_equal(t[5], .0005)
np.testing.assert_almost_equal(y[5], 0.0003809700362359... | gpl-3.0 |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/colors.py | 2 | 45775 | """
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... | mit |
HyukjinKwon/spark | python/pyspark/pandas/tests/test_utils.py | 15 | 3850 | #
# 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 |
kagayakidan/scikit-learn | sklearn/preprocessing/label.py | 137 | 27165 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
liberatorqjw/scikit-learn | sklearn/utils/tests/test_utils.py | 23 | 6045 | import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import pinv2
from sklearn.utils.testing import (assert_equal, assert_raises, assert_true,
assert_almost_equal, assert_array_equal,
SkipTest)
from sklearn.utils import c... | bsd-3-clause |
lilleswing/deepchem | examples/nci/nci_rf.py | 4 | 1591 | """
Script that trains Sklearn multitask models on nci dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import numpy as np
import shutil
from deepchem.molnet import load_nci
from sklearn.linear_model import LogisticRegression
from skle... | mit |
Ziqi-Li/bknqgis | pandas/pandas/core/missing.py | 2 | 22886 | """
Routines for filling missing data
"""
import numpy as np
from distutils.version import LooseVersion
from pandas._libs import algos, lib
from pandas.compat import range, string_types
from pandas.core.dtypes.common import (
is_numeric_v_string_like,
is_float_dtype,
is_datetime64_dtype,
is_datetime6... | gpl-2.0 |
mapattacker/cheatsheets | python/pandas.py | 1 | 29513 | import pandas as pd
## READ & WRITE
# Pickle
df = pd.read_pickle('psi.pickle')
df.to_pickle('normal.pkl')
# CSV
df = pd.read_csv('shenzhen_processed.csv', low_memory=False)
df = pd.read_csv('olympics.csv', index_col=0, skiprows=1) #take 1st col as index, and remove 1st row
df.to_csv('shenzhen_proces... | mit |
macks22/scikit-learn | sklearn/feature_selection/variance_threshold.py | 238 | 2594 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: 3-clause BSD
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstim... | bsd-3-clause |
pmelchior/skymapper | setup.py | 1 | 1057 | from setuptools import setup
long_description = open('README.md').read()
setup(
name="skymapper",
description="Mapping astronomical survey data on the sky, handsomely",
long_description=long_description,
long_description_content_type='text/markdown',
version="0.4.2",
license="MIT",
author=... | mit |
rbharath/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 |
0asa/spylearn | test/test_linear_model.py | 3 | 1868 | import numpy as np
from sklearn.linear_model import SGDClassifier
from spylearn.linear_model import parallel_train
from spylearn.block_rdd import block_rdd
from common import SpylearnTestCase
from nose.tools import assert_greater
from nose import SkipTest
from numpy.testing import assert_array_almost_equal
class ... | bsd-3-clause |
bajorekp/ForexPredictor | Convert_articles.py | 1 | 2536 |
# coding: utf-8
# In[132]:
# import libs
import json
import pandas as pd
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.pyplot as plt
get_ipython().magic('matplotlib inline')
import urllib.request # for HTTP requests (web scraping, APIs)
from datetime import datetime, timedelta
im... | mit |
simongibbons/numpy | numpy/doc/structured_arrays.py | 5 | 26444 | """
=================
Structured Arrays
=================
Introduction
============
Structured arrays are ndarrays whose datatype is a composition of simpler
datatypes organized as a sequence of named :term:`fields <field>`. For example,
::
>>> x = np.array([('Rex', 9, 81.0), ('Fido', 3, 27.0)],
... d... | bsd-3-clause |
agiovann/Constrained_NMF | use_cases/granule_cells/powell_graph.py | 2 | 7733 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 7 13:44:32 2016
@author: agiovann
"""
from __future__ import division
from __future__ import print_function
#%%
from builtins import str
from builtins import range
from past.utils import old_div
get_ipython().magic('load_ext autoreload')
get_ipyt... | gpl-2.0 |
Lightmatter/django-inlineformfield | .tox/py27/lib/python2.7/site-packages/IPython/core/tests/test_display.py | 7 | 4452 | #-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team.
#
# Distributed under the terms of the BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------------------------------------... | mit |
phaustin/pythermo | code/thermlib/convecSkew.py | 1 | 4624 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from constants import constants as c
from new_thermo import convertSkewToTemp,convertTempToSkew,theta,wsat,thetaes
def convecSkew(figNum):
"""
Usage: convecSkew(figNum)
Input: figNum = integer
Takes any integ... | mit |
shoyer/xray | xarray/core/formatting.py | 2 | 19481 | """String formatting routines for __repr__.
"""
import contextlib
import functools
from datetime import datetime, timedelta
from itertools import zip_longest
import numpy as np
import pandas as pd
from .duck_array_ops import array_equiv
from .options import OPTIONS
from .pycompat import dask_array_type
try:
from... | apache-2.0 |
chrsrds/scikit-learn | examples/plot_changed_only_pprint_parameter.py | 7 | 1032 | """
=================================
Compact estimator representations
=================================
This example illustrates the use of the print_changed_only global parameter.
Setting print_changed_only to True will alterate the representation of
estimators to only show the parameters that have been set to non... | bsd-3-clause |
ndingwall/scikit-learn | sklearn/mixture/_gaussian_mixture.py | 9 | 28270 | """Gaussian Mixture Model."""
# Author: Wei Xue <xuewei4d@gmail.com>
# Modified by Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import numpy as np
from scipy import linalg
from ._base import BaseMixture, _check_shape
from ..utils import check_array
from ..utils.extmath import row_nor... | bsd-3-clause |
platinhom/ManualHom | Coding/Python/scipy-html-0.16.1/generated/scipy-stats-ncf-1.py | 1 | 1149 | from scipy.stats import ncf
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
# Calculate a few first moments:
dfn, dfd, nc = 27, 27, 0.416
mean, var, skew, kurt = ncf.stats(dfn, dfd, nc, moments='mvsk')
# Display the probability density function (``pdf``):
x = np.linspace(ncf.ppf(0.01, dfn, dfd, nc),
... | gpl-2.0 |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/pandas/core/panelnd.py | 14 | 4605 | """ Factory methods to create N-D panels """
import warnings
from pandas.compat import zip
import pandas.compat as compat
def create_nd_panel_factory(klass_name, orders, slices, slicer, aliases=None,
stat_axis=2, info_axis=0, ns=None):
""" manufacture a n-d class:
DEPRECATED. Pan... | gpl-3.0 |
OpenSourcePolicyCenter/PolicyBrain | webapp/apps/btax/views.py | 2 | 17171 | import json
import traceback
import sys
import btax
import taxcalc
import datetime
from django.utils import timezone
import logging
from os import path
from urllib.parse import urlparse, parse_qs
from ipware.ip import get_real_ip
from django.core import serializers
from django.http import Http404, HttpResponse, JsonR... | mit |
luo66/scikit-learn | examples/classification/plot_classifier_comparison.py | 181 | 4699 | #!/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 |
mraspaud/dask | dask/dataframe/tests/test_format.py | 1 | 12894 | # coding: utf-8
import pandas as pd
import dask.dataframe as dd
from dask.dataframe.utils import PANDAS_VERSION
if PANDAS_VERSION >= '0.20.0':
style = """<style>
.dataframe thead tr:only-child th {
text-align: right;
}
.dataframe thead th {
text-align: left;
}
.dataframe tbod... | bsd-3-clause |
NunoEdgarGub1/scikit-learn | benchmarks/bench_sample_without_replacement.py | 397 | 8008 | """
Benchmarks for sampling without replacement of integer.
"""
from __future__ import division
from __future__ import print_function
import gc
import sys
import optparse
from datetime import datetime
import operator
import matplotlib.pyplot as plt
import numpy as np
import random
from sklearn.externals.six.moves i... | bsd-3-clause |
uglyboxer/linear_neuron | net-p3/lib/python3.5/site-packages/matplotlib/offsetbox.py | 11 | 53384 | """
The OffsetBox is a simple container artist. The child artist are meant
to be drawn at a relative position to its parent. The [VH]Packer,
DrawingArea and TextArea are derived from the OffsetBox.
The [VH]Packer automatically adjust the relative postisions of their
children, which should be instances of the OffsetBo... | mit |
jat255/hyperspy | hyperspy/learn/mva.py | 1 | 115818 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | gpl-3.0 |
frank10704/DF_GCS_W | MissionPlanner-master/Lib/site-packages/numpy/core/function_base.py | 82 | 5474 | __all__ = ['logspace', 'linspace']
import numeric as _nx
from numeric import array
def linspace(start, stop, num=50, endpoint=True, retstep=False):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop` ].
Th... | gpl-3.0 |
tomgade09/geoplasmasim | python/SimulationClass/__plotParticles.py | 1 | 7412 | import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import os, sys
import csv
import struct
def plotXY(xdata, ydata, title, xlabel, ylabel, filename, showplot=False):
plt.plot(xdata, ydata, '.')
plt.title(title)
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.savefig(filename)
if showplot... | gpl-3.0 |
lpenguin/pandas-qt | tests/test_CustomDelegates.py | 4 | 5543 | # -*- coding: utf-8 -*-
from pandasqt.compat import Qt, QtCore, QtGui
import pytest
import pytestqt
import numpy
import pandas
from pandasqt.views.CustomDelegates import BigIntSpinboxDelegate, CustomDoubleSpinboxDelegate, TextDelegate, createDelegate
from pandasqt.models.DataFrameModel import DataFrameModel
class... | mit |
neuropsychology/Neuropsydia.py | neuropsydia/meta.py | 1 | 13610 | # -*- coding: utf-8 -*-
import neurokit as nk
import pandas as pd
import datetime
import random
from .path import *
from .core import *
from .write import *
from .image import *
from .start import *
from .scale import *
from .ask import *
from .data import *
# ========================================================... | mpl-2.0 |
elijah513/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 221 | 2702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
andrewnc/scikit-learn | examples/linear_model/plot_iris_logistic.py | 283 | 1678 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Logistic Regression 3-class Classifier
=========================================================
Show below is a logistic-regression classifiers decision boundaries on the
`iris <http://en.wikipedia.org/wiki/Iris_f... | bsd-3-clause |
GrahamDennis/xpdeint | xpdeint/xsil2graphicsParser.py | 1 | 5648 | #!/usr/bin/env python
# encoding: utf-8
"""
xsil2graphicsParser.py
Created by Joe Hope on 2009-01-06.
Modified by Thomas Antioch on 2013-07-18.
Copyright (c) 2009-2012, Joe Hope
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
t... | gpl-2.0 |
toobaz/pandas | pandas/tests/indexes/datetimes/test_astype.py | 2 | 13620 | from datetime import datetime
import dateutil
from dateutil.tz import tzlocal
import numpy as np
import pytest
import pytz
import pandas as pd
from pandas import (
DatetimeIndex,
Index,
Int64Index,
NaT,
Period,
Series,
Timestamp,
date_range,
)
import pandas.util.testing as tm
class T... | bsd-3-clause |
kmather73/pymc3 | pymc3/diagnostics.py | 6 | 8229 | """Convergence diagnostics and model validation"""
import numpy as np
from .stats import autocorr, autocov, statfunc
from copy import copy
__all__ = ['geweke', 'gelman_rubin', 'trace_to_dataframe', 'effective_n']
@statfunc
def geweke(x, first=.1, last=.5, intervals=20):
"""Return z-scores for convergence diagno... | apache-2.0 |
HPAC/TTC | ttc/generatePlots.py | 1 | 9103 |
import sys
import os
import sqlite3
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import math
OKGREEN = '\033[92m'
FAIL = '\033[91m'
WARNING = '\033[93m'
ENDC = '\033[0m'
database = "ttc.db"
_host = "linuxihdc077_knc"
_constraint = """
floatType = 'float'
... | gpl-3.0 |
kose-y/pylearn2 | pylearn2/train_extensions/roc_auc.py | 30 | 4854 | """
TrainExtension subclass for calculating ROC AUC scores on monitoring
dataset(s), reported via monitor channels.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
try:
from sklearn.metrics import roc_auc_score
except ImportEr... | bsd-3-clause |
tomlof/scikit-learn | sklearn/utils/sparsetools/tests/test_traversal.py | 38 | 2018 | from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.testing import SkipTest
try:
from scipy.sparse.csgraph import breadth_first_tree, depth_first_tree,\
csgraph_to_dense, csgraph_from_dense
except Import... | bsd-3-clause |
gitFuKaiqun/WordCloud | wordcloud.py | 1 | 6423 | # Author: Andreas Christian Mueller <amueller@ais.uni-bonn.de>
# (c) 2012
#
# License: MIT
import random
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import numpy as np
from query_integral_image import query_integral_image
FONT_PATH = "/usr/share/fonts/truetype/freefont/FreeSerifBold.tt... | mit |
zedoul/blog | inst/2018-01-25-linear-regression/reg.py | 1 | 2411 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from edward.models import Normal
plt.style.use('ggplot')
def build_toy_dataset(N, w):
D = len(w)
x = np.... | mit |
holygits/incubator-airflow | tests/contrib/hooks/test_bigquery_hook.py | 16 | 8098 | # -*- 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 |
shafiquejamal/easyframes | easyframes/test/test_statamerge.py | 1 | 4184 | import unittest
import pandas as pd
from pandas.util.testing import assert_series_equal
import numpy as np
from easyframes.easyframes import hhkit
class TestStataMerge(unittest.TestCase):
def setUp(self):
"""
df_original = pd.read_csv('sample_hh_dataset.csv')
df = df_original.copy()
print(df.to_dict())
... | apache-2.0 |
srcole/fxml | scraper/format_fxdata.py | 1 | 4798 | """Format the data extracted in scrape_forexite.py
NOTE: only currency pairs present in the first data file will be collected"""
import numpy as np
import scipy as sp
from scipy import signal
import h5py
def interpfx(time,fx,time_pre):
"""
Because I didn't know pandas library was a thing.
"""
opens = ... | mit |
shivupa/pyci | plots/plotoverlap.py | 1 | 1475 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
xvec = np.loadtxt('ACI_plot1.txt')
ACI = np.loadtxt('ACI_plot2.txt')
ASCI = np.loadtxt('ASCI_plot2.txt')
FCI = np.loadtxt('FCI_plot2.txt')
CISD = np.loadtxt('CISD_plot2.txt')
HBCI = np.loadtxt('HBCI_plot2.txt')
plt.rc('font', famil... | gpl-3.0 |
rfinn/LCS | python/LCS_MS_rf_plots.py | 1 | 19236 | #!/usr/bin/env python
###########################
###### IMPORT MODULES
###########################
import LCSbase as lb
from matplotlib import pyplot as plt
import numpy as np
import os
from LCScommon import *
from astropy.io import fits
from astropy.cosmology import WMAP9 as cosmo
from scipy.optimize import curve_f... | gpl-3.0 |
YuepengGuo/zipline | zipline/utils/tradingcalendar_bmf.py | 17 | 7576 | #
# 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 |
alphaBenj/zipline | tests/calendars/test_cme_calendar.py | 6 | 1441 | from unittest import TestCase
import pandas as pd
from .test_trading_calendar import ExchangeCalendarTestBase
from zipline.utils.calendars.exchange_calendar_cme import CMEExchangeCalendar
class CMECalendarTestCase(ExchangeCalendarTestBase, TestCase):
answer_key_filename = "cme"
calendar_class = CMEExchangeCa... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.