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 |
|---|---|---|---|---|---|
bjmain/host_choice_GWAS_arabiensis | pca/plot_pca.py | 1 | 1114 | import pylab as P
#from matplotlib import rc #for adding italics. Via latex style
#rc('text', usetex=True)
human=[line.strip() for line in open("allhumanfed.txt")]
cattle=[line.strip() for line in open("allcattlefed.txt")]
cattlex=[]
cattley=[]
humanx=[]
humany=[]
for line in open("LUPI_maf_pca.eigenvec"):
i=l... | mit |
waynenilsen/statsmodels | statsmodels/datasets/modechoice/data.py | 25 | 3031 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Travel Mode Choice"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
Greene, W.H. and D. Hensher (1997) Multinomial logit and discrete choice models
in Greene, W. H. (1997) LIMDEP version 7.0 user's manual rev... | bsd-3-clause |
jaeilepp/mne-python | tutorials/plot_introduction.py | 6 | 15342 | # -*- coding: utf-8 -*-
"""
.. _intro_tutorial:
Basic MEG and EEG data processing
=================================
.. image:: http://mne-tools.github.io/stable/_static/mne_logo.png
MNE-Python reimplements most of MNE-C's (the original MNE command line utils)
functionality and offers transparent scripting.
On top of... | bsd-3-clause |
sanketloke/scikit-learn | sklearn/cross_decomposition/cca_.py | 151 | 3192 | from .pls_ import _PLS
__all__ = ['CCA']
class CCA(_PLS):
"""CCA Canonical Correlation Analysis.
CCA inherits from PLS with mode="B" and deflation_mode="canonical".
Read more in the :ref:`User Guide <cross_decomposition>`.
Parameters
----------
n_components : int, (default 2).
numb... | bsd-3-clause |
cwu2011/scikit-learn | sklearn/linear_model/stochastic_gradient.py | 130 | 50966 | # Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author)
# Mathieu Blondel (partial_fit support)
#
# License: BSD 3 clause
"""Classification and regression using Stochastic Gradient Descent (SGD)."""
import numpy as np
import scipy.sparse as sp
from abc import ABCMeta, abstractmethod
from ... | bsd-3-clause |
CDSFinance/zipline | tests/history_cases.py | 7 | 21388 | """
Test case definitions for history tests.
"""
import pandas as pd
import numpy as np
from zipline.finance.trading import TradingEnvironment
from zipline.history.history import HistorySpec
from zipline.protocol import BarData
from zipline.utils.test_utils import to_utc
_cases_env = TradingEnvironment()
def mixed... | apache-2.0 |
Djabbz/scikit-learn | sklearn/metrics/classification.py | 1 | 67719 | """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 |
IssamLaradji/scikit-learn | examples/cluster/plot_lena_segmentation.py | 271 | 2444 | """
=========================================
Segmenting the picture of Lena in regions
=========================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to break this image into multiple
partly-homogeneous regions.
This procedure (spe... | bsd-3-clause |
paztronomer/kepler_tools | zoomLC_v01.py | 1 | 3598 | # Script to plot LC and a zoom to it
# source code from: http://matplotlib.org/examples/pylab_examples/axes_zoom_effect.html
from matplotlib.transforms import Bbox, TransformedBbox, blended_transform_factory
from mpl_toolkits.axes_grid1.inset_locator import BboxPatch, BboxConnector, BboxConnectorPatch
def connect_bb... | mit |
manipopopo/tensorflow | tensorflow/examples/tutorials/input_fn/boston.py | 76 | 2920 | # 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 appl... | apache-2.0 |
mitschabaude/nanopores | scripts/random_walk_aHem/varplots.py | 1 | 5114 | from sys import path
from scipy import special
from scipy import integrate
import numpy as np
from math import pi, sqrt,exp
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
sims=np.sum(np.load('counter.npy'))
time=5e6
path.append('/home/benjamin/projekt/texfiles/')
from colors import *
kb=1.... | mit |
maxiee/MyCodes | KalmanAndBesianFiltersInPython/MyKalman/OneDKalman.py | 1 | 1074 | import stats
import sensor
import matplotlib.pyplot as plt
def update(mean, variance, measurement, measurement_variance):
return stats.multiply(mean, variance, measurement, measurement_variance)
def predict(pos, variance, movement, movement_variance):
return (pos + movement, variance + movement_variance)
m... | gpl-3.0 |
pedrocamargo/map_matching | example_MPO_Data.py | 1 | 1289 | import os, sys
import pandas as pd
from map_matching import *
out_folder = load_parameters('output_folder')
single_trip = Trip()
# data quality parameters
p = load_parameters('data quality')
single_trip.set_data_quality_parameters(p)
single_trip.set_stop_algorithm('Maximum space')
p = load_parameters('stops paramet... | apache-2.0 |
glouppe/scikit-learn | sklearn/tree/tree.py | 5 | 40442 | """
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 |
Windy-Ground/scikit-learn | examples/cluster/plot_lena_ward_segmentation.py | 271 | 1998 | """
===============================================================
A demo of structured Ward hierarchical clustering on Lena image
===============================================================
Compute the segmentation of a 2D image with Ward hierarchical
clustering. The clustering is spatially constrained in order
... | bsd-3-clause |
q1ang/seaborn | seaborn/tests/test_categorical.py | 8 | 75157 | import numpy as np
import pandas as pd
import scipy
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
from distutils.version import LooseVersion
pandas_has_categoricals = LooseVersion(pd.__version__) >= "0.15"
import nose.tools as nt
import numpy.testing as npt
from numpy.testing.decora... | bsd-3-clause |
mikebenfield/scikit-learn | examples/svm/plot_svm_anova.py | 85 | 2024 | """
=================================================
SVM-Anova: SVM with univariate feature selection
=================================================
This example shows how to perform univariate feature selection before running a
SVC (support vector classifier) to improve the classification scores.
"""
print(__doc_... | bsd-3-clause |
yufeldman/arrow | python/pyarrow/compat.py | 4 | 3822 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
felipebetancur/scipy | scipy/stats/stats.py | 18 | 169352 | # Copyright (c) Gary Strangman. All rights reserved
#
# Disclaimer
#
# This software is provided "as-is". There are no expressed or implied
# warranties of any kind, including, but not limited to, the warranties
# of merchantability and fitness for a given application. In no event
# shall Gary Strangman be liable fo... | bsd-3-clause |
arjoly/scikit-learn | sklearn/feature_selection/tests/test_from_model.py | 11 | 6743 | 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.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.te... | bsd-3-clause |
bwinkel/cygrid | docs/images/cygrid_demo_zea_elliptical.py | 1 | 4972 | #!/usr/bin/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from kapteyn import maputils
import matplotlib.pyplot as plt
import cygrid
from astropy.io import fits as pf
from astropy import wcs
... | gpl-3.0 |
googleapis/python-bigquery-storage | tests/unit/test_reader_v1_arrow.py | 1 | 11893 | # -*- coding: utf-8 -*-
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 |
JonasWallin/MCMCPYJW | script/simple_N01.py | 1 | 1373 | # -*- coding: utf-8 -*-
"""
Extermly simple script for sampling a N(0,1) random variable
using AMCMC MH uses matplotlib
Showing that MCMCPYJW.Amcmc_RR converges to the desired accptance rate
Created on Sat Aug 8 23:40:59 2015
@author: jonaswallin
"""
import numpy.random as npr
import numpy as np
import M... | gpl-2.0 |
acmaheri/sms-tools | lectures/6-Harmonic-model/plots-code/spectral-peaks-and-f0.py | 2 | 1040 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
import math
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import dftModel as DFT
import utilFunctions as UF
(fs, x) = UF... | agpl-3.0 |
vibhorag/scikit-learn | sklearn/preprocessing/data.py | 68 | 57385 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Eric Martin <eric@ericmart.in>
# License: BSD 3 clause
from itertools import chain, combina... | bsd-3-clause |
UCL-CS35/incdb-poc | venv/share/doc/dipy/examples/reconst_shore_metrics.py | 13 | 3275 | """
===========================
Calculate SHORE scalar maps
===========================
We show how to calculate two SHORE-based scalar maps: return to origin
probability (rtop) [Descoteaux2011]_ and mean square displacement (msd)
[Wu2007]_, [Wu2008]_ on your data. SHORE can be used with any multiple b-value
dataset l... | bsd-2-clause |
iamshang1/Projects | Advanced_ML/Deep_Learning/residual_gradient_descent.py | 1 | 4173 | import numpy as np
import theano
import theano.tensor as T
import gzip, cPickle
import sys
import matplotlib.pyplot as plt
f = gzip.open('mnist.pkl.gz', 'rb')
train_set, valid_set, test_set = cPickle.load(f)
f.close()
X_train = np.array(train_set[0])
y_train = np.array(train_set[1])
X_test = np.array(test_set[0])
y_t... | mit |
billy-inn/scikit-learn | examples/model_selection/grid_search_text_feature_extraction.py | 253 | 4158 | """
==========================================================
Sample pipeline for text feature extraction and evaluation
==========================================================
The dataset used in this example is the 20 newsgroups dataset which will be
automatically downloaded and then cached and reused for the do... | bsd-3-clause |
jairideout/scikit-bio | skbio/stats/distance/_bioenv.py | 12 | 9577 | # ----------------------------------------------------------------------------
# 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 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/embedding/text_graph.py | 1 | 3432 | __author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import numpy as np
import scipy.sparse as spsp
from sklearn.decomposition import TruncatedSVD
from annoy import AnnoyIndex
def make_text_graph(user_lemma_matrix, dimensionality, metric, number_of_estimators, number_of_neighbors):
user_lemma_matrix_tfidf = augmen... | apache-2.0 |
Myasuka/scikit-learn | sklearn/utils/extmath.py | 142 | 21102 | """
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# License: BSD 3 clause
from __future__ import division
from functools import partial
import ... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/doc/mpl_toolkits/axes_grid/examples/scatter_hist.py | 8 | 1582 | import numpy as np
import matplotlib.pyplot as plt
# the random data
x = np.random.randn(1000)
y = np.random.randn(1000)
fig = plt.figure(1, figsize=(5.5,5.5))
from mpl_toolkits.axes_grid1 import make_axes_locatable
# the scatter plot:
axScatter = plt.subplot(111)
axScatter.scatter(x, y)
axScatter.set_aspect(1.)
... | gpl-2.0 |
amolkahat/pandas | pandas/tests/indexes/multi/test_indexing.py | 2 | 11264 | # -*- coding: utf-8 -*-
from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
import pandas.util.testing as tm
from pandas import (Categorical, CategoricalIndex, Index, IntervalIndex,
MultiIndex, date_range)
from pandas.compat import lrange
from pandas.core.indexes.... | bsd-3-clause |
xuanyuanking/spark | python/pyspark/pandas/datetimes.py | 15 | 26546 | #
# 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 |
djgagne/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py | 254 | 2253 | """Build a language detector model
The goal of this exercise is to train a linear classifier on text features
that represent sequences of up to 3 consecutive characters so as to be
recognize natural languages by using the frequencies of short character
sequences as 'fingerprints'.
"""
# Author: Olivier Grisel <olivie... | bsd-3-clause |
Aasmi/scikit-learn | sklearn/svm/classes.py | 22 | 39977 | import warnings
import numpy as np
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
from ..base import BaseEstimator, RegressorMixin
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
LinearModel
from ..feature_selection.from_model import _LearntSelectorMixin
from ..utils import check_X... | bsd-3-clause |
mhdella/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 |
mfatihaktas/q_sim | simplex_exp.py | 1 | 33305 | import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
# matplotlib.rcParams['ps.useafm'] = True
# matplotlib.rcParams['pdf.use14corefonts'] = True
# matplotlib.rcParams['text.usetex'] = True
matplotlib.use('Agg')
import matplotlib.pyplot as plot
import matplotlib.cm as cm # ... | mit |
guiccbr/autonomous-fuzzy-quadcopter | python/py_quad_control/vrep_sim/fuzzyclassic/test_drone_vrep_nav_classic.py | 1 | 28173 | #! /Library/Frameworks/Python.framework/Versions/2.7/bin/python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
# ------------------------ Imports ----------------------------------#
from sys import argv
import time
import struct
import math
import pickle
import matplotlib.pyplot as plt
from matplotlib.patches ... | mit |
CyclotronResearchCentre/forward | examples/plot_res_Simbio.py | 1 | 2313 | import numpy as np
from matplotlib.pyplot import plot, show, legend, close
import matplotlib.pyplot as plt
close("all")
import seaborn as sns
#sns.set(style="whitegrid")
sns.set(style="ticks")
# Allow text to be edited in Illustrator
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
res = np.load("SphereResu... | gpl-2.0 |
jmmease/pandas | pandas/tests/indexes/datetimes/test_partial_slicing.py | 13 | 10604 | """ test partial slicing on Series/Frame """
import pytest
from datetime import datetime
import numpy as np
import pandas as pd
from pandas import (DatetimeIndex, Series, DataFrame,
date_range, Index, Timedelta, Timestamp)
from pandas.util import testing as tm
class TestSlicing(object):
de... | bsd-3-clause |
stefwalter/cockpit | bots/learn/extractor.py | 3 | 6822 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Cockpit.
#
# Copyright (C) 2017 Slavek Kabrda
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the... | lgpl-2.1 |
cainiaocome/scikit-learn | sklearn/utils/multiclass.py | 92 | 13986 | # Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi
#
# License: BSD 3 clause
"""
Multi-class / multi-label utility function
==========================================
"""
from __future__ import division
from collections import Sequence
from itertools import chain
import warnings
from scipy.sparse import issparse
fro... | bsd-3-clause |
lail3344/sms-tools | software/transformations_interface/harmonicTransformations_function.py | 20 | 5398 | block=False# function call to the transformation functions of relevance for the hpsModel
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import get_window
import sys, os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/'))
sys.path.append(os.path.join(os.path.di... | agpl-3.0 |
pprett/scikit-learn | examples/linear_model/plot_logistic_path.py | 349 | 1195 | #!/usr/bin/env python
"""
=================================
Path with L1- Logistic Regression
=================================
Computes path on IRIS dataset.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from datetime import datetime
import numpy as np
import... | bsd-3-clause |
Eric89GXL/mne-python | mne/annotations.py | 4 | 44624 | # Authors: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
#
# License: BSD (3-clause)
from collections import OrderedDict
from datetime import datetime, timedelta, timezone
import os.path as op
import re
from copy import deepcopy
from itertools import takewhile
from collections import Counter
from collections.abc import... | bsd-3-clause |
detrout/debian-statsmodels | statsmodels/sandbox/survival2.py | 35 | 17924 | #Kaplan-Meier Estimator
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
from scipy import stats
from statsmodels.iolib.table import SimpleTable
class KaplanMeier(object):
"""
KaplanMeier(...)
KaplanMeier(data, endog, exog=None, censoring=None)
Create an object of... | bsd-3-clause |
RPGOne/Skynet | scikit-learn-0.18.1/sklearn/neural_network/tests/test_mlp.py | 15 | 21005 | """
Testing for Multi-layer Perceptron module (sklearn.neural_network)
"""
# Author: Issam H. Laradji
# License: BSD 3 clause
import sys
import warnings
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_equal
from sklearn.datasets import load_digits, load_boston
from sklearn.datasets i... | bsd-3-clause |
pslacerda/GromacsWrapper | gromacs/analysis/plugins/dist.py | 1 | 8542 | # $Id$
# Copyright (c) 2009 Oliver Beckstein <orbeckst@gmail.com>
# Released under the GNU Public License 3 (or higher, your choice)
# See the file COPYING for details.
"""
``analysis.plugins.dist`` --- Helper Class for ``g_dist``
=========================================================
:mod:`dist` contains helper c... | gpl-3.0 |
shnizzedy/SM_openSMILE | openSMILE_runSM/mhealthx/mhealthx/utilities.py | 1 | 9467 | #!/usr/bin/env python
"""
Utility functions.
Authors:
- Arno Klein, 2015-2016 (arno@childmind.org) http://binarybottle.com
Copyright 2015-2016, Sage Bionetworks (sagebase.org), with later modifications:
Copyright 2016, Child Mind Institute (childmind.org), Apache v2.0 License
"""
def run_command(command, fla... | apache-2.0 |
Lab603/PicEncyclopedias | jni-build/jni/include/tensorflow/contrib/learn/python/learn/tests/multioutput_test.py | 5 | 1679 | # 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... | mit |
fake-name/PyGalil | Examples/TestGui/plot.py | 1 | 1359 | #!C:\Python26
import numpy as np
import pandas as pd # Faster csv import
import matplotlib
matplotlib.use("WxAgg")
import matplotlib.pyplot as pplt
def doThisThing():
print "loading data"
dat = np.genfromtxt("./posvelDR.1.txt", delimiter=",")
#dat = np.array(pd.read_csv("./posvelDR.1.txt", delimiter=","))
... | gpl-2.0 |
weixuanfu/tpot | tpot/config/classifier_cuml.py | 1 | 3762 | # -*- coding: utf-8 -*-
"""This file is part of the TPOT library.
TPOT was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- Weixuan Fu (weixuanf@upenn.edu)
- Daniel Angell (dpa34@drexel.edu)
- and many more generous open source contributors
TPOT is f... | lgpl-3.0 |
MadsJensen/agency_connectivity | tf_tests.py | 1 | 2072 | import mne
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import seaborn as sns
from tf_analysis import single_trial_tf
plt.ion()
data_folder = "/home/mje/Projects/agency_connectivity/data/"
epochs = mne.read_epochs(data_folder + "P2_ds_bp_ica-epo.fif")
# single trial morlet tests
frequ... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/sparse/frame/test_indexing.py | 2 | 3129 | import numpy as np
import pytest
from pandas import DataFrame, SparseDataFrame
from pandas.util import testing as tm
pytestmark = pytest.mark.skip("Wrong SparseBlock initialization (GH 17386)")
@pytest.mark.parametrize(
"data",
[
[[1, 1], [2, 2], [3, 3], [4, 4], [0, 0]],
[[1.0, 1.0], [2.0, 2... | apache-2.0 |
gamahead/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_ps.py | 69 | 50262 | """
A PostScript backend, which can produce both PostScript .ps and .eps
"""
from __future__ import division
import glob, math, os, shutil, sys, time
def _fn_name(): return sys._getframe(1).f_code.co_name
try:
from hashlib import md5
except ImportError:
from md5 import md5 #Deprecated in 2.5
from tempfile im... | gpl-3.0 |
chugunovyar/factoryForBuild | env/lib/python2.7/site-packages/matplotlib/tests/test_bbox_tight.py | 5 | 3576 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from six.moves import xrange
import numpy as np
from matplotlib import rcParams
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
import matplotlib.path as ... | gpl-3.0 |
jzt5132/scikit-learn | sklearn/tests/test_random_projection.py | 79 | 14035 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from sklearn.metrics import euclidean_distances
from sklearn.random_projection import johnson_lindenstrauss_min_dim
from sklearn.random_projection import gaussian_random_matrix
from sklearn.random_projection import sparse_random_matrix
from... | bsd-3-clause |
seberg/numpy | numpy/core/tests/test_multiarray.py | 3 | 336932 | import collections.abc
import tempfile
import sys
import warnings
import operator
import io
import itertools
import functools
import ctypes
import os
import gc
import weakref
import pytest
from contextlib import contextmanager
from numpy.compat import pickle
import pathlib
import builtins
from decimal import Decimal
... | bsd-3-clause |
kongjy/hyperAFM | Jessica/linear regression on synthetic data.py | 1 | 2562 | from sklearn import linear_model
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
import math
from math import *
mu = 0
mu2 = 0.5
mu3 = 0.75
variance = 0.5
variance2 = 1
variance3 = 1.5
sigma = math.sqrt(variance)
sigma2 = math.sqrt(variance2)
sigma3 = math.sqrt(vari... | mit |
AnthonyHewins/r_estate_ai | mu_class.py | 1 | 2433 | import pandas
import pickle
from os.path import isfile as file_exists
import argparse
import matplotlib.pyplot as plot
from mpl_toolkits.mplot3d import Axes3D
import datetime
class Mu_data_collection:
def __init__(self, mu, mu_points, columns=["Bedrooms", "netTaxableValue", "HouseNo"]):
self.mu = mu
self.mu_point... | gpl-3.0 |
lsst-ts/ts_wep | python/lsst/ts/wep/task/GenerateDonutCatalogOnlineTask.py | 1 | 5283 | # This file is part of ts_wep.
#
# Developed for the LSST Telescope and Site Systems.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you ... | gpl-3.0 |
zooniverse/aggregation | experimental/condor/experience.py | 2 | 9207 | #!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import os
import pymongo
import sys
import cPickle as pickle
import bisect
import csv
import matplotlib.pyplot as plt
import random
import math
import urllib
import matplotlib.cbook as cbook
from IPy import IP
from scipy.stats.stats import pearsonr
def ... | apache-2.0 |
heshamelmatary/rtems-microblaze | testsuites/tmtests/tmcontext01/plot.py | 14 | 1341 | #
# Copyright (c) 2014 embedded brains GmbH. All rights reserved.
#
# The license and distribution terms for this file may be
# found in the file LICENSE in this distribution or at
# http://www.rtems.org/license/LICENSE.
#
import libxml2
from libxml2 import xmlNode
import matplotlib.pyplot as plt
doc = libxml2.parseF... | gpl-2.0 |
pfnet-research/tgan | train.py | 1 | 6338 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib # isort:skip
matplotlib.use('Agg') # isort:skip
import argparse
import os
import shutil
import sys
import time
import chainer
import yaml
from chainer import training
from chainer.training import extensions
from visualizer import out_generated_movie
... | mit |
KristoferHellman/gimli | python/pygimli/meshtools/polytools.py | 1 | 20313 | # -*- coding: utf-8 -*-
"""Tools to create or manage PLC"""
import os
from os import system
import math
import numpy as np
import pygimli as pg
def polyCreateDefaultEdges_(poly, boundaryMarker=1, isClosed=True, **kwargs):
"""INTERNAL"""
nEdges = poly.nodeCount()-1 + isClosed
bm = None
if hasattr(bou... | gpl-3.0 |
hennersz/pySpace | basemap/examples/streamplot_demo.py | 4 | 1607 | # example showing how to use streamlines to visualize a vector
# flow field (from Hurricane Earl).
# Requires matplotlib 1.1.1 or newer.
from netCDF4 import Dataset as NetCDFFile
from mpl_toolkits.basemap import Basemap, interp
import numpy as np
import matplotlib.pyplot as plt
if not hasattr(plt, 'streamplot'):
... | gpl-3.0 |
PatrickChrist/scikit-learn | examples/linear_model/plot_iris_logistic.py | 283 | 1678 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Logistic Regression 3-class Classifier
=========================================================
Show below is a logistic-regression classifiers decision boundaries on the
`iris <http://en.wikipedia.org/wiki/Iris_f... | bsd-3-clause |
talonchandler/dipsim | notes/2017-10-10-voxel-reconstruction/figures/plot-likelihood.py | 1 | 2311 | from dipsim import multiframe, util, fluorophore, reconstruction
import numpy as np
import matplotlib.pyplot as plt
import os; import time; start = time.time(); print('Running...')
import matplotlib.gridspec as gridspec
# Setup k and c sweep
kappas = [-3, 0, 3, np.inf]
cs = [0.1, 1, 2]
col_labels = ['$\kappa$ = ' + st... | mit |
amanzi/ats-dev | tools/utils/plot_surface_balance.py | 2 | 8147 | #!/usr/bin/env python
"""
Plot met data from an ATS input h5 file using default names.
This is currently only useful on a single, 1D column.
"""
import os,sys
import h5py
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.cm
import parse_ats
import itertools
import colors
def get_filename_base... | bsd-3-clause |
MerlinZhang/osf.io | scripts/analytics/utils.py | 30 | 1244 | # -*- coding: utf-8 -*-
import os
import unicodecsv as csv
from bson import ObjectId
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import requests
from website import util
def oid_to_datetime(oid):
return ObjectId(oid).generation_time
def mkdirp(path):
try:
os.makedirs(path)
... | apache-2.0 |
JakeColtman/bartpy | bartpy/features/featureselection.py | 1 | 2695 | from copy import deepcopy
import numpy as np
from matplotlib import pyplot as plt
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from bartpy.diagnostics.features import null_feature_split_proportions_distribution, \
local_thresholds, global_thresholds, is_kept, fea... | mit |
nok/sklearn-porter | examples/estimator/classifier/RandomForestClassifier/java/basics_embedded.pct.py | 1 | 1231 | # %% [markdown]
# # sklearn-porter
#
# Repository: [https://github.com/nok/sklearn-porter](https://github.com/nok/sklearn-porter)
#
# ## RandomForestClassifier
#
# Documentation: [sklearn.ensemble.RandomForestClassifier](http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html)
# %... | mit |
TinyOS-Camp/DDEA-DEV | Development/plot_csv.py | 5 | 27192 | """
==============================================
Visualizing the enegy-sensor-weather structure
==============================================
This example employs several unsupervised learning techniques to extract
the energy data structure from variations in Building Automation System (BAS)
and historial weather ... | gpl-2.0 |
gietal/Stocker | sandbox/sentdex/2.py | 1 | 1053 | import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
import numpy as np
def graphRaw():
date, bid, ask = np.loadtxt(
'Data/GBPUSD1d.txt',
# 'Data/GBPUSD10s.txt',
delimiter=',',
unpack=True,
converters={0:... | mit |
Quantipy/quantipy | quantipy/core/tools/dp/spss/writer.py | 1 | 18350 |
import numpy as np
import pandas as pd
import quantipy as qp
from quantipy.core.helpers.functions import emulate_meta
import savReaderWriter as srw
import copy
import json
def write_sav(path_sav, data, **kwargs):
"""
Write the given records to a SAV file at path_sav.
Using the various definitions indicat... | mit |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/sklearn/tests/test_calibration.py | 64 | 12999 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
from __future__ import division
import numpy as np
from scipy import sparse
from sklearn.model_selection import LeaveOneOut
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
... | mit |
IssamLaradji/scikit-learn | sklearn/cluster/tests/test_mean_shift.py | 19 | 2844 | """
Testing for mean shift clustering methods
"""
import numpy as np
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
from sklearn.cluster import MeanShift
from sklearn.clu... | bsd-3-clause |
rleonard21/PyTradier | examples/machine_learning.py | 1 | 1788 | from sklearn import svm
import numpy as np
from pytradier.tradier import Tradier
'''
The purpose of this example is to show the user how to use the PyTradier library in conjunction with scikit-learn
for machine learning. This example takes training data from PyTradier, trains an SVM classifier with arbitrary labels,
... | gpl-3.0 |
hvy/chainer | examples/mnist/train_mnist.py | 4 | 6024 | #!/usr/bin/env python
import argparse
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer.training import extensions
import chainerx
import matplotlib
matplotlib.use('Agg')
# Network definition
class MLP(chainer.Chain):
def __init__(self, n_units, n_... | mit |
brchiu/tensorflow | tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py | 30 | 40476 | # 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 |
drusk/pml | pml/supervised/naive_bayes.py | 1 | 6322 | # Copyright (C) 2012 David Rusk
#
# 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, modify, merge, publish, distr... | mit |
nixingyang/Kaggle-Face-Verification | Face Verification/solution_keras.py | 1 | 7972 | from sklearn.cross_validation import LabelKFold
import common
import glob
import itertools
import keras_related
import numpy as np
import os
import pandas as pd
import prepare_data
import pyprind
import solution_basic
import time
METRIC_LIST_DICT = {
"_open_face.csv":["correlation", "l1", "euclidean", "braycurtis"... | mit |
jeremyfix/pylearn2 | pylearn2/cross_validation/subset_iterators.py | 15 | 10405 | """
Cross-validation subset iterators.
The cross-validation iterators in sklearn only return train/test splits.
Several of the subset iterators in this module return train/valid/test
splits by starting with a train/test split and further dividing the train
subset into a train/valid split.
"""
__author__ = "Steven Kea... | bsd-3-clause |
chrjxj/zipline | zipline/examples/pairtrade.py | 11 | 5699 | #!/usr/bin/env python
#
# Copyright 2013 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 ... | apache-2.0 |
samuel1208/scikit-learn | sklearn/datasets/base.py | 196 | 18554 | """
Base IO code for all datasets
"""
# Copyright (c) 2007 David Cournapeau <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
import os
import csv
import shutil
from os import environ
from os.pa... | bsd-3-clause |
DSLituiev/scikit-learn | sklearn/linear_model/tests/test_passive_aggressive.py | 169 | 8809 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_rais... | bsd-3-clause |
hansomesong/TracesAnalyzer | 20160218Tasks/num_of_case_counter.py | 1 | 8546 | # -*- coding: utf-8 -*-
__author__ = 'yueli'
import operator
import numpy as np
import matplotlib.pyplot as plt
import pprint
from config.config import *
import datetime
from collections import Counter
# Import the targeted raw CSV file
rawCSV_file_liege = os.path.join(CSV_FILE_DESTDIR, 'comparison_time_liege.csv')
ra... | gpl-2.0 |
helenjin/scanalysis | src/scanalysis/io/loadsave.py | 1 | 4383 | import numpy as np
import pandas as pd
import os.path
import fcsparser
def load(file):
"""
:parameter: str, name of .csv (csv file) or .p (pickle archive)
:return: df, which is a pandas DataFrame object
"""
filename = os.path.expanduser(file)
# load single cell RNA-seq data from .csv... | gpl-2.0 |
DOsinga/wiki_import | wiki_people.py | 1 | 9355 | import argparse
import json
import os
import re
from collections import Counter, defaultdict
import pycountry
import geopandas as gpd
import mwparserfromhell
import psycopg2
import psycopg2.extras
import yaml
from shapely import wkt
WORD_RE = re.compile(r'\w+')
CAT_PREFIX = 'Category:'
DIED_POSTFIX = ' deaths'
BIRTH... | apache-2.0 |
mikebenfield/scikit-learn | sklearn/datasets/tests/test_kddcup99.py | 42 | 1278 | """Test kddcup99 loader. Only 'percent10' mode is tested, as the full data
is too big to use in unit-testing.
The test is skipped if the data wasn't previously fetched and saved to
scikit-learn data folder.
"""
from sklearn.datasets import fetch_kddcup99
from sklearn.utils.testing import assert_equal, SkipTest
def... | bsd-3-clause |
Vimos/scikit-learn | examples/neural_networks/plot_mnist_filters.py | 79 | 2189 | """
=====================================
Visualization of MLP weights on MNIST
=====================================
Sometimes looking at the learned coefficients of a neural network can provide
insight into the learning behavior. For example if weights look unstructured,
maybe some were not used at all, or if very l... | bsd-3-clause |
python-control/python-control | examples/pvtol-nested.py | 2 | 4551 | # pvtol-nested.py - inner/outer design for vectored thrust aircraft
# RMM, 5 Sep 09
#
# This file works through a fairly complicated control design and
# analysis, corresponding to the planar vertical takeoff and landing
# (PVTOL) aircraft in Astrom and Murray, Chapter 11. It is intended
# to demonstrate the basic fun... | bsd-3-clause |
ueshin/apache-spark | python/pyspark/pandas/tests/test_typedef.py | 15 | 16852 | #
# 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 |
shl198/Projects | RibosomeProfilePipeline/f02_RiboDataModule.py | 2 | 75493 | from __future__ import division
import subprocess,os,sys
import pandas as pd
from natsort import natsorted
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('ggplot')
from Bio.Seq import Seq
from Bio import SeqIO
from Bio.Alphabet import generic_dna
import pysam
import HTSeq as h... | mit |
trentino-sistemi/l4s | web/pyjstat.py | 1 | 10028 | # -*- coding: utf-8 -*-
"""pyjstat is a python module for JSON-stat formatted data manipulation.
This module allows reading and writing JSON-stat [1]_ format with python,
using data frame structures provided by the widely accepted
pandas library [2]_. The JSON-stat format is a simple lightweight JSON format
for data ... | agpl-3.0 |
alfonsokim/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/widgets.py | 69 | 40833 | """
GUI Neutral widgets
All of these widgets require you to predefine an Axes instance and
pass that as the first arg. matplotlib doesn't try to be too smart in
layout -- you have to figure out how wide and tall you want your Axes
to be to accommodate your widget.
"""
import numpy as np
from mlab import dist
from p... | agpl-3.0 |
sarahgrogan/scikit-learn | examples/bicluster/bicluster_newsgroups.py | 162 | 7103 | """
================================================================
Biclustering documents with the Spectral Co-clustering algorithm
================================================================
This example demonstrates the Spectral Co-clustering algorithm on the
twenty newsgroups dataset. The 'comp.os.ms-windows... | bsd-3-clause |
Bmillidgework/Misc-Maths | Misc/ars.py | 1 | 5205 | # so I think the aim here is that we construct stuff which kind of works, but I really don't kno
# we add hulls to the things, I think seeign a straightforward algorithmic implementation woudl be good
# and further it would be really cool if we had something that works nicely, so let's try this out and see if it can sh... | mit |
neale/CS-program | 434-MachineLearning/final_project/linearClassifier/sklearn/decomposition/tests/test_fastica.py | 272 | 7798 | """
Test the fastica algorithm.
"""
import itertools
import warnings
import numpy as np
from scipy import stats
from nose.tools import assert_raises
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 skl... | unlicense |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.