repo_name stringlengths 7 92 | path stringlengths 5 149 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 911 693k | license stringclasses 15
values |
|---|---|---|---|---|---|
qifeigit/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 |
annahs/atmos_research | LEO_2D_histos_from_db.py | 1 | 3992 | import sys
import os
import datetime
import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as colors
from pprint import pprint
import sqlite3
import calendar
from datetime import datetime
#id INTEGER PRIMARY KEY AUTOINCREMENT,
#sp2b_file TEXT,
#file_index... | mit |
bert9bert/statsmodels | statsmodels/graphics/tests/test_correlation.py | 31 | 1112 | import numpy as np
from numpy.testing import dec
from statsmodels.graphics.correlation import plot_corr, plot_corr_grid
from statsmodels.datasets import randhie
try:
import matplotlib.pyplot as plt
have_matplotlib = True
except:
have_matplotlib = False
@dec.skipif(not have_matplotlib)
def test_plot_cor... | bsd-3-clause |
jakevdp/bokeh | bokeh/mplexporter/renderers/base.py | 44 | 14355 | import warnings
import itertools
from contextlib import contextmanager
import numpy as np
from matplotlib import transforms
from .. import utils
from .. import _py3k_compat as py3k
class Renderer(object):
@staticmethod
def ax_zoomable(ax):
return bool(ax and ax.get_navigate())
@staticmethod
... | bsd-3-clause |
stefangri/s_s_productions | PHY341/V401_Interferometer/Messdaten/latex.py | 2 | 2289 | from pandas import Series, DataFrame
import pandas as pd
import collections
import numpy
import uncertainties
import pint
from uncertainties import ufloat
from uncertainties import ufloat_fromstr
from pint import UnitRegistry
import string
ureg = UnitRegistry()
Q_ = ureg.Quantity
class Latexdocument(object):
def ... | mit |
cajal/pipeline | python/pipeline/utils/galvo_corrections.py | 5 | 13668 | """ Utilities for motion and raster correction of resonant scans. """
import numpy as np
from scipy import interpolate as interp
from scipy import signal
from scipy import ndimage
from ..exceptions import PipelineException
from ..utils.signal import mirrconv
def compute_raster_phase(image, temporal_fill_fraction):
... | lgpl-3.0 |
michigraber/scikit-learn | sklearn/ensemble/tests/test_forest.py | 48 | 35412 | """
Testing for the forest module (sklearn.ensemble.forest).
"""
# Authors: Gilles Louppe,
# Brian Holt,
# Andreas Mueller,
# Arnaud Joly
# License: BSD 3 clause
import pickle
from collections import defaultdict
from itertools import product
import numpy as np
from scipy.sparse import csr_... | bsd-3-clause |
georgid/sms-tools | lectures/7-Sinusoidal-plus-residual-model/plots-code/stochasticSynthesisFrame.py | 2 | 2997 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, hanning, triang, blackmanharris, resample
import math
import sys, os, time
from scipy.fftpack import fft, ifft
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import utilFunction... | agpl-3.0 |
tedunderwood/horizon | chapter3/code/reproduce_fictional_prestige.py | 1 | 7078 | #!/usr/bin/env python3
# reproduce_fictional_prestige.py
# Scripts to reproduce models
# used in Chapter Three,
# The Directions of Literary Change.
import csv, os, sys, pickle, math
# we add a path to be searched so that we can import
# versatiletrainer, which will do most of the work
# Versatiletrainer, and the m... | mit |
nguyentu1602/statsmodels | statsmodels/graphics/factorplots.py | 28 | 7596 | # -*- coding: utf-8 -*-
"""
Authors: Josef Perktold, Skipper Seabold, Denis A. Engemann
"""
from statsmodels.compat.python import get_function_name, iterkeys, lrange, zip, iteritems
import numpy as np
from statsmodels.graphics.plottools import rainbow
import statsmodels.graphics.utils as utils
def interaction_plo... | bsd-3-clause |
jm-begon/scikit-learn | sklearn/__init__.py | 154 | 3014 | """
Machine learning module for Python
==================================
sklearn is a Python module integrating classical machine
learning algorithms in the tightly-knit world of scientific Python
packages (numpy, scipy, matplotlib).
It aims to provide simple and efficient solutions to learning problems
that are acc... | bsd-3-clause |
reuk/wayverb | scripts/python/dispersion.py | 2 | 6340 | from math import e, pi
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors, ticker, cm
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import operator
def get_base_vectors(flip):
ret = [
np.array([0.0, 2.0 * np.sqrt(2.0) / 3.0, 1.0 / 3.0]),
... | gpl-2.0 |
mompiou/misorientation | misorientation.py | 1 | 48149 | #!/usr/bin/python
from __future__ import division
import numpy as np
from Tkinter import *
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from matplotlib import pyplot as plt
from PIL import Image
from PIL import PngImagePlugin
impo... | gpl-2.0 |
swharden/SWHLab | doc/uses/EPSCs-and-IPSCs/smooth histogram method/05.py | 1 | 1812 | """
MOST OF THIS CODE IS NOT USED
ITS COPY/PASTED AND LEFT HERE FOR CONVENIENCE
"""
import os
import sys
# in case our module isn't installed (running from this folder)
if not os.path.abspath('../../../') in sys.path:
sys.path.append('../../../') # helps spyder get docs
import swhlab
import swhlab.common as cm
i... | mit |
blbarker/spark-tk | regression-tests/sparktkregtests/testcases/models/gmm_test.py | 12 | 7116 | # vim: set encoding=utf-8
# Copyright (c) 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 require... | apache-2.0 |
chrisburr/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 |
NelisVerhoef/scikit-learn | examples/manifold/plot_mds.py | 261 | 2616 | """
=========================
Multi-dimensional scaling
=========================
An illustration of the metric and non-metric MDS on generated noisy data.
The reconstructed points using the metric MDS and non metric MDS are slightly
shifted to avoid overlapping.
"""
# Author: Nelle Varoquaux <nelle.varoquaux@gmail.... | bsd-3-clause |
pauliacomi/pyGAPS | tests/characterisation/test_t_plot.py | 1 | 2958 | """
This test module has tests relating to t-plots
All functions in /calculations/tplot.py are tested here.
The purposes are:
- testing the user-facing API function (tplot)
- testing individual low level functions against known results.
Functions are tested against pre-calculated values on real isotherms.
Al... | mit |
christianurich/VIBe2UrbanSim | 3rdparty/opus/src/vibe_min/indicators/make_indicators.py | 4 | 4825 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
# script to produce a number of PSRC indicators --
# this illustrates using traits-based configurations programatically
from opus_core.configurations.dataset_pool_configuration import DatasetP... | gpl-2.0 |
anacode/anacode-toolkit | anacode/api/writers.py | 1 | 20217 | # -*- coding: utf-8 -*-
import os
import csv
import datetime
import pandas as pd
from itertools import chain
from functools import partial
from anacode import codes
def backup(root, files):
"""Backs up `files` from `root` directory and return list of backed up
file names. Backed up files will have datetime s... | bsd-3-clause |
boland1992/seissuite_iran | build/lib.linux-x86_64-2.7/seissuite/ant/psdepthmodel.py | 6 | 9233 | """
Module taking care of the forward modelling: theoretical dispersion
curve given a 1D crustal model of velocities and densities.
Uses the binaries of the Computer Programs in Seismology, with
must be installed in *COMPUTER_PROGRAMS_IN_SEISMOLOGY_DIR*
"""
import numpy as np
import matplotlib.pyplot as plt
import os
... | gpl-3.0 |
ucdrascal/hcibench | axopy/storage.py | 2 | 12668 | """Experiment data storage.
There are two main use cases for the functionality in this module:
reading/writing data during an experiment session, and reading data once an
experiment is complete (i.e. for analysis). See the :ref:`user guide <storage>`
for information on these use cases/api.jpeg/api.jpeg/api.jpeg.
"""
... | mit |
GreenGear5/planet-wars | bots/ml-rfc/ml-rfc.py | 1 | 4276 | #!/usr/bin/env python
"""
Uses the Random Forest classifier
"""
from api import State, util
import random, os
from sklearn.externals import joblib
DEFAULT_MODEL = os.path.dirname(os.path.realpath(__file__)) + '/model.pkl'
class Bot:
__max_depth = -1
__randomize = True
__model = None
def __init__... | mit |
nettrom/importance | python/wikiproject/confusion-matrix.py | 1 | 8866 | #!/usr/env/python
# -*- coding: utf-8 -*-
'''
Script to predict articles for an entire WikiProject using its trained
model and the entire snapshot dataset.
Copyright (c) 2017 Morten Wang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (t... | mit |
saeidadli/Python-ArcGIS-Convertor | arcgdfconvertor/convertor.py | 1 | 3491 | import os
import sys
import tempfile
from pathlib import Path
import arcpy
import pandas as pd
import numpy as np
import geopandas as gpd
#constants
#WGS_1984 coordinate system
WGS_1984 = \
"GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984', "+\
"SPHEROID['WGS_1984',6378137.0,298.257223563]], "+\
"PRIMEM['Greenwi... | mit |
aringh/odl | examples/tomo/backends/astra_performance_cuda_parallel_2d_cg.py | 1 | 2880 | """Performance example of running native ASTRA vs using ODL for reconstruction.
In this example, a 512x512 image is reconstructed using the Conjugate Gradient
Least Squares method on the GPU.
In general, ASTRA is faster than ODL since it does not need to perform any
copies and all arithmetic is performed on the GPU. ... | mpl-2.0 |
mne-tools/mne-python | examples/connectivity/mne_inverse_connectivity_spectrum.py | 6 | 3460 | """
==============================================================
Compute full spectrum source space connectivity between labels
==============================================================
The connectivity is computed between 4 labels across the spectrum
between 7.5 Hz and 40 Hz.
"""
# Authors: Alexandre Gramfort... | bsd-3-clause |
buqing2009/MissionPlanner | Lib/site-packages/scipy/optimize/nonlin.py | 53 | 46004 | r"""
Nonlinear solvers
=================
.. currentmodule:: scipy.optimize
This is a collection of general-purpose nonlinear multidimensional
solvers. These solvers find *x* for which *F(x) = 0*. Both *x*
and *F* can be multidimensional.
Routines
--------
Large-scale nonlinear solvers:
.. autosummary::
newton... | gpl-3.0 |
mariocannistra/radio-astronomy | findsessionrange.py | 1 | 1973 | #!/usr/bin/python
# this source is part of my Hackster.io project: https://www.hackster.io/mariocannistra/radio-astronomy-with-rtl-sdr-raspberrypi-and-amazon-aws-iot-45b617
# this program will determine the overall range of signal strengths received during the whole session.
# this program can be run standalone bu... | mit |
TAMU-CPT/galaxy-tools | tools/genome_viz/brigaid.py | 1 | 36126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
AUTHOR
Pedro Cerqueira
github: @pedrorvc
DESCRIPTION
This script serves to create xml files contaning the information necessary
for the execution of BRIG (Blast Ring Image Generator), reducing the time
performing the tedious task of setting u... | gpl-3.0 |
yuanagain/seniorthesis | venv/lib/python2.7/site-packages/matplotlib/tests/test_basic.py | 7 | 1290 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
from nose.tools import assert_equal
from matplotlib.testing.decorators import knownfailureif
from pylab import *
def test_simple():
assert_equal(1 + 1, 2)
@knownfa... | mit |
valexandersaulys/prudential_insurance_kaggle | venv/lib/python2.7/site-packages/pandas/tests/test_algos.py | 9 | 24744 | # -*- coding: utf-8 -*-
from pandas.compat import range
import numpy as np
from numpy.random import RandomState
from pandas.core.api import Series, Categorical, CategoricalIndex
import pandas as pd
from pandas import compat
import pandas.core.algorithms as algos
import pandas.util.testing as tm
import pandas.hashtab... | gpl-2.0 |
hoytak/SFrame | oss_src/unity/python/sframe/test/test_dataframe.py | 5 | 1775 | '''
Copyright (C) 2016 Turi
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
'''
import unittest
import pandas
import array
from .. import SFrame
from pandas.util.testing import assert_frame_equal
from sys import version_info
clas... | bsd-3-clause |
crichardson17/starburst_atlas | Low_resolution_sims/DustFree_LowRes/Geneva_noRot_cont/Geneva_noRot_cont_age5/UV2.py | 33 | 7365 | import csv
import matplotlib.pyplot as plt
from numpy import *
import scipy.interpolate
import math
from pylab import *
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import matplotlib.patches as patches
from matplotlib.path import Path
import os
# --------------------------------------------------... | gpl-2.0 |
sumspr/scikit-learn | sklearn/metrics/cluster/bicluster.py | 359 | 2797 | from __future__ import division
import numpy as np
from sklearn.utils.linear_assignment_ import linear_assignment
from sklearn.utils.validation import check_consistent_length, check_array
__all__ = ["consensus_score"]
def _check_rows_and_columns(a, b):
"""Unpacks the row and column arrays and checks their shap... | bsd-3-clause |
mlperf/training_results_v0.7 | NVIDIA/benchmarks/minigo/implementations/tensorflow/minigo/oneoffs/training_curve.py | 8 | 5964 | # Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
RachitKansal/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 |
numb3r33/StumbpleUponChallenge | src/data/make_dataset.py | 1 | 1475 | import pandas as pd
import numpy as np
import json
from unidecode import unidecode
def extract_domain(url):
# extract domains
domain = url.lower().split('/')[2]
domain_parts = domain.split('.')
# e.g. co.uk
if domain_parts[-2] not in ['com', 'co']:
return '.'.join(domain_parts[-2:])
e... | mit |
stonebig/bokeh | bokeh/util/hex.py | 2 | 8263 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bsd-3-clause |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/transforms.py | 2 | 88425 | """
matplotlib includes a framework for arbitrary geometric
transformations that is used determine the final position of all
elements drawn on the canvas.
Transforms are composed into trees of :class:`TransformNode` objects
whose actual value depends on their children. When the contents of
children change, their pare... | mit |
schets/scikit-learn | sklearn/decomposition/tests/test_nmf.py | 14 | 6123 | import numpy as np
from scipy import linalg
from sklearn.decomposition import nmf
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import raises
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_gr... | bsd-3-clause |
etkirsch/scikit-learn | sklearn/decomposition/tests/test_pca.py | 199 | 10949 | import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_rai... | bsd-3-clause |
shyamalschandra/scikit-learn | sklearn/preprocessing/__init__.py | 268 | 1319 | """
The :mod:`sklearn.preprocessing` module includes scaling, centering,
normalization, binarization and imputation methods.
"""
from ._function_transformer import FunctionTransformer
from .data import Binarizer
from .data import KernelCenterer
from .data import MinMaxScaler
from .data import MaxAbsScaler
from .data ... | bsd-3-clause |
jblackburne/scikit-learn | doc/sphinxext/sphinx_gallery/notebook.py | 9 | 3565 | # -*- coding: utf-8 -*-
r"""
============================
Parser for Jupyter notebooks
============================
Class that holds the Ipython notebook information
"""
# Author: Óscar Nájera
# License: 3-clause BSD
from __future__ import division, absolute_import, print_function
import json
import os
import re
imp... | bsd-3-clause |
sonalranjit/SECS | SECS_trace.py | 2 | 1609 | __author__ = 'sonal'
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
import os
from math import *
def polar_plot(grid, title):
#z = grid[:,8]
u = grid[:,8]
v = grid[:,9]
plt.f... | gpl-2.0 |
rjonnal/zernike | __init__.py | 1 | 20006 | """This module contains functions for Zernike calculations. Mainly the private
function _zgen, a generator function for Zernike polynomials. The public
functions make use of _zgen to create height or slope maps in a unit
pupil, corresponding to individual Zernike terms.
Author: Ravi S. Jonnal / Werner Lab, UC Davis
R... | gpl-2.0 |
palashahuja/pgmpy | pgmpy/estimators/MLE.py | 2 | 3259 | from pgmpy.estimators import BaseEstimator
from pgmpy.factors import TabularCPD
from pgmpy.models import BayesianModel
import numpy as np
class MaximumLikelihoodEstimator(BaseEstimator):
"""
Class used to compute parameters for a model using Maximum Likelihood Estimate.
Parameters
----------
mode... | mit |
B3AU/waveTree | examples/ensemble/plot_bias_variance.py | 6 | 7330 | """
============================================================
Single estimator versus bagging: bias-variance decomposition
============================================================
This example illustrates and compares the bias-variance decomposition of the
expected mean squared error of a single estimator again... | bsd-3-clause |
alorenzo175/pvlib-python | pvlib/test/test_forecast.py | 1 | 5733 | from datetime import datetime, timedelta
from pytz import timezone
import warnings
import pandas as pd
import pytest
from numpy.testing import assert_allclose
from conftest import requires_siphon, has_siphon, skip_windows
pytestmark = pytest.mark.skipif(not has_siphon, reason='requires siphon')
if has_siphon:
... | bsd-3-clause |
abele/bokeh | examples/plotting/file/boxplot.py | 43 | 2269 | import numpy as np
import pandas as pd
from bokeh.plotting import figure, show, output_file
# Generate some synthetic time series for six different categories
cats = list("abcdef")
yy = np.random.randn(2000)
g = np.random.choice(cats, 2000)
for i, l in enumerate(cats):
yy[g == l] += i // 2
df = pd.DataFrame(dict(s... | bsd-3-clause |
RuthAngus/LSST-max | code/GP_periodogram.py | 1 | 1066 | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from GProtation import make_plot, lnprob, neglnlike
import emcee
import time
import george
from george.kernels import ExpSquaredKernel, ExpSine2Kernel
import scipy.optimize as spo
def GP_periodogram(x, y, yerr, p_init, plims, N):
... | mit |
locksmithone/qcnsim | tag/20140102/doc/validations/weibull/weibullGenerator.py | 3 | 3655 | import numpy
#import scipy
import matplotlib.pyplot
import math
def weibullGenerator(scale, shape, start, end, step):
'''
Generates Weibull sample lists per the parameters.
Returns two lists of X and Y values distributed per Weibull.
'''
weibullSamplesY = []
weibullSamplesX = []
for i ... | lgpl-2.1 |
toastedcornflakes/scikit-learn | sklearn/linear_model/tests/test_base.py | 83 | 15089 | # 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... | bsd-3-clause |
ccd-utexas/OLD-MAID | ProEMOnline.py | 2 | 57911 | # -*- coding: utf-8 -*-
"""
This scripts sets an initial layout for the ProEMOnline software. It uses the
PyQtGraph dockarea system and was designed from the dockarea.py example.
Keaton wrote this.
"""
#Import everything you'll need
from __future__ import absolute_import, division
import pyqtgraph as pg
from pyqtgr... | mit |
ltiao/scikit-learn | sklearn/tests/test_base.py | 216 | 7045 | # Author: Gael Varoquaux
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing impo... | bsd-3-clause |
rajathkumarmp/numpy | numpy/fft/fftpack.py | 72 | 45497 | """
Discrete Fourier Transforms
Routines in this module:
fft(a, n=None, axis=-1)
ifft(a, n=None, axis=-1)
rfft(a, n=None, axis=-1)
irfft(a, n=None, axis=-1)
hfft(a, n=None, axis=-1)
ihfft(a, n=None, axis=-1)
fftn(a, s=None, axes=None)
ifftn(a, s=None, axes=None)
rfftn(a, s=None, axes=None)
irfftn(a, s=None, axes=None... | bsd-3-clause |
bigdataelephants/scikit-learn | sklearn/metrics/cluster/tests/test_unsupervised.py | 26 | 2870 | import numpy as np
from scipy.sparse import csr_matrix
from .... import datasets
from ..unsupervised import silhouette_score
from ... import pairwise_distances
from sklearn.utils.testing import assert_false, assert_almost_equal
from sklearn.utils.testing import assert_raises_regexp
def test_silhouette():
"""Test... | bsd-3-clause |
cactusbin/nyt | matplotlib/examples/axes_grid/demo_curvelinear_grid2.py | 15 | 1839 | import numpy as np
#from matplotlib.path import Path
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.grid_helper_curvelinear import GridHelperCurveLinear
from mpl_toolkits.axes_grid.axislines import Subplot
import mpl_toolkits.axes_grid.angle_helper as angle_helper
def curvelinear_test1(fig):
"""
... | unlicense |
wavelets/zipline | zipline/finance/performance/period.py | 3 | 16164 | #
# 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 |
joyeshmishra/spark-tk | regression-tests/generatedata/gmm_datagen.py | 14 | 1129 | # vim: set encoding=utf-8
# Copyright (c) 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 require... | apache-2.0 |
biorack/metatlas | metatlas/io/write_utils.py | 1 | 2914 | """ Utility functions used in writing files"""
import filecmp
import logging
import os
import tempfile
logger = logging.getLogger(__name__)
def make_dir_for(file_path):
"""makes directories for file_path if they don't already exist"""
directory = os.path.dirname(file_path)
if directory != "":
os... | bsd-3-clause |
shear/rppy | test_ruger_hti.py | 2 | 2682 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 3 17:24:04 2015
@author: Sean
"""
import rppy
import numpy as np
import matplotlib.pyplot as plt
p1 = 2000
vp1 = 3000
vs1 = 1500
e1 = 0.0
d1 = 0.0
y1 = 0.0
p2 = 2200
vp2 = 4000
vs2 = 2000
y2 = 0.1
d2 = 0.1
e2 = 0.1
theta = 30
phi = np.arange(0, 90, 1)
phit = np.arra... | bsd-2-clause |
andnovar/ggplot | ggplot/scales/scale_colour_gradient.py | 12 | 2017 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from .scale import scale
from copy import deepcopy
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap, rgb2hex, ColorConverter
def colors_at_breaks(cmap, breaks=[0, 0.25, 0.5... | bsd-2-clause |
cdek11/PLS | Code/PLS_Algorithm_Optimized.py | 2 | 5817 |
# coding: utf-8
# In[2]:
# Code to implement the optimized version of the PLS Algorithm
import pandas as pd
import numpy as np
import numba
from numba import jit
@jit
def mean_center_scale(dataframe):
'''Scale dataframe by subtracting mean and dividing by standard deviation'''
dataframe = dataframe - dataf... | mit |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/pandas/io/date_converters.py | 10 | 1827 | """This module is designed for community supported date conversion functions"""
from pandas.compat import range, map
import numpy as np
import pandas._libs.lib as lib
def parse_date_time(date_col, time_col):
date_col = _maybe_cast(date_col)
time_col = _maybe_cast(time_col)
return lib.try_parse_date_and_ti... | mit |
felipessalvatore/CNNexample | src/tunning/fc.py | 1 | 2217 | import os
import sys
from random import randint
import numpy as np
import inspect
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from ut... | mit |
hdmetor/scikit-learn | examples/mixture/plot_gmm_selection.py | 248 | 3223 | """
=================================
Gaussian Mixture Model Selection
=================================
This example shows that model selection can be performed with
Gaussian Mixture Models using information-theoretic criteria (BIC).
Model selection concerns both the covariance type
and the number of components in th... | bsd-3-clause |
anurag313/scikit-learn | sklearn/utils/tests/test_multiclass.py | 128 | 12853 |
from __future__ import division
import numpy as np
import scipy.sparse as sp
from itertools import product
from sklearn.externals.six.moves import xrange
from sklearn.externals.six import iteritems
from scipy.sparse import issparse
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sp... | bsd-3-clause |
jseabold/scikit-learn | sklearn/tests/test_naive_bayes.py | 32 | 17897 | import pickle
from io import BytesIO
import numpy as np
import scipy.sparse
from sklearn.datasets import load_digits, load_iris
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert... | bsd-3-clause |
sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/mpl_toolkits/axisartist/axisline_style.py | 8 | 5277 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from matplotlib.patches import _Style, FancyArrowPatch
from matplotlib.transforms import IdentityTransform
from matplotlib.path import Path
import numpy as np
class _FancyAxislineStyle:
class S... | mit |
mjudsp/Tsallis | examples/plot_isotonic_regression.py | 303 | 1767 | """
===================
Isotonic Regression
===================
An illustration of the isotonic regression on generated data. The
isotonic regression finds a non-decreasing approximation of a function
while minimizing the mean squared error on the training data. The benefit
of such a model is that it does not assume a... | bsd-3-clause |
BiaDarkia/scikit-learn | sklearn/kernel_ridge.py | 16 | 6766 | """Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <mathieu@mblondel.org>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from .base import BaseEstimator, RegressorMixin
from .metrics.pairwise import pairwise... | bsd-3-clause |
caidongyun/BuildingMachineLearningSystemsWithPython | ch07/lr10k.py | 24 | 1228 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import numpy as np
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.datasets impor... | mit |
airanmehr/Utils | Simulation.py | 1 | 40529 | '''
Copyleft Oct 10, 2015 Arya Iranmehr, PhD Student, Bafna's Lab, UC San Diego, Email: airanmehr@gmail.com
'''
from __future__ import division
import numpy as np;
import pandas as pd;
np.set_printoptions(linewidth=140, precision=5, suppress=True)
import subprocess, uuid, os,sys
import pylab as plt
import UTILS.Util... | mit |
ansobolev/regCMPostProc | src/plot.py | 1 | 2816 | #!/usr/bin/env python
# RegCM postprocessing tool
# Copyright (C) 2014 Aliou, Addisu, Kanhu, Andrey
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | gpl-3.0 |
wmvanvliet/mne-python | examples/time_frequency/plot_source_power_spectrum.py | 19 | 1959 | """
======================================================
Compute source power spectral density (PSD) in a label
======================================================
Returns an STC file containing the PSD (in dB) of each of the sources
within a label.
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
... | bsd-3-clause |
destijl/forensicartifacts | frontend/thirdparty/networkx-1.9/examples/graph/napoleon_russian_campaign.py | 44 | 3216 | #!/usr/bin/env python
"""
Minard's data from Napoleon's 1812-1813 Russian Campaign.
http://www.math.yorku.ca/SCS/Gallery/minard/minard.txt
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
# Copyright (C) 2006 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <sw... | apache-2.0 |
zarafagroupware/python-zarafa | scripts/z-barplot.py | 2 | 1667 | #!/usr/bin/env python
import zarafa
import matplotlib.pyplot as plt
def opt_args():
parser = zarafa.parser('skpc')
parser.add_option('--save', dest='save', action='store', help='Save plot to file (png)')
return parser.parse_args()
def b2m(bytes):
return (bytes / 1024) / 1024
def main():
options,... | agpl-3.0 |
tosolveit/scikit-learn | sklearn/decomposition/tests/test_pca.py | 199 | 10949 | import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_rai... | bsd-3-clause |
pap/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/fontconfig_pattern.py | 72 | 6429 | """
A module for parsing and generating fontconfig patterns.
See the `fontconfig pattern specification
<http://www.fontconfig.org/fontconfig-user.html>`_ for more
information.
"""
# Author : Michael Droettboom <mdroe@stsci.edu>
# License : matplotlib license (PSF compatible)
# This class is defined here because it m... | agpl-3.0 |
sevenian3/ChromaStarPy | solartest.py | 1 | 6462 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 30 10:54:21 2017
@author: ishort
"""
#plotting:
import matplotlib
import matplotlib.pyplot as plt
#%matplotlib inline
import pylab
#General file for printing ad hoc quantities
#dbgHandle = open("debug.out", 'w')
#Get the data
dataPath = "SolFluxAtlas20... | mit |
frank-tancf/scikit-learn | sklearn/neighbors/tests/test_neighbors.py | 25 | 45729 | from itertools import product
import numpy as np
from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix,
dok_matrix, lil_matrix)
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.... | bsd-3-clause |
OrkoHunter/networkx | examples/graph/atlas.py | 54 | 2609 | #!/usr/bin/env python
"""
Atlas of all graphs of 6 nodes or less.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
# Copyright (C) 2004 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx... | bsd-3-clause |
pv/scikit-learn | sklearn/utils/tests/test_validation.py | 133 | 18339 | """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 nose.tools import assert_raises, assert_true, assert_false, assert_equal
from sklearn.utils.... | bsd-3-clause |
herilalaina/scikit-learn | examples/feature_selection/plot_f_test_vs_mi.py | 82 | 1671 | """
===========================================
Comparison of F-test and mutual information
===========================================
This example illustrates the differences between univariate F-test statistics
and mutual information.
We consider 3 features x_1, x_2, x_3 distributed uniformly over [0, 1], the
targ... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/mpl_examples/misc/font_indexing.py | 4 | 1299 | """
A little example that shows how the various indexing into the font
tables relate to one another. Mainly for mpl developers....
"""
import matplotlib
from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED
#fname = '/usr/share/fonts/sfd/FreeSans.ttf'
fname = matplotlib.get_da... | gpl-2.0 |
shikhardb/scikit-learn | sklearn/utils/random.py | 19 | 10413 | # Author: Hamzeh Alsalhi <ha258@cornell.edu>
#
# License: BSD 3 clause
from __future__ import division
import numpy as np
import scipy.sparse as sp
import operator
import array
from sklearn.utils import check_random_state
from ._random import sample_without_replacement
__all__ = ['sample_without_replacement', 'choic... | bsd-3-clause |
napjon/moocs_solution | ml-udacity/tools/startup.py | 5 | 1048 | #!/usr/bin/python
print
print "checking for nltk"
try:
import nltk
except ImportError:
print "you should install nltk before continuing"
print "checking for numpy"
try:
import numpy
except ImportError:
print "you should install numpy before continuing"
print "checking for sklearn"
try:
import skl... | mit |
scipy/scipy | scipy/odr/models.py | 19 | 7660 | """ Collection of Model instances for use with the odrpack fitting package.
"""
import numpy as np
from scipy.odr.odrpack import Model
__all__ = ['Model', 'exponential', 'multilinear', 'unilinear', 'quadratic',
'polynomial']
def _lin_fcn(B, x):
a, b = B[0], B[1:]
b.shape = (b.shape[0], 1)
ret... | bsd-3-clause |
abhijeet-talaulikar/Automatic-Helmet-Detection | K-Fold/Logistic_Regression.py | 1 | 2663 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
from sklearn.model_selection import KFold
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import *
from timeit import default_timer as timer
from random import randint
from sklearn.feature_selection im... | gpl-3.0 |
kmike/scikit-learn | sklearn/utils/tests/test_validation.py | 5 | 5499 | """Tests for input validation functions"""
from tempfile import NamedTemporaryFile
import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true, assert_false, assert_equal
from sklearn.utils import (array2d, as_float_array, atleast2d_or_cs... | bsd-3-clause |
kHarshit/DAT210x_Microsoft | Module2/assignment3.py | 1 | 1178 | import pandas as pd
# TODO: Load up the dataset Ensuring you set the appropriate header column names
df = pd.read_csv('Datasets/servo.data')
df.columns = ['motor', 'screw', 'pgain', 'vgain', 'class']
print(df.describe())
# TODO: Create a slice that contains all entries having a vgain equal to 5. Then print the lengt... | mit |
msingh172/pylearn2 | pylearn2/models/independent_multiclass_logistic.py | 44 | 2491 | """
Multiclass-classification by taking the max over a set of one-against-rest
logistic classifiers.
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googleg... | bsd-3-clause |
aabadie/scikit-learn | benchmarks/bench_plot_neighbors.py | 101 | 6469 | """
Plot the scaling of the nearest neighbors algorithms with k, D, and N
"""
from time import time
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import ticker
from sklearn import neighbors, datasets
def get_data(N, D, dataset='dense'):
if dataset == 'dense':
np.random.seed(0)
... | bsd-3-clause |
linebp/pandas | pandas/tests/series/test_indexing.py | 1 | 88099 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import pytest
from datetime import datetime, timedelta
from numpy import nan
import numpy as np
import pandas as pd
import pandas._libs.index as _index
from pandas.core.dtypes.common import is_integer, is_scalar
from pandas import (Index, Series, DataFrame, isnull,
... | bsd-3-clause |
arahuja/scikit-learn | benchmarks/bench_20newsgroups.py | 377 | 3555 | from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... | bsd-3-clause |
academicpages/academicpages.github.io | markdown_generator/publications.py | 197 | 3887 |
# coding: utf-8
# # Publications markdown generator for academicpages
#
# Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook, with the core python code in publications.py. Run either from the `markdown_g... | mit |
charman2/rsas | examples/unsteady.py | 1 | 5254 | # -*- coding: utf-8 -*-
"""Storage selection (SAS) functions: example with multiple fluxes out at steady state
Runs the rSAS model for a synthetic dataset with one flux in and
multiple fluxes out and steady state flow
Theory is presented in:
Harman, C. J. (2014), Time-variable transit time distributions and transport... | mit |
keflavich/pyspeckit | docs/conf.py | 4 | 12272 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# 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 file.
#
# All configurati... | mit |
cauchycui/scikit-learn | examples/linear_model/plot_ols_ridge_variance.py | 387 | 2060 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.