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 |
|---|---|---|---|---|---|
InvestmentSystems/function-pipe | doc/source/usage_df.py | 1 | 13071 |
import zipfile
import collections
import os
import webbrowser
import requests
import pandas as pd
import function_pipe as fpn
# source url
URL_NAMES = 'https://www.ssa.gov/oact/babynames/names.zip'
FP_ZIP = '/tmp/names.zip'
class Core:
def load_data_dict(fp):
'''Source data from ZIP and load into dic... | mit |
ppegusii/cs689-final | src/seqlearn-master/seqlearn/tests/test_perceptron.py | 5 | 1513 | from numpy.testing import assert_array_equal
import numpy as np
from scipy.sparse import coo_matrix, csc_matrix
from sklearn.base import clone
from seqlearn.perceptron import StructuredPerceptron
def test_perceptron():
X = [[0, 1, 0],
[0, 1, 0],
[1, 0, 0],
[0, 1, 0],
[1, 0, 0... | gpl-2.0 |
Ziqi-Li/bknqgis | bokeh/bokeh/core/compat/mplexporter/renderers/vega_renderer.py | 10 | 5272 | import warnings
import json
import random
from .base import Renderer
from ..exporter import Exporter
class VegaRenderer(Renderer):
def open_figure(self, fig, props):
self.props = props
self.figwidth = int(props['figwidth'] * props['dpi'])
self.figheight = int(props['figheight'] * props['dp... | gpl-2.0 |
mtat76/atm-py | build/lib/atmPy/for_removal/POPS/peaks.py | 6 | 20882 | import datetime
import os
import warnings
from struct import unpack, calcsize
import numpy as np
import pandas as pd
import pylab as plt
from atmPy.aerosols.size_distr import sizedistribution
from atmPy.tools import miscell_tools as misc
#from StringIO import StringIO as io
#from POPS_lib import calibration
#defaul... | mit |
beckdaniel/GPy | GPy/testing/rv_transformation_tests.py | 8 | 3522 | # Written by Ilias Bilionis
"""
Test if hyperparameters in models are properly transformed.
"""
import unittest
import numpy as np
import scipy.stats as st
import GPy
class TestModel(GPy.core.Model):
"""
A simple GPy model with one parameter.
"""
def __init__(self):
GPy.core.Model.__init__(s... | bsd-3-clause |
pianomania/scikit-learn | sklearn/linear_model/tests/test_sgd.py | 34 | 47824 | import pickle
import unittest
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing ... | bsd-3-clause |
GunnerJnr/_CodeInstitute | Stream-2/Back-End-Development/24.Twitter-Streams-2-Intro/1.Further-Data-Mining-Tweets/tweet_stream_reader.py | 1 | 2772 | import json
import re
import pandas
import matplotlib.pyplot as plt
# store the path to the file we wish to read the data from
tweets_data_path = 'tweet_mining.json'
# create a function to read our json data file
def read_json(file_path):
# create a list to store the data from the json file
results = []
... | mit |
LennonLab/ActiveSoil | Modeling/model/model.py | 1 | 23590 | from __future__ import division
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import statsmodels.tsa.stattools as sta
from math import isnan
from random import choice, randint
from scipy import stats
import numpy as np
from numpy import sin, pi, mean
import sys
import os
import time
import p... | gpl-3.0 |
jat255/seaborn | seaborn/tests/test_palettes.py | 4 | 9848 | import warnings
import colorsys
import numpy as np
import matplotlib as mpl
import nose.tools as nt
import numpy.testing as npt
from .. import palettes, utils, rcmod, husl
from ..xkcd_rgb import xkcd_rgb
from ..crayons import crayons
class TestColorPalettes(object):
def test_current_palette(self):
pal... | bsd-3-clause |
alvarofierroclavero/scikit-learn | sklearn/tree/tree.py | 113 | 34767 | """
This module gathers tree-based methods, including decision, regression and
randomized trees. Single and multi-output problems are both handled.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Da... | bsd-3-clause |
untom/scikit-learn | examples/svm/plot_rbf_parameters.py | 35 | 8096 | '''
==================
RBF SVM parameters
==================
This example illustrates the effect of the parameters ``gamma`` and ``C`` of
the Radius Basis Function (RBF) kernel SVM.
Intuitively, the ``gamma`` parameter defines how far the influence of a single
training example reaches, with low values meaning 'far' a... | bsd-3-clause |
Adai0808/nolearn | setup.py | 3 | 1469 | import os
from setuptools import setup, find_packages
version = '0.6adev'
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
except IOError:
README = CHANGES = ''
install_requires = [
... | mit |
wazeerzulfikar/scikit-learn | examples/exercises/plot_iris_exercise.py | 44 | 1690 | """
================================
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 |
walterreade/scikit-learn | examples/covariance/plot_sparse_cov.py | 300 | 5078 | """
======================================
Sparse inverse covariance estimation
======================================
Using the GraphLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matrix, t... | bsd-3-clause |
toobaz/pandas | pandas/tests/dtypes/test_missing.py | 1 | 17044 | from datetime import datetime
from decimal import Decimal
from warnings import catch_warnings, filterwarnings
import numpy as np
import pytest
from pandas._config import config as cf
from pandas._libs import missing as libmissing
from pandas._libs.tslibs import iNaT, is_null_datetimelike
from pandas.core.dtypes.com... | bsd-3-clause |
deepmind/bsuite | setup.py | 1 | 3066 | # python3
# pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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... | apache-2.0 |
olgabot/seaborn | seaborn/widgets.py | 4 | 14896 | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
# Lots of different places that widgets could come from...
try:
from ipywidgets import interact, FloatSlider, IntSlider
except ImportError:
try:
from IPython.html.wid... | bsd-3-clause |
pv/scikit-learn | sklearn/covariance/__init__.py | 389 | 1157 | """
The :mod:`sklearn.covariance` module includes methods and algorithms to
robustly estimate the covariance of features given a set of points. The
precision matrix defined as the inverse of the covariance is also estimated.
Covariance estimation is closely related to the theory of Gaussian Graphical
Models.
"""
from ... | bsd-3-clause |
gustfrontar/LETKF_WRF | wrf/verification/python/plot_covariancestrength.py | 1 | 6207 | # -*- coding: utf-8 -*-
#Este script plotea perfiles verticales de la intensidad de las covarianzas.
"""
Created on Tue Nov 1 18:45:15 2016
@author:
"""
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
import binary_io as bio
import bred_vector_functions as bvf
import os
import numpy.ma as ma... | gpl-3.0 |
JohannesUIBK/oggm | docs/conf.py | 2 | 13696 | from __future__ import print_function
# -*- coding: utf-8 -*-
#
# OGGM documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 21 10:03:33 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present ... | gpl-3.0 |
Roboticmechart22/sms-tools | lectures/06-Harmonic-model/plots-code/monophonic-polyphonic.py | 21 | 2258 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import sineModel as SM
import stft as STFT
import utilFunctions as UF
plt.f... | agpl-3.0 |
stitchfix/pyxley | pyxley/charts/plotly/base.py | 1 | 1813 |
from ..charts import Chart
from flask import jsonify, request
_BASE_CONFIG = {
"showLink": False,
"displaylogo": False,
"modeBarButtonsToRemove": ["sendDataToCloud"]
}
class PlotlyAPI(Chart):
""" Base class for Plotly.js API
This class is used to create charts using the plotly.js api
... | mit |
matz-e/lobster | setup.py | 1 | 1764 | #!/usr/bin/env python
from setuptools import setup
from lobster.util import get_version
setup(
name='Lobster',
version=get_version(),
description='Opportunistic HEP computing tool',
author='Anna Woodard, Matthias Wolf',
url='https://github.com/matz-e/lobster',
packages=[
'lobster',
... | mit |
GPflow/GPflow | doc/source/notebooks/advanced/mcmc.pct.py | 1 | 22972 | # ---
# jupyter:
# jupytext:
# formats: ipynb,.pct.py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.4.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
... | apache-2.0 |
thilbern/scikit-learn | examples/classification/plot_digits_classification.py | 289 | 2397 | """
================================
Recognizing hand-written digits
================================
An example showing how the scikit-learn can be used to recognize images of
hand-written digits.
This example is commented in the
:ref:`tutorial section of the user manual <introduction>`.
"""
print(__doc__)
# Autho... | bsd-3-clause |
kevin-intel/scikit-learn | sklearn/decomposition/_dict_learning.py | 2 | 60799 | """ Dictionary learning.
"""
# Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort
# License: BSD 3 clause
import time
import sys
import itertools
import warnings
from math import ceil
import numpy as np
from scipy import linalg
from joblib import Parallel, effective_n_jobs
from ..base import BaseEstimator, Tr... | bsd-3-clause |
js850/pele | playground/parallel_tempering/run_ptmc.py | 7 | 4924 | import numpy as np
import pele.potentials.lj as lj
#import potentials.ljcpp as lj
from pele.mc import MonteCarlo
from pele.takestep import RandomDisplacement, AdaptiveStepsize
from ptmc import PTMC, getTemps
import copy
from pele.utils.histogram import EnergyHistogram, PrintHistogram
from pele.optimize import mylbfgs ... | gpl-3.0 |
bennlich/scikit-image | doc/examples/plot_ihc_color_separation.py | 18 | 1925 | """
==============================================
Immunohistochemical staining colors separation
==============================================
In this example we separate the immunohistochemical (IHC) staining from the
hematoxylin counterstaining. The separation is achieved with the method
described in [1]_, known a... | bsd-3-clause |
Fab7c4/paparazzi | sw/airborne/test/stabilization/compare_ref_quat.py | 38 | 1206 | #! /usr/bin/env python
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib.pyplot as plt
import ref_quat_float
import ref_quat_int
steps = 512 * 2
ref_eul_res = np.zeros((steps, 3))
ref_quat_res = np.zeros((steps, 3))
ref_quat_float.init()
ref_quat_int.init()
# re... | gpl-2.0 |
jakevdp/multiband_LS | figures/fig03_multiterm_example.py | 1 | 2285 | """
Here we plot a typical approach to multi-band Lomb-Scargle: treating each band
separately, and taking a majority vote between the bands.
"""
import sys
import os
sys.path.append(os.path.abspath('../..'))
import numpy as np
import matplotlib.pyplot as plt
# Use seaborn settings for plot styles
import seaborn; sea... | bsd-2-clause |
hannorein/rebound | rebound/simulationarchive.py | 1 | 14842 | from ctypes import Structure, c_double, POINTER, c_float, c_int, c_uint, c_uint32, c_int64, c_long, c_ulong, c_ulonglong, c_void_p, c_char_p, CFUNCTYPE, byref, create_string_buffer, addressof, pointer, cast
from .simulation import Simulation, BINARY_WARNINGS
from . import clibrebound
import os
import sys
import math
i... | gpl-3.0 |
mhdella/data-science-from-scratch | code/visualizing_data.py | 58 | 5116 | import matplotlib.pyplot as plt
from collections import Counter
def make_chart_simple_line_chart(plt):
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3]
# create a line chart, years on x-axis, gdp on y-axis
plt.plot(years, gdp, color='gr... | unlicense |
vigilv/scikit-learn | sklearn/metrics/classification.py | 95 | 67713 | """Metrics to assess performance on classification task given classe prediction
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.gram... | bsd-3-clause |
sanjeevshrestha/iris | docs/conf.py | 1 | 8694 | # -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
# ... | gpl-3.0 |
jmetzen/scikit-learn | sklearn/metrics/cluster/unsupervised.py | 230 | 8281 | """ Unsupervised evaluation metrics. """
# Authors: Robert Layton <robertlayton@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from ...utils import check_random_state
from ..pairwise import pairwise_distances
def silhouette_score(X, labels, metric='euclidean', sample_size=None,
random... | bsd-3-clause |
kernc/scikit-learn | sklearn/datasets/tests/test_20news.py | 280 | 3045 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
harshaneelhg/scikit-learn | examples/preprocessing/plot_function_transformer.py | 161 | 1949 | """
=========================================================
Using FunctionTransformer to select columns
=========================================================
Shows how to use a function transformer in a pipeline. If you know your
dataset's first principle component is irrelevant for a classification task,
you ca... | bsd-3-clause |
jblackburne/scikit-learn | benchmarks/bench_plot_omp_lars.py | 28 | 4471 | """Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
regression (:ref:`least_angle_regression`)
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model impo... | bsd-3-clause |
eickenberg/scikit-learn | sklearn/mixture/tests/test_gmm.py | 24 | 12725 | import unittest
from nose.tools import assert_true
import numpy as np
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_raises)
from scipy import stats
from sklearn import mixture
from sklearn.datasets.samples_generator import make_spd_matrix
rng = np.random.R... | bsd-3-clause |
johnchase/scikit-bio | skbio/stats/distance/tests/test_mantel.py | 2 | 22163 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | bsd-3-clause |
JohnGriffiths/dipy | dipy/reconst/tests/test_sfm.py | 9 | 5744 | import numpy as np
import numpy.testing as npt
import nibabel as nib
import dipy.reconst.sfm as sfm
import dipy.data as dpd
import dipy.core.gradients as grad
import dipy.sims.voxel as sims
import dipy.core.optimize as opt
import dipy.reconst.cross_validation as xval
def test_design_matrix():
data, gtab = dpd.dsi... | bsd-3-clause |
yorkerlin/shogun | examples/undocumented/python_modular/graphical/interactive_svm_demo.py | 10 | 12589 | """
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 |
drabastomek/practicalDataAnalysisCookbook | Codes/Chapter05/reduce_LDA.py | 1 | 1856 | # this is needed to load helper from the parent folder
import sys
sys.path.append('..')
# the rest of the imports
import helper as hlp
import pandas as pd
import mlpy as ml
@hlp.timeit
def reduce_LDA(x, y):
'''
Reduce the dimensions using Linear Discriminant
Analysis
'''
# create the PCA ... | gpl-2.0 |
zeroSteiner/boltons | boltons/tableutils.py | 1 | 20731 | # -*- coding: utf-8 -*-
"""If there is one recurring theme in ``boltons``, it is that Python
has excellent datastructures that constitute a good foundation for
most quick manipulations, as well as building applications. However,
Python usage has grown much faster than builtin data structure
power. Python has a growing ... | bsd-3-clause |
jaidevd/scikit-learn | examples/text/mlcomp_sparse_document_classification.py | 33 | 4515 | """
========================================================
Classification of text documents: using a MLComp dataset
========================================================
This is an example showing how the scikit-learn can be used to classify
documents by topics using a bag-of-words approach. This example uses
a s... | bsd-3-clause |
joelagnel/trappy | tests/test_stats_grammar.py | 3 | 9397 | # Copyright 2015-2017 ARM Limited
#
# 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 w... | apache-2.0 |
cython-testbed/pandas | pandas/util/_doctools.py | 3 | 7097 | import numpy as np
import pandas as pd
import pandas.compat as compat
class TablePlotter(object):
"""
Layout some DataFrames in vertical/horizontal layout for explanation.
Used in merging.rst
"""
def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5):
self.cell_width = cell_... | bsd-3-clause |
idlead/scikit-learn | examples/neighbors/plot_nearest_centroid.py | 264 | 1804 | """
===============================
Nearest Centroid Classification
===============================
Sample usage of Nearest Centroid classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
f... | bsd-3-clause |
devanshdalal/scikit-learn | sklearn/feature_extraction/text.py | 19 | 52042 | # -*- coding: utf-8 -*-
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck
# Robert Layton <robertlayton@gmail.com>
# Jochen Wersdörfer <jochen@wersdoerfer.de>
# Roman Sinayev <roman.sinayev@gmail.com>
#
# License: B... | bsd-3-clause |
piyueh/PetIBM | examples/navierstokes/liddrivencavity2dRe1000/scripts/plotCenterlineVelocities.py | 4 | 3781 | """
Plots the velocities along the centerlines of the 2D cavity at Reynolds number
1000 and compares with the numerical data reported in Ghia et al. (1982).
_References:_
* Ghia, U. K. N. G., Ghia, K. N., & Shin, C. T. (1982).
High-Re solutions for incompressible flow using the Navier-Stokes equations
and a multig... | bsd-3-clause |
Lawrence-Liu/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 |
brguez/TEIBA | src/python/nbL1_nbActiveSrcElements_cor.py | 1 | 2448 | #!/usr/bin/env python
#coding: utf-8
#### FUNCTIONS ####
def header(string):
"""
Display header
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print '\n', timeInfo, "****", string, "****"
def subHeader(string):
"""
Display subheader
"""
timeInfo = time.strftime("%Y-%m-%... | gpl-3.0 |
femtotrader/rabbit4mt4 | rpc/json_rpc_db_amqp.py | 1 | 34712 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python bridge to store JSON RPC to a database and get result to a RabbitMQ queue
Copyright (C) 2014 "FemtoTrader" <femto.trader@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General ... | gpl-2.0 |
qilicun/python | python2/ecl_sum.py | 1 | 46554 | # Copyright (C) 2011 Statoil ASA, Norway.
#
# The file 'ecl_sum.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 t... | gpl-3.0 |
kjung/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 |
rl-institut/reegis-hp | reegis_hp/tools/set_timestamp.py | 3 | 1086 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 23 14:35:28 2016
@author: uwe
"""
import logging
import time
import pandas as pd
import oemof.db as db
from oemof.tools import logger
logger.define_logging()
conn = db.connection()
start = time.time()
sql = "SELECT DISTINCT name FROM berlin.stromdaten;"
logging.info(... | gpl-3.0 |
pratapvardhan/pandas | pandas/tests/indexing/test_partial.py | 3 | 23230 | """
test setting *parts* of objects both positionally and label based
TOD: these should be split among the indexer tests
"""
import pytest
from warnings import catch_warnings
import numpy as np
import pandas as pd
from pandas import Series, DataFrame, Panel, Index, date_range
from pandas.util import testing as tm
... | bsd-3-clause |
kazemakase/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 |
amolkahat/pandas | pandas/io/pickle.py | 1 | 6339 | """ pickle compat """
import warnings
import numpy as np
from numpy.lib.format import read_array, write_array
from pandas.compat import PY3, BytesIO, cPickle as pkl, pickle_compat as pc
from pandas.core.dtypes.common import _NS_DTYPE, is_datetime64_dtype
from pandas.io.common import _get_handle, _stringify_path
def... | bsd-3-clause |
tks0123456789/kaggle-Walmart_Trip_Type | utility_common.py | 1 | 4844 | import numpy as np
import scipy as sp
import pandas as pd
# Path
data_path = '../Data/'
file_train = data_path + 'train.csv'
file_test = data_path + 'test.csv'
def sign_log1p_abs(x):
return np.sign(x) * np.log1p(np.abs(x))
# Parameters:
# df:2 or 3 columns DataFrame
# row: a column for row labels
# col: a ... | mit |
mehdidc/scikit-learn | sklearn/feature_selection/tests/test_from_model.py | 244 | 1593 | import numpy as np
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import SGD... | bsd-3-clause |
tshimizu8/SomVideo | som.py | 1 | 8797 | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Steven Shimizu All Rights Reserved.
#
import math, matplotlib.pyplot as pl, matplotlib.animation as animation, numpy as np
import random, sys, datetime
RunStep = -1
class SomMap: # Self-organizing maps
def __init__(self, size, count, rate, nck):
self.A... | gpl-3.0 |
WillieMaddox/numpy | numpy/lib/npyio.py | 35 | 71412 | from __future__ import division, absolute_import, print_function
import sys
import os
import re
import itertools
import warnings
import weakref
from operator import itemgetter
import numpy as np
from . import format
from ._datasource import DataSource
from numpy.core.multiarray import packbits, unpackbits
from ._ioto... | bsd-3-clause |
RayMick/scikit-learn | benchmarks/bench_plot_omp_lars.py | 266 | 4447 | """Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
regression (:ref:`least_angle_regression`)
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model impo... | bsd-3-clause |
anntzer/scikit-learn | sklearn/covariance/_shrunk_covariance.py | 2 | 20492 | """
Covariance estimators using shrinkage.
Shrinkage corresponds to regularising `cov` using a convex combination:
shrunk_cov = (1-shrinkage)*cov + shrinkage*structured_estimate.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile ... | bsd-3-clause |
av8ramit/tensorflow | tensorflow/python/estimator/inputs/pandas_io.py | 9 | 4605 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
wallarelvo/TopoPRM | tvd/drawing.py | 2 | 2642 |
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
import matplotlib.cm as cm
import matplotlib.animation as animation
def draw_node(p, color):
plt.plot(p.x, p.y, color)
def draw_topo_graph(G):
positions = dict()
for node in G.nodes():
positions[node] = node.to_list_2d()
... | apache-2.0 |
ContextLab/hypertools | hypertools/tools/load.py | 1 | 7529 | import requests
import pandas as pd
import deepdish as dd
import os
import pickle
import warnings
from .analyze import analyze
from ..datageometry import DataGeometry
BASE_URL = 'https://docs.google.com/uc?export=download'
homedir = os.path.expanduser('~/')
datadir = os.path.join(homedir, 'hypertools_data')
datadict... | mit |
Ecotrust/nplcc | util/scale_sensitivity_rand.py | 7 | 5775 | from django.core.management import setup_environ
import os
import sys
sys.path.append(os.path.dirname(os.path.join('..','wp',__file__)))
import settings
setup_environ(settings)
#==================================#
from arp.models import WatershedPrioritization, ConservationFeature, PlanningUnit, Cost, PuVsCf, PuVsCost... | bsd-3-clause |
dcherian/pyroms | pyroms_toolbox/pyroms_toolbox/__init__.py | 1 | 2521 | #!/usr/bin/env python
'''
PYROMS_TOOLBOX is a toolbox for working with ROMS
ocean models input/output files based on PYROMS
pyroms and pyroms_toolbox are based on the
python/numpy/matplotlib scientific python suite.
NetCDF I/O is based on the NetCDF4-python package.
'''
from iview import iview
from jview import j... | bsd-3-clause |
BryanCutler/spark | dev/sparktestsupport/modules.py | 1 | 21548 | #
# 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 |
gef756/statsmodels | statsmodels/examples/ex_kernel_semilinear_dgp.py | 33 | 4969 | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 06 09:50:54 2013
Author: Josef Perktold
"""
from __future__ import print_function
if __name__ == '__main__':
import numpy as np
import matplotlib.pyplot as plt
#from statsmodels.nonparametric.api import KernelReg
import statsmodels.sandbox.nonparametr... | bsd-3-clause |
gnu-sandhi/sandhi | modules/gr36/gr-filter/examples/fmtest.py | 12 | 7793 | #!/usr/bin/env python
#
# Copyright 2009,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your optio... | gpl-3.0 |
axiom-data-science/pyaxiom | pyaxiom/netcdf/sensors/dsg/profile/om.py | 1 | 7235 | # -*- coding: utf-8 -*-
import math
from datetime import datetime
from collections import namedtuple
import netCDF4 as nc4
import numpy as np
import pandas as pd
from pygc import great_distance
from shapely.geometry import Point, LineString
from pyaxiom.utils import unique_justseen, normalize_array, generic_masked
f... | mit |
chrsrds/scikit-learn | examples/cluster/plot_kmeans_assumptions.py | 76 | 2055 | """
====================================
Demonstration of k-means assumptions
====================================
This example is meant to illustrate situations where k-means will produce
unintuitive and possibly unexpected clusters. In the first three plots, the
input data does not conform to some implicit assumptio... | bsd-3-clause |
kc-lab/dms2dfe | dms2dfe/lib/fit_curve.py | 2 | 1978 | #!usr/bin/python
# Copyright 2016, Rohan Dandage <rraadd_8@hotmail.com,rohan@igib.in>
# This program is distributed under General Public License v. 3.
"""
================================
``fit_curve``
================================
"""
import numpy as np
from scipy.optimize import curve_fit
import logging
loggi... | gpl-3.0 |
dannyperry571/theapprentice | script.module.pydevd/lib/pydev_ipython/inputhook.py | 52 | 18411 | # coding: utf-8
"""
Inputhook management for GUI event loop integration.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distribu... | gpl-2.0 |
ThomasMiconi/nupic.research | projects/sequence_prediction/continuous_sequence/nupic_output.py | 13 | 6732 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | agpl-3.0 |
FOSSEE-Manipal/sandhi-old-manasdas | benchmark/run_benchmarks.py | 8 | 4767 | import sys
import os
import time
import subprocess
import copy
import numpy
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.font_manager import FontProperties
import multiprocessing
cp... | gpl-3.0 |
treycausey/scikit-learn | sklearn/neighbors/tests/test_dist_metrics.py | 48 | 4949 | import itertools
import numpy as np
from numpy.testing import assert_array_almost_equal
import scipy
from scipy.spatial.distance import cdist
from sklearn.neighbors.dist_metrics import DistanceMetric
from nose import SkipTest
def cmp_version(version1, version2):
version1 = tuple(map(int, version1.split('.')[:2]... | bsd-3-clause |
x75/smq | experiments/conf/default_kinesis_Nd.py | 1 | 3191 | """
Default experiment for clean smp
Should be self-contained requiring now external packages or processes.
Robot: Point mass
World: open linear (1D) space
Task: go to a goal position and stay there
Brain: kinesis
Loss: mean squared error / goal distance
"""
import time
from smq.utils import make_column_names_nu... | mit |
olafhauk/mne-python | mne/viz/_figure.py | 1 | 112978 | # -*- coding: utf-8 -*-
"""Figure classes for MNE-Python's 2D plots.
Class Hierarchy
---------------
MNEFigParams Container object, attached to MNEFigure by default. Sets
close_key='escape' plus whatever other key-value pairs are
passed to its constructor.
matplotlib.figure.Figure
... | bsd-3-clause |
david-ragazzi/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/lines.py | 69 | 48233 | """
This module contains all the 2D line class which can draw with a
variety of line styles, markers and colors.
"""
# TODO: expose cap and join style attrs
from __future__ import division
import numpy as np
from numpy import ma
from matplotlib import verbose
import artist
from artist import Artist
from cbook import ... | gpl-3.0 |
marcusmueller/gnuradio | gr-filter/examples/fir_filter_ccc.py | 7 | 4023 | #!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# ... | gpl-3.0 |
graphistry/pygraphistry | graphistry/vgraph.py | 1 | 6604 | from builtins import next, str, zip
import numpy, pandas, warnings
from .graph_vector_pb2 import VectorGraph
EDGE = VectorGraph.EDGE # type: ignore
VERTEX = VectorGraph.VERTEX # type: ignore
# Creates the ETL2 protobuf vgraph from
# - edge_df: the edge dataframe
# - node_df: the node dataframe
# - sources: a s... | bsd-3-clause |
aflag/captcha-study | models.py | 1 | 3404 | # Copyright (C) 2012 Rafael Cunha de Almeida <rafael@kontesti.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | mit |
macks22/scikit-learn | sklearn/linear_model/tests/test_coordinate_descent.py | 40 | 23697 | # Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from sys import version_info
import numpy as np
from scipy import interpolate, sparse
from copy import deepcopy
from sklearn.datasets import load_boston
from sklearn.utils.testing ... | bsd-3-clause |
f3r/scikit-learn | sklearn/ensemble/tests/test_iforest.py | 19 | 6625 |
"""
Testing for Isolation Forest algorithm (sklearn.ensemble.iforest).
"""
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.... | bsd-3-clause |
kambysese/mne-python | mne/preprocessing/ica.py | 3 | 119114 | # -*- coding: utf-8 -*-
#
# Authors: Denis A. Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Juergen Dammers <j.dammers@fz-juelich.de>
#
# License: BSD (3-clause)
from inspect import isfunction
from collections import namedtuple
from copy import deepcopy
from... | bsd-3-clause |
phev8/dataset_tools | playground/ble_colocation_test.py | 1 | 17581 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import pickle
from experiment_handler.label_data_reader import read_experiment_phases, read_location_labels
from experiment_handler.imu_data_reader import get_ble_data
from feature_calculations.colocation.common import get_locat... | mit |
alan-unravel/bokeh | examples/charts/file/bar.py | 37 | 2221 | from collections import OrderedDict
import numpy as np
import pandas as pd
from bokeh.charts import Bar, output_file, show, vplot, hplot
from bokeh.models import Range1d
from bokeh.sampledata.olympics2014 import data as original_data
width = 700
height = 500
legend_position = "top_right"
data = {d['abbr']: d['medal... | bsd-3-clause |
iagapov/ocelot | gui/sr_plot.py | 2 | 4383 | __author__ = 'Sergey Tomin'
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
from matplotlib import cm
def show_flux(screen, show = 'Total', xlim = (0,0), ylim = (0,0), file_name = None, unit = "mm"):
if show == 'Total':
data = screen.Total
... | gpl-3.0 |
ABM-project/power-grid | power_grid/testAgentActitivies.py | 1 | 5209 | import network
import simulation
import power_distribution
import visualisation
import copy
import nodes
from matplotlib import cm
import background_visualisation
import node_visualisation_interpreters
import edge_visualisation_interpreters
import numpy as np
import germanNetwork
import matplotlib.pyplot as plt
import... | mit |
johnaparker/MiePy | examples/02_ag_sphere.py | 1 | 1233 | """
Example of how to make a silver sphere and plot material data,
scattering, absorption, and scattering per multipole
"""
import numpy as np
import matplotlib.pyplot as plt
from miepy.materials import Ag, plot_material
from miepy import sphere
#create a silver material (wavelengths 300-1100nm)
silver = Ag() #m... | mit |
nikitasingh981/scikit-learn | sklearn/kernel_approximation.py | 3 | 18382 | """
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 |
lancezlin/ml_template_py | lib/python2.7/site-packages/sklearn/ensemble/tests/test_iforest.py | 22 | 7155 | """
Testing for Isolation Forest algorithm (sklearn.ensemble.iforest).
"""
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.u... | mit |
Akshay0724/scikit-learn | sklearn/feature_extraction/tests/test_image.py | 38 | 11165 | # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import numpy as np
import scipy as sp
from scipy import ndimage
from numpy.testing import assert_raises
from sklearn.feature_extraction.image import (
img_to_gra... | bsd-3-clause |
nmayorov/scikit-learn | sklearn/linear_model/sag.py | 29 | 11291 | """Solvers for Ridge and LogisticRegression using SAG algorithm"""
# Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# Licence: BSD 3 clause
import numpy as np
import warnings
from ..exceptions import ConvergenceWarning
from ..utils import check_array
from ..utils.extmath import row_norms
from .base import ... | bsd-3-clause |
altairpearl/scikit-learn | sklearn/neural_network/rbm.py | 46 | 12291 | """Restricted Boltzmann Machine
"""
# Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca>
# Vlad Niculae
# Gabriel Synnaeve
# Lars Buitinck
# License: BSD 3 clause
import time
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator
from ..base import TransformerMixi... | bsd-3-clause |
ZENGXH/scikit-learn | sklearn/ensemble/tests/test_base.py | 284 | 1328 | """
Testing for the base module (sklearn.ensemble.base).
"""
# Authors: Gilles Louppe
# License: BSD 3 clause
from numpy.testing import assert_equal
from nose.tools import assert_true
from sklearn.utils.testing import assert_raise_message
from sklearn.datasets import load_iris
from sklearn.ensemble import BaggingCla... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.