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 |
|---|---|---|---|---|---|
jdominiczak/FantasyFootballAnalytics | FFToday.py | 1 | 9402 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 8 12:57:54 2015
@author: jdomini6
"""
from bs4 import BeautifulSoup
from urllib2 import urlopen
import pandas as pd
BASE_URL = "http://www.fftoday.com"
def getQBProjections(week="season"):
if week == "season":
r = urlopen("http://www.fftoday.com/ranki... | gpl-2.0 |
chenyyx/scikit-learn-doc-zh | examples/en/model_selection/plot_learning_curve.py | 76 | 4509 | """
========================
Plotting Learning Curves
========================
On the left side the learning curve of a naive Bayes classifier is shown for
the digits dataset. Note that the training score and the cross-validation score
are both not very good at the end. However, the shape of the curve can be found
in ... | gpl-3.0 |
MiniPlayer/log-island | logisland-plugins/logisland-scripting-processors-plugin/src/main/resources/nltk/parse/dependencygraph.py | 7 | 31002 | # Natural Language Toolkit: Dependency Grammars
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Jason Narad <jason.narad@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (modifications)
#
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
#
"""
Tools for reading and writing dependency tree... | apache-2.0 |
zuku1985/scikit-learn | sklearn/datasets/__init__.py | 5 | 3683 | """
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 |
wkfwkf/statsmodels | statsmodels/graphics/tests/test_tsaplots.py | 9 | 2392 | from statsmodels.compat.python import lmap, lzip, map
import numpy as np
import pandas as pd
from numpy.testing import dec
import statsmodels.api as sm
from statsmodels.graphics.tsaplots import plot_acf, month_plot, quarter_plot
import statsmodels.tsa.arima_process as tsp
try:
import matplotlib.pyplot as plt
... | bsd-3-clause |
jjs0sbw/CSPLN | apps/scaffolding/mac/web2py/web2py.app/Contents/Resources/lib/python2.7/numpy/lib/polynomial.py | 23 | 35949 | """
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 |
beepee14/scikit-learn | sklearn/neighbors/tests/test_ball_tree.py | 159 | 10196 | import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap,
simultaneous_sort, kernel_norm,
nodeheap_sort, DTYPE, ITYPE)
from sklearn.neighbors.dis... | bsd-3-clause |
deepmind/spectral_inference_networks | spectral_inference_networks/src/spin.py | 1 | 21802 | # Copyright 2018-2019 DeepMind Technologies Limited and Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | apache-2.0 |
joernhees/scikit-learn | examples/plot_multilabel.py | 236 | 4157 | # Authors: Vlad Niculae, Mathieu Blondel
# License: BSD 3 clause
"""
=========================
Multilabel classification
=========================
This example simulates a multi-label document classification problem. The
dataset is generated randomly based on the following process:
- pick the number of labels: n ... | bsd-3-clause |
suryakant54321/basicDataPrep | extractArray.py | 1 | 3617 | #-----------------------------------------------------
# Ref YATSM :https://github.com/ceholden/yatsm
# ----------------------------------------------------
# Script Name: extractArray.py
# Author: Suryakant Sawant (suryakant54321@gmail.com)
# Date: 20 August 2015
# This script helps to extract data from cache of YATSM... | gpl-2.0 |
toddheitmann/PetroPy | petropy/graphs.py | 1 | 40521 | # -*- coding: utf-8 -*-
"""
Graphs is a simple log viewer using matplotlib to create tracks of log
data. Allows graphically editing curve data through manual changes and
bulk shifting.
"""
import os
import gc
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import xml.etree.E... | mit |
harisbal/pandas | pandas/compat/numpy/__init__.py | 4 | 1982 | """ support numpy compatiblitiy across versions """
import re
import numpy as np
from distutils.version import LooseVersion
from pandas.compat import string_types, string_and_binary_types
# numpy versioning
_np_version = np.__version__
_nlv = LooseVersion(_np_version)
_np_version_under1p13 = _nlv < LooseVersion('1.1... | bsd-3-clause |
rjferrier/fluidity | examples/hokkaido-nansei-oki_tsunami/raw_data/plotbathymetry.py | 5 | 3538 | #!/usr/bin/env python
import matplotlib as m
import matplotlib.pyplot as plt
from matplotlib.mlab import griddata
import numpy as np
import sys
import pdb
import os
import random
def file_len(full_path):
""" Count number of lines in a file."""
f = open(full_path)
nr_of_lines = sum(1 for line in... | lgpl-2.1 |
altairpearl/scikit-learn | sklearn/utils/tests/test_murmurhash.py | 65 | 2838 | # Author: Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import numpy as np
from sklearn.externals.six import b, u
from sklearn.utils.murmurhash import murmurhash3_32
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from nose.tools import assert_equa... | bsd-3-clause |
willsirius/DualTreeRRTStartMotionPlanning | python/userdefined.py | 2 | 9319 | import time
import openravepy
import sys
import numpy as np
from numpy import sin,cos
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
# import random
import transformationFunction as tf
import kdtree
import scipy.spatial as spatial
# def
def getpath(tree,goal):
# get the path from a RRT t... | mit |
Ziqi-Li/bknqgis | pandas/pandas/io/pickle.py | 2 | 4325 | """ pickle compat """
import numpy as np
from numpy.lib.format import read_array, write_array
from pandas.compat import BytesIO, cPickle as pkl, pickle_compat as pc, PY3
from pandas.core.dtypes.common import is_datetime64_dtype, _NS_DTYPE
from pandas.io.common import _get_handle, _infer_compression, _stringify_path
... | gpl-2.0 |
munichpavel/risklearning | risklearning/rl_io.py | 1 | 3324 | # Copyright 2017 Paul Larsen. All rights reserved, modified from TensorFlow tutorial here:
# https://www.tensorflow.org/programmers_guide/reading_data#reading-from-files
# with the same licensing as the original, copied in below from other TensorFlow stuff:
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
... | mit |
matbra/bokeh | bokeh/charts/tests/test_data_adapter.py | 37 | 3285 | """ This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | bsd-3-clause |
yuchenhou/elephant | elephant/estimator.py | 1 | 2622 | import math
import numpy
import tensorflow
from sklearn import cross_validation, metrics
from tensorflow.contrib import learn, layers, framework
class Estimator(object):
def __init__(self, x, config, layer_size, n_hidden_layers):
self.learning_rate = config['learning_rate']
self.n_ids = config['n... | mit |
Aasmi/scikit-learn | sklearn/tests/test_isotonic.py | 230 | 11087 | import numpy as np
import pickle
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert_equal,
... | bsd-3-clause |
hsiaoyi0504/scikit-learn | sklearn/decomposition/__init__.py | 147 | 1421 | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF
from .pca import PCA, RandomizedPCA
from .incrementa... | bsd-3-clause |
terkkila/scikit-learn | sklearn/svm/tests/test_bounds.py | 280 | 2541 | import nose
from nose.tools import assert_equal, assert_true
from sklearn.utils.testing import clean_warning_registry
import warnings
import numpy as np
from scipy import sparse as sp
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from sklearn.linear_model.logistic import LogisticRegression... | bsd-3-clause |
fedspendingtransparency/data-act-broker-backend | dataactbroker/scripts/dedupe_duns_export.py | 1 | 2178 | import logging
import boto3
import os
import pandas as pd
import csv
from datetime import datetime
from dataactvalidator.health_check import create_app
from dataactcore.logging import configure_logging
from dataactcore.config import CONFIG_BROKER
logger = logging.getLogger(__name__)
# CSV column header name in DUNS ... | cc0-1.0 |
rubikloud/scikit-learn | examples/covariance/plot_outlier_detection.py | 235 | 3891 | """
==========================================
Outlier detection with several methods.
==========================================
When the amount of contamination is known, this example illustrates two
different ways of performing :ref:`outlier_detection`:
- based on a robust estimator of covariance, which is assumin... | bsd-3-clause |
yjzhang/uncurl_python | uncurl/qual2quant.py | 1 | 7285 | # Qualitative to Quantitative semi-supervision framework
import numpy as np
from scipy import sparse
import scipy.stats
from sklearn.cluster import KMeans
from .clustering import poisson_cluster
def poisson_test(data1, data2, smoothing=1e-5, return_pval=True):
"""
Returns a p-value for the ratio of the means... | mit |
aldian/tensorflow | tensorflow/python/estimator/inputs/queues/feeding_functions.py | 10 | 18972 | # 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 |
pligor/predicting-future-product-prices | 02_preprocessing/gpr_ph.py | 1 | 5524 | from __future__ import division
import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
from mobattrs_price_history_merger import MobAttrsPriceHistoryMerger
# import pandas as pd
# import sys
# import math
# from sklearn.preprocessing import LabelEncoder, OneHotEncoder
# import re
# import os
... | agpl-3.0 |
rkmaddox/mne-python | mne/decoding/receptive_field.py | 6 | 19137 | # -*- coding: utf-8 -*-
# Authors: Chris Holdgraf <choldgraf@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import numbers
import numpy as np
from .base import get_coef, BaseEstimator, _check_estimator
from .time_delaying_ridge import TimeDelayingRidge
from ..fixes import is_r... | bsd-3-clause |
wanggang3333/scikit-learn | examples/model_selection/grid_search_digits.py | 227 | 2665 | """
============================================================
Parameter estimation using grid search with cross-validation
============================================================
This examples shows how a classifier is optimized by cross-validation,
which is done using the :class:`sklearn.grid_search.GridSearc... | bsd-3-clause |
fspaolo/scikit-learn | examples/ensemble/plot_partial_dependence.py | 7 | 4436 | """
========================
Partial Dependence Plots
========================
Partial dependence plots show the dependence between the target function [1]_
and a set of 'target' features, marginalizing over the
values of all other features (the complement features). Due to the limits
of human perception the size of t... | bsd-3-clause |
chrjxj/zipline | zipline/modelling/engine.py | 5 | 17723 | """
Compute Engine for FFC API
"""
from abc import (
ABCMeta,
abstractmethod,
)
from operator import and_
from six import (
iteritems,
itervalues,
with_metaclass,
)
from six.moves import (
reduce,
zip_longest,
)
from numpy import (
add,
empty_like,
)
from pandas import (
DataFra... | apache-2.0 |
Nyker510/scikit-learn | examples/cluster/plot_mini_batch_kmeans.py | 265 | 4081 | """
====================================================================
Comparison of the K-Means and MiniBatchKMeans clustering algorithms
====================================================================
We want to compare the performance of the MiniBatchKMeans and KMeans:
the MiniBatchKMeans is faster, but give... | bsd-3-clause |
Barmaley-exe/scikit-learn | sklearn/manifold/tests/test_spectral_embedding.py | 2 | 8123 | from nose.tools import assert_true
from nose.tools import assert_equal
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_raises
from nose.plugins.skip import SkipTest
from sk... | bsd-3-clause |
chrisbarber/dask | dask/dataframe/io/parquet.py | 2 | 9536 | import pandas as pd
from toolz import first, partial
from ..core import DataFrame, Series
from ...base import tokenize, normalize_token
from ...compatibility import PY3
from ...delayed import delayed
from ...bytes.core import OpenFileCreator
try:
import fastparquet
from fastparquet import parquet_thrift
f... | bsd-3-clause |
shangwuhencc/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 |
shangwuhencc/scikit-learn | sklearn/kernel_approximation.py | 258 | 17973 | """
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 |
roxyboy/scikit-learn | sklearn/neural_network/tests/test_rbm.py | 142 | 6276 | import sys
import re
import numpy as np
from scipy.sparse import csc_matrix, csr_matrix, lil_matrix
from sklearn.utils.testing import (assert_almost_equal, assert_array_equal,
assert_true)
from sklearn.datasets import load_digits
from sklearn.externals.six.moves import cStringIO as ... | bsd-3-clause |
rubikloud/scikit-learn | sklearn/utils/tests/test_fixes.py | 281 | 1829 | # Authors: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Justin Vincent
# Lars Buitinck
# License: BSD 3 clause
import numpy as np
from nose.tools import assert_equal
from nose.tools import assert_false
from nose.tools import assert_true
from numpy.testing import (assert_almost_equal,
... | bsd-3-clause |
lbdreyer/iris | docs/iris/src/conf.py | 2 | 10980 | # Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
# -*- coding: utf-8 -*-
#
# Iris documentation build configuration file, created by
# sphinx-quickstart on Tue May 25 13:26:23... | lgpl-3.0 |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/pylab_examples/triplot_demo.py | 9 | 4045 | """
Creating and plotting unstructured triangular grids.
"""
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np
import math
# Creating a Triangulation without specifying the triangles results in the
# Delaunay triangulation of the points.
# First create the x and y coordinates of the poin... | mit |
darcamo/pyphysim | pyphysim/cell/cell.py | 1 | 99414 | #!/usr/bin/env python
"""Module that implements Cell and Cluster related classes."""
try:
# noinspection PyUnresolvedReferences
# noinspection PyUnresolvedReferences
from matplotlib import patches
from matplotlib import pyplot as plt
_MATPLOTLIB_AVAILABLE = True
except ImportError: # pragma: no c... | gpl-2.0 |
cavestruz/StrongCNN | data/link2classifier.py | 1 | 1640 | import sys, os
from glob import glob
import pandas as pd
def collect_ids_by_classification(csvfile='classifications.csv') :
classifications = pd.read_csv(csvfile, delimiter=',')
lensed_ids = classifications['ID'][classifications['is_lens']==1]
unlensed_ids = classifications['ID'][classifications['is_lens']... | mit |
kevin-coder/tensorflow-fork | tensorflow/tools/compatibility/tf_upgrade_v2_test.py | 1 | 65711 | # Copyright 2018 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 |
DSLituiev/scikit-learn | examples/linear_model/plot_ransac.py | 73 | 1859 | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | bsd-3-clause |
apache/spark | python/pyspark/pandas/extensions.py | 11 | 12362 | #
# 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 |
ehogan/iris | docs/iris/example_code/General/custom_aggregation.py | 6 | 3397 | """
Calculating a custom statistic
==============================
This example shows how to define and use a custom
:class:`iris.analysis.Aggregator`, that provides a new statistical operator for
use with cube aggregation functions such as :meth:`~iris.cube.Cube.collapsed`,
:meth:`~iris.cube.Cube.aggregated_by` or
:me... | lgpl-3.0 |
nhuntwalker/astroML | book_figures/chapter7/fig_PCA_rotation.py | 3 | 3000 | """
Scematic Diagram of PCA
-----------------------
Figure 7.2
A distribution of points drawn from a bivariate Gaussian and centered on the
origin of x and y. PCA defines a rotation such that the new axes (x' and y')
are aligned along the directions of maximal variance (the principal components)
with zero covariance. ... | bsd-2-clause |
beepee14/scikit-learn | examples/exercises/plot_iris_exercise.py | 323 | 1602 | """
================================
SVM Exercise
================================
A tutorial exercise for using different SVM kernels.
This exercise is used in the :ref:`using_kernels_tut` part of the
:ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`.
"""
print(__doc__)
import numpy as np
i... | bsd-3-clause |
uahic/nest-simulator | testsuite/manualtests/stdp_check.py | 13 | 4713 | # -*- 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 |
shoyer/xray | asv_bench/benchmarks/dataarray_missing.py | 3 | 1938 | from __future__ import absolute_import, division, print_function
import pandas as pd
import xarray as xr
from . import randn, requires_dask
try:
import dask # noqa
except ImportError:
pass
def make_bench_data(shape, frac_nan, chunks):
vals = randn(shape, frac_nan)
coords = {'time': pd.date_range(... | apache-2.0 |
Huangying-Zhan/huangying-zhan.github.io | markdown_generator/talks.py | 199 | 4000 |
# coding: utf-8
# # Talks markdown generator for academicpages
#
# Takes a TSV of talks with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_i... | mit |
asrbrr/datacleaning | csv_helper.py | 1 | 7444 | '''
csv_helper - convenience functions to work on csv data files
==========
Helps review and somewhat mungle CSV files. Typically, this would be done
before a pd.read_csv(), as a conevenience tool to identify NA values,
know data types etc
Functions
=========
- csv_num_rows() : returns number of rows in the... | apache-2.0 |
josephcslater/scipy | scipy/signal/fir_filter_design.py | 17 | 36232 | # -*- coding: utf-8 -*-
"""Functions for FIR filter design."""
from __future__ import division, print_function, absolute_import
from math import ceil, log
import warnings
import numpy as np
from numpy.fft import irfft, fft, ifft
from scipy.special import sinc
from scipy.linalg import toeplitz, hankel, pinv
from scipy... | bsd-3-clause |
zhenv5/scikit-learn | sklearn/datasets/__init__.py | 176 | 3671 | """
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 |
PrashntS/scikit-learn | examples/model_selection/plot_confusion_matrix.py | 244 | 2496 | """
================
Confusion matrix
================
Example of confusion matrix usage to evaluate the quality
of the output of a classifier on the iris data set. The
diagonal elements represent the number of points for which
the predicted label is equal to the true label, while
off-diagonal elements are those that ... | bsd-3-clause |
coded5282/youtube-8m | ensemble.py | 1 | 1486 | # Ensemble submission csv files together
import numpy as np
import pandas as pd
import itertools
fns = [ # files for ensembling
"lstm.csv"
"moe4_do.csv"
]
fn0, fn1 = fns # getting each file to variable
outfn="weighted_predictions.csv" # output file
def parse_line(ln):
id_, vals = ln.strip().split(',') # spli... | apache-2.0 |
harisbal/pandas | pandas/core/internals/concat.py | 4 | 16806 | # -*- coding: utf-8 -*-
# TODO: Needs a better name; too many modules are already called "concat"
import copy
from collections import defaultdict
import numpy as np
from pandas._libs import tslibs, internals as libinternals
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.missing import isn... | bsd-3-clause |
jskDr/keraspp | old/ex8_1_unet_cifar10_org.py | 1 | 8196 | #######################################################################################
# unet_conv_cifar10rgb_mc.py
# Convlutional Layer UNET with RGB Cifar10 dataset and Class with Keras Model approach
#######################################################################################
#import matplotlib
#matplotl... | mit |
kenshay/ImageScript | ProgramData/SystemFiles/Python/share/doc/networkx-2.2/examples/advanced/plot_heavy_metal_umlaut.py | 5 | 1984 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
==================
Heavy Metal Umlaut
==================
Example using unicode strings as graph labels.
Also shows creative use of the Heavy Metal Umlaut:
https://en.wikipedia.org/wiki/Heavy_metal_umlaut
"""
# Author: Aric Hagberg (hagberg@lanl.gov)
# Copyright (C... | gpl-3.0 |
BadWizard/Inflation | SPF/source/clean_SPF.py | 1 | 7424 | '''
This file takes a raw SPF csv file and makes separate csv files
for HICP, GDP, and Unemployment
'''
import pandas as pd
import numpy as np
import os
def rename_columns(df):
'''
funciton to rename the columns of a data frame
'''
if df.shape[1] == 16: # HICP and GDP
df = df.rename(colu... | mit |
rohanp/scikit-learn | examples/applications/plot_tomography_l1_reconstruction.py | 81 | 5461 | """
======================================================================
Compressive sensing: tomography reconstruction with L1 prior (Lasso)
======================================================================
This example shows the reconstruction of an image from a set of parallel
projections, acquired along dif... | bsd-3-clause |
andrewnc/scikit-learn | sklearn/metrics/tests/test_ranking.py | 127 | 40813 | from __future__ import division, print_function
import numpy as np
from itertools import product
import warnings
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn import svm
from sklearn import ensemble
from sklearn.datasets import make_multilabel_classification
from sklearn.random_projec... | bsd-3-clause |
linebp/pandas | pandas/tests/io/parser/common.py | 4 | 60970 | # -*- coding: utf-8 -*-
import csv
import os
import platform
import codecs
import re
import sys
from datetime import datetime
import pytest
import numpy as np
from pandas._libs.lib import Timestamp
import pandas as pd
import pandas.util.testing as tm
from pandas import DataFrame, Series, Index, MultiIndex
from pand... | bsd-3-clause |
kastman/fitz | setup.py | 1 | 2650 | #! /usr/bin/env python
import os
from setuptools import setup, find_packages
descr = """Fitz: Workflow Mangement for neuroimaging data."""
DISTNAME = 'fitz'
DESCRIPTION = descr
AUTHOR = MAINTAINER = 'Erik Kastman'
AUTHOR_EMAIL = MAINTAINER_EMAIL = 'erik.kastman@gmail.com'
LICENSE = 'BSD (3-clause)'
URL = 'http://gith... | bsd-3-clause |
yiluzhu/hello-quant | quant/binomial_trees_plot.py | 1 | 2615 | import matplotlib.pyplot as plt
import numpy as np
from binomial_trees import BinomialTree
from black_scholes import OptionType
from multiprocessing import Process, Queue
from math import ceil
class OptionPricePlot(object):
def get_price(self, otype=OptionType.PUT, spot=50,
strike=52, rat... | gpl-3.0 |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/lines_bars_and_markers/stackplot_demo.py | 1 | 2160 | """
==============
Stackplot Demo
==============
How to create stackplots with Matplotlib.
Stackplots are generated by plotting different datasets vertically on
top of one another rather than overlapping with one another. Below we
show some examples to accomplish this with Matplotlib.
"""
import numpy as np
import ma... | mit |
miguelfg/pandas-cli | setup.py | 1 | 2362 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, print_function
import io
import os
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import relpath
from os.path import splitext
from setuptools import f... | bsd-2-clause |
amolkahat/pandas | pandas/tests/arithmetic/test_object.py | 3 | 7634 | # -*- coding: utf-8 -*-
# Arithmetc tests for DataFrame/Series/Index/Array classes that should
# behave identically.
# Specifically for object dtype
import operator
import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
from pandas.core import ops
from pandas import Series, Timestamp
... | bsd-3-clause |
roxyboy/bokeh | bokeh/charts/builder/histogram_builder.py | 43 | 9142 | """This is the Bokeh charts interface. It gives you a high level API to build
complex plot is a simple way.
This is the Histogram class which lets you build your histograms just passing
the arguments to the Chart class and calling the proper functions.
"""
#-------------------------------------------------------------... | bsd-3-clause |
TomAugspurger/pandas | pandas/tests/indexes/multi/test_partial_indexing.py | 4 | 3376 | import pytest
from pandas import DataFrame, IndexSlice, MultiIndex, date_range
import pandas._testing as tm
@pytest.fixture
def df():
# c1
# 2016-01-01 00:00:00 a 0
# b 1
# c 2
# 2016-01-01 12:00:00 a 3
# ... | bsd-3-clause |
rs2/pandas | pandas/tests/extension/base/methods.py | 1 | 18202 | import operator
import numpy as np
import pytest
from pandas.core.dtypes.common import is_bool_dtype
import pandas as pd
import pandas._testing as tm
from pandas.core.sorting import nargsort
from .base import BaseExtensionTests
class BaseMethodsTests(BaseExtensionTests):
"""Various Series and DataFrame method... | bsd-3-clause |
icemoon1987/xueqiu_monitor | small_market_value.py | 1 | 4569 | import pandas as pd
import tushare as ts
import re
import os
import datetime
import logging
import json
import util
stRegex = re.compile(r"^[^\*ST.*]")
class Small_Market:
def __init__(self):
with open('./conf/small_market_config.json', 'r') as f:
config = json.loads(f.read())
self.__... | gpl-3.0 |
gtoonstra/airflow | airflow/hooks/dbapi_hook.py | 11 | 10932 | # -*- coding: utf-8 -*-
#
# 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 |
ZwickyTransientFacility/ztf_sim | ztf_sim/field_selection/srg.py | 1 | 5855 | """
@author: yuhanyao
"""
from glob import glob
import os
import logging
import astropy.constants as const
import numpy as np
import pandas as pd
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
from astropy.coordinates import get_sun
from ..Fields import Fields
from... | bsd-3-clause |
zhangwei5095/spark-examples | src/main/python/FlightDelayAnalysis.py | 1 | 3275 | ## Post: https://districtdatalabs.silvrback.com/getting-started-with-spark-in-python
## Data: https://www.dropbox.com/s/gnzztknnhrx81uv/ontime.zip?dl=1
import csv
import matplotlib.pyplot as plt
from StringIO import StringIO
from datetime import datetime
from collections import namedtuple
from operator import add, i... | apache-2.0 |
Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/pandas/tests/series/test_quantile.py | 7 | 7083 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import pytest
import numpy as np
import pandas as pd
from pandas import (Index, Series, _np_version_under1p9)
from pandas.core.indexes.datetimes import Timestamp
from pandas.core.dtypes.common import is_integer
import pandas.util.testing as tm
from .common import Test... | agpl-3.0 |
rpcope1/Hantek6022API | examples/example_linux_continous_read.py | 1 | 2465 | __author__ = 'rcope'
from PyHT6022.LibUsbScope import Oscilloscope
import matplotlib.pyplot as plt
import time
import numpy as np
from collections import deque
def build_stability_array(data, threshold=1.0):
initial = True
running = False
current = 0
stability = []
for entry in data:
if i... | gpl-2.0 |
henridwyer/scikit-learn | examples/linear_model/plot_lasso_lars.py | 363 | 1080 | #!/usr/bin/env python
"""
=====================
Lasso path using LARS
=====================
Computes Lasso Path along the regularization parameter using the LARS
algorithm on the diabetes dataset. Each color represents a different
feature of the coefficient vector, and this is displayed as a function
of the regulariza... | bsd-3-clause |
nest/nest-simulator | pynest/examples/spatial/ctx_2n.py | 20 | 2192 | # -*- coding: utf-8 -*-
#
# ctx_2n.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
# (a... | gpl-2.0 |
xiyuansun/data-science-from-scratch | code/gradient_descent.py | 53 | 5895 | from __future__ import division
from collections import Counter
from linear_algebra import distance, vector_subtract, scalar_multiply
import math, random
def sum_of_squares(v):
"""computes the sum of squared elements in v"""
return sum(v_i ** 2 for v_i in v)
def difference_quotient(f, x, h):
return (f(x +... | unlicense |
elijah513/scikit-learn | sklearn/tests/test_calibration.py | 213 | 12219 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_greater, assert_almost_equal,
... | bsd-3-clause |
tgsmith61591/skutil | setup.py | 1 | 11470 | from __future__ import print_function
import os
import sys
import shutil
import glob
import traceback
import warnings
import subprocess
import traceback
from pkg_resources import parse_version
# For cleaning build artifacts
from distutils.command.clean import clean
if sys.version_info[0] < 3:
import __builtin__ a... | bsd-3-clause |
CameronTEllis/brainiak | tests/funcalign/test_srm.py | 4 | 10913 | # Copyright 2016 Intel Corporation
#
# 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... | apache-2.0 |
kreuks/liven | nlp/trainers/spacy_sklearn_trainer.py | 1 | 2730 | import spacy
import os
import datetime
import json
import cloudpickle
import algo.util
from algo.featurizers.spacy_featurizer import SpacyFeaturizer
from algo.classifiers.sklearn_intent_classifier import SklearnIntentClassifier
from algo.extractors.spacy_entity_extractor import SpacyEntityExtractor
from algo.trainers.t... | apache-2.0 |
kevin-intel/scikit-learn | examples/neural_networks/plot_mlp_training_curves.py | 23 | 4053 | """
========================================================
Compare Stochastic learning strategies for MLPClassifier
========================================================
This example visualizes some training loss curves for different stochastic
learning strategies, including SGD and Adam. Because of time-constrai... | bsd-3-clause |
DavidTingley/ephys-processing-pipeline | installation/klustaviewa-0.3.0/klustaviewa/views/tests/test_correlogramsview.py | 2 | 1725 | """Unit tests for correlograms view."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import os
import numpy as np
import numpy.random as rnd
import pandas as pd
from klustaviewa.vie... | gpl-3.0 |
bigaidream-projects/drmad | cpu_ver/hyperserver/experimentResult/meta20/initial_mnist.py | 1 | 8585 | """Runs for paper"""
import sys
import os
project_dir = os.environ['EXPERI_PROJECT_PATH']
sys.path.append(project_dir)
sys.path.append(project_dir+"/hyperParamServerSubSet")
sys.path.append(project_dir+"/library")
sys.path.append(project_dir+"/library/autogradwithbay")
sys.path.append(project_dir+"/library/hypergrad")
... | mit |
alexeyche/dnn | scripts/get_music_features.py | 1 | 2809 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon May 9 09:15:34 2016
@author: alexeyche
"""
import numpy as np
import librosa as lr
import argparse
from lib.util import run_proc
from lib.util import setup_logging
from lib import run_iaf_network, write_time_series
from librosa.core.time_frequency impo... | gpl-2.0 |
mattilyra/scikit-learn | sklearn/ensemble/tests/test_partial_dependence.py | 365 | 6996 | """
Testing for the partial dependence module.
"""
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import if_matplotlib
from sklearn.ensemble.partial_dependence import partial_dependence
from sklearn.ensemble.partial_dependence... | bsd-3-clause |
nddsg/TreeDecomps | xplodnTree/core/prs_tst.py | 1 | 7336 | __author__ = ['Salvador Aguinaga', 'Rodrigo Palacios', 'David Chaing', 'Tim Weninger']
import networkx as nx
import numpy as np
class Rule(object):
def __init__(self, id, lhs, rhs, prob, translate=True):
self.id = id
self.lhs = lhs
if translate:
self.rhs = rhs
self.cfg_rhs = self.hrg_to_cfg... | mit |
Winand/pandas | pandas/core/internals.py | 1 | 186942 | import copy
from warnings import catch_warnings
import itertools
import re
import operator
from datetime import datetime, timedelta, date
from collections import defaultdict
from functools import partial
import numpy as np
from pandas.core.base import PandasObject
from pandas.core.dtypes.dtypes import (
Extensio... | bsd-3-clause |
russel1237/scikit-learn | sklearn/cluster/dbscan_.py | 92 | 12380 | # -*- coding: utf-8 -*-
"""
DBSCAN: Density-Based Spatial Clustering of Applications with Noise
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Joel Nothman <joel.nothman@gmail.com>
# Lars Buitinck
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse
from ..ba... | bsd-3-clause |
duncanmmacleod/pycbc-glue | test/ligo_lw_test_01.py | 3 | 1324 | import matplotlib
matplotlib.use("Agg")
from matplotlib import figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import numpy
import sys
from glue.ligolw import ligolw
from glue.ligolw import array as ligolw_array
from glue.ligolw import param as ligolw_param
from glue.ligolw import ut... | gpl-3.0 |
jordancheah/zipline | zipline/sources/data_frame_source.py | 26 | 5253 | #
# 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 |
unnikrishnankgs/va | venv/lib/python3.5/site-packages/matplotlib/sphinxext/plot_directive.py | 10 | 28379 | """
A directive for including a matplotlib plot in a Sphinx document.
By default, in HTML output, `plot` will include a .png file with a
link to a high-res .png and .pdf. In LaTeX output, it will include a
.pdf.
The source code for the plot may be included in one of three ways:
1. **A path to a source file** as t... | bsd-2-clause |
pravsripad/jumeg | jumeg/decompose/ocarta.py | 3 | 78394 | # Authors: Lukas Breuer <l.breuer@fz-juelich.de>
"""
----------------------------------------------------------------------
--- jumeg.decompose.ocarta -------------------------------------------
----------------------------------------------------------------------
author : Lukas Breuer
email : l.breuer@fz-... | bsd-3-clause |
tuhuayuan/ml | kaggel/iris/logistic.py | 1 | 2464 | # pylint: disable=all
#%%
import matplotlib.pyplot as plt
import numpy as np
def sigmoid(z):
return 1.0 / (1.0 + np.exp(-z))
z = np.arange(-10, 10, 0.1)
a = sigmoid(z)
plt.plot(z, a)
plt.axvline(0.0, color='k')
plt.axhline(y=0.5, ls='dotted', color='k')
def plot_decision_regions(X, y, classifier,
... | mit |
percyfal/snakemakelib | snakemakelib/bio/ngs/align/star.py | 1 | 1856 | # Copyright (C) 2015 by Per Unneberg
import pandas as pd
import numpy as np
from bokeh.models import HoverTool, ColumnDataSource, BoxSelectTool
from bokeh.models.widgets import VBox, HBox, TableColumn, DataTable
from bokeh.plotting import gridplot
from bokeh.palettes import brewer
from snakemake.report import data_uri
... | mit |
cpaulik/xray | xray/core/formatting.py | 1 | 9159 | from datetime import datetime, timedelta
import functools
import numpy as np
import pandas as pd
from .options import OPTIONS
from .pycompat import (OrderedDict, iteritems, itervalues, unicode_type,
bytes_type, dask_array_type)
def pretty_print(x, numchars):
"""Given an object `x`, call `... | apache-2.0 |
kit-cel/lecture-examples | nt2_ce2/uebung/modulation_pulsformung/Pulsformung.py | 1 | 7188 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 13 10:31:13 2014
NTII Demo - Pulsformung
Systemmodell: Quelle --> QPSK --> Pulsformung
@author: Michael Schwall
"""
from __future__ import division
import numpy as np
import matplotlib.pylab as plt
import scipy.signal as sig
import rrc as rrc
plt.close(... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.