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
stanmoore1/lammps
examples/SPIN/test_problems/validation_damped_precession/llg_precession.py
9
1646
#!/usr/bin/env python3 import numpy as np , pylab, tkinter import math import matplotlib.pyplot as plt import mpmath as mp mub=5.78901e-5 # Bohr magneton (eV/T) hbar=0.658212 # Planck's constant (eV.fs/rad) g=2.0 # Lande factor (adim) gyro=g*mub/hbar # gyromag ratio (rad/f...
gpl-2.0
johnmgregoire/JCAPGeneratePrintCode
visualize_alloy_platemaps__eg_pm71.py
1
7575
import numpy, pylab import numpy as np import matplotlib.cm as cm import matplotlib.colors as colors from readplatemap import readsingleplatemaptxt from visualize_alloy_platemaps__eg_pm71__userparams import userinputd path_pm=r'J:\hte_jcap_app_proto\map\0072-04-0100-mp.txt' #This lets you visualize the printing for ...
bsd-3-clause
trungnt13/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
chipfranzen/dillinger
dillinger/bandits.py
1
6449
"""Multi-armed bandits""" # Author: C. Franzen # License: MIT import numpy as np import matplotlib.pyplot as plt import seaborn as sns class SoftMax(object): '''The softmax bandit algorithm. Args: n_arms (int): Number of arms in the bandit counts (ndarray): Number of times each...
mit
google-research/google-research
dvrl/main_dvrl_image_transfer_learning.py
1
9297
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
apache-2.0
rknLA/sms-tools
lectures/07-Sinusoidal-plus-residual-model/plots-code/stochasticModelFrame.py
22
3298
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
probml/pyprobml
scripts/newcomb_plugin_demo.py
1
1631
# Tests min and variance to check whether Newcomb's speed of light data is Gaussian or not # Author : Aleyna Kara # This file is generated from https://github.com/probml/pmtk3/blob/master/demos/newcombPlugin.m import pyprobml_utils as pml import numpy as np import requests import matplotlib.pyplot as plt def plot_pos...
mit
eshook/Forest
forest/primitives/Primitives.py
1
14262
""" Copyright (c) 2017 Eric Shook. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. @author: eshook (Eric Shook, eshook@gmail.edu) @contributors: (Luyi Hunter, chen3461@umn.edu; Xinran Duan, duanx138@umn.edu) @contributors: <Contribute and add your n...
bsd-3-clause
OwaJawa/kaggle-galaxies
try_convnet_cc_multirotflip_3x69r45_maxout2048_extradense_dup3.py
7
17439
import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime_augmentation as ra import time import csv import os import cPickle as pickle from datetime import datetime, timedelta # import matplotlib.pyplot as plt # plt.i...
bsd-3-clause
henrykironde/scikit-learn
sklearn/decomposition/tests/test_nmf.py
130
6059
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
ishank08/scikit-learn
examples/cluster/plot_agglomerative_clustering.py
343
2931
""" Agglomerative clustering with and without structure =================================================== This example shows the effect of imposing a connectivity graph to capture local structure in the data. The graph is simply the graph of 20 nearest neighbors. Two consequences of imposing a connectivity can be s...
bsd-3-clause
B3AU/waveTree
sklearn/feature_extraction/dict_vectorizer.py
7
10162
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..externals.six.moves import x...
bsd-3-clause
alephu5/Soundbyte
environment/lib/python3.3/site-packages/matplotlib/tests/test_bbox_tight.py
1
3110
from matplotlib import rcParams from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt import matplotlib.path as mpath import matplotlib.patches as mpatches from matplotlib.ticker import FuncFormatter import numpy as np @image_comparison(baseline_images=['bbox_inches_tight'], remove...
gpl-3.0
a-doumoulakis/tensorflow
tensorflow/examples/learn/text_classification_character_cnn.py
29
5666
# 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
hargup/sympy
sympy/physics/quantum/state.py
6
29159
"""Dirac notation for states.""" from __future__ import print_function, division from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.core.compatibility import u, range from sympy.printing.pretty.stringpict import stringPict from sympy.physics.quantum.qexpr ...
bsd-3-clause
rohanp/scikit-learn
examples/ensemble/plot_gradient_boosting_quantile.py
392
2114
""" ===================================================== Prediction Intervals for Gradient Boosting Regression ===================================================== This example shows how quantile regression can be used to create prediction intervals. """ import numpy as np import matplotlib.pyplot as plt from skle...
bsd-3-clause
ltiao/networkx
networkx/drawing/tests/test_pylab.py
45
1137
""" Unit tests for matplotlib drawing functions. """ import os from nose import SkipTest import networkx as nx class TestPylab(object): @classmethod def setupClass(cls): global plt try: import matplotlib as mpl mpl.use('PS',warn=False) import matplotli...
bsd-3-clause
fivejjs/pyhsmm
examples/hsmm-geo.py
4
1818
from __future__ import division import numpy as np np.seterr(divide='ignore') # these warnings are usually harmless for this code from matplotlib import pyplot as plt import copy, os import pyhsmm from pyhsmm.util.text import progprint_xrange ################### # generate data # ################### T = 1000 obs_d...
mit
shangwuhencc/scikit-learn
sklearn/tests/test_learning_curve.py
225
10791
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import warnings from sklearn.base import BaseEstimator from sklearn.learning_curve import learning_curve, validation_curve from sklearn.u...
bsd-3-clause
sclc/NAEF
exp_scripts/worker_exp_160518.py
1
8726
""" Experiment Diary 2016-05-18 """ import sys import math import matplotlib.pyplot as plt from scipy import io import numpy as np from scipy.sparse.linalg import * sys.path.append("../src/") from worker import Worker from native_conjugate_gradient import NativeConjugateGradient from native_conjugate_gradient import ...
gpl-3.0
ltiao/scikit-learn
sklearn/setup.py
225
2856
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
cmap/cmapPy
cmapPy/pandasGEXpress/concat.py
1
22535
""" concat.py This function is for concatenating gct(x) files together. You can tell it to find files using the file_wildcard argument, or you can tell it exactly which files you want to concatenate using the input_filepaths argument. The meat of this function are the hstack (i.e. horizontal concatenation of GCToo obj...
bsd-3-clause
h2oai/h2o-3
h2o-py/tests/testdir_algos/glm/pyunit_link_functions_binomial_glm.py
8
1710
from __future__ import division from __future__ import print_function from past.utils import old_div import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils import pandas as pd import zipfile import statsmodels.api as sm from h2o.estimators.glm import H2OGeneralizedLinearEstimator def link_...
apache-2.0
luizcieslak/AlGDock
Pipeline/align3d.py
3
9287
# Downloads pdb files # Uses ProDy to align a set of crystal structures to a reference structures. # Also performs a principal components analysis. import os, inspect, shutil, pickle sequence = '' ref_pdb_id = '' ref_chain_id = 'A' ref_res_id_range = (1,-1) exclude = [] script_dir = os.path.dirname(os.path.abspath(\...
mit
khyrulimam/pemrograman-linear-optimasi-gizi-anak-kos
nutrisi.py
1
1544
import numpy as np import pulp import seaborn as sns from matplotlib import pyplot as plt from matplotlib.patches import PathPatch from matplotlib.path import Path import solver bayam = 'bayam' tempe = 'tempe' problem_name = 'Optimasi Gizi Anak Kos' # decision variables (variabel keputusan) x = pulp.LpVariable(bayam...
apache-2.0
apoorva-sharma/deep-frame-interpolation
deep_fruc.py
1
7470
import tensorflow as tf import numpy as np import math import glob #import msssim from scipy import misc import matplotlib.animation as animation from frame_interpolator import * import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from pylab import * def normalize_frames(frames, medians): r...
mit
dancingdan/tensorflow
tensorflow/contrib/training/python/training/feeding_queue_runner_test.py
76
5052
# Copyright 2015 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
miaecle/deepchem
examples/kinase/KINASE_correlations.py
8
1399
""" Script that computes correlations of KINASE tasks. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os import numpy as np import tempfile import shutil import deepchem as dc import pandas as pd import matplotlib # Force matplotlib to not use ...
mit
saiwing-yeung/scikit-learn
sklearn/model_selection/_validation.py
2
37166
""" The :mod:`sklearn.model_selection._validation` module includes classes and functions to validate the model. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause from __...
bsd-3-clause
bloyl/mne-python
mne/epochs.py
1
147455
# -*- coding: utf-8 -*- """Tools for working with epoched data.""" # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Matti Hämäläinen <msh@nmr.mgh.harvard.edu> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # Denis Engemann <denis.engemann@gmail.com> # Mainak Jas...
bsd-3-clause
zhuangjun1981/retinotopic_mapping
retinotopic_mapping/RetinotopicMapping.py
1
111703
__author__ = 'junz' import numpy as np import os import scipy.ndimage as ni import scipy.sparse as sparse import math import matplotlib.pyplot as plt from itertools import combinations from operator import itemgetter import skimage.morphology as sm import skimage.transform as tsfm import cv2 import matplotlib.colors a...
gpl-3.0
senthil10/NouGAT
nougat/evaluete.py
3
18678
from __future__ import absolute_import from __future__ import print_function import sys, os, yaml, glob import subprocess import pandas as pd import re import shutil import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from nougat import common, align from itertools import groupby from collections im...
mit
sinhrks/pyopendata
pyopendata/io/jsdmx.py
1
2560
# pylint: disable-msg=E1101,W0613,W0603 from __future__ import unicode_literals import itertools import os import requests import numpy as np import pandas as pd import pandas.compat as compat from pyopendata.io.util import _read_content def read_jsdmx(path_or_buf): """ Convert a SDMX-JSON string to pand...
bsd-2-clause
glouppe/scikit-learn
examples/model_selection/grid_search_digits.py
44
2672
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.model_selection.GridS...
bsd-3-clause
paolorota/random_scripts
script_ALL.py
1
2131
from pyflow import reader as rd from pyflow import export as ex import os import numpy as np from sklearn import mixture import matplotlib.pyplot as plt from gmmstuff import plot_distribution, make_ellipses n_components = 10 mydir = "D:\\autoflow" patientlist = os.listdir(mydir) gmmlist = [] for n, patient in enumer...
gpl-3.0
victorbergelin/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
lewisc/spark-tk
regression-tests/sparktkregtests/testcases/graph/graph_weight_degree_test.py
11
4742
# 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
jjx02230808/project0223
benchmarks/bench_random_projections.py
397
8900
""" =========================== Random projection benchmark =========================== Benchmarks for random projections. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import collections import numpy as np import scipy.s...
bsd-3-clause
Tlinne2/Basic-Python-Projects-
Data-Science-Tools/titanic_survival_rates.py
1
1903
''' Titanic Survival Factors A data analysis project using Kaggle Titanic's data set to determine what factors helped or hurt chances of surviving the Titanic Coded By: Tyler Linne Date: 5/1/16 ''' import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from pandas import Seri...
mit
sonnyhu/scikit-learn
sklearn/covariance/robust_covariance.py
105
29653
""" Robust location and covariance estimators. Here are implemented estimators that are resistant to outliers. """ # Author: Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import warnings import numbers import numpy as np from scipy import linalg from scipy.stats import chi2 from . import empir...
bsd-3-clause
mmottahedi/neuralnilm_prototype
scripts/e478.py
2
6721
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectiona...
mit
thanhan/seqcrowd-acl17
util.py
1
31796
import numpy as np import os import hmm #import re import matplotlib.pyplot as plt import pickle import csv #import shutil hmm class instance: """ an instance """ def __init__(self, features, label, word = None): self.features = features self.label = label if word != None: ...
mit
gzd888/artisan
setup-win.py
9
5267
""" This is a set up script for py2exe USAGE: python setup-win py2exe """ from distutils.core import setup import matplotlib as mpl import py2exe import os # Remove the build folder, a bit slower but ensures that build contains the latest import shutil shutil.rmtree("build", ignore_errors=True) shu...
gpl-3.0
rubikloud/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
AnshulYADAV007/Lean
Algorithm.Python/PythonPackageTestAlgorithm.py
2
8042
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice...
apache-2.0
annehutter/grid-model
analysis_tools/size_distribution.py
1
5057
import sys import os import numpy as np import matplotlib as m m.use('Agg') import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from statistics import * import read_parameterfile as rp import read_fields as rf def round_down(num): if num < 0: return -np.ceil(abs(num)) else: r...
gpl-2.0
dherrebout/pyprojects
map.py
1
1130
import folium import pandas as pd df = pd.read_csv('Volcanoes-USA.txt') map_carto = folium.Map( location=[45, -120], zoom_start=5, tiles='cartodbpositron') def color(elev): if elev in range(0, 1500): color = 'green' elif elev in range(1500, 2500): color = 'brown' elif elev in...
mit
timthelion/FreeCAD_sf_master
src/Mod/Plot/InitGui.py
18
2920
#*************************************************************************** #* * #* Copyright (c) 2011, 2012 * #* Jose Luis Cercos Pita <jlcercos@gmail.com> * #* ...
lgpl-2.1
Refefer/pylearn2
pylearn2/cross_validation/tests/test_cross_validation.py
49
6767
""" Tests for cross-validation module. """ import os import tempfile from pylearn2.config import yaml_parse from pylearn2.testing.skip import skip_if_no_sklearn def test_train_cv(): """Test TrainCV class.""" skip_if_no_sklearn() handle, layer0_filename = tempfile.mkstemp() handle, layer1_filename = t...
bsd-3-clause
olivernina/ocropy
ocrolib/psegutils.py
10
7620
from toplevel import * from pylab import * from scipy.ndimage import filters,interpolation import sl,morph def B(a): if a.dtype==dtype('B'): return a return array(a,'B') class record: def __init__(self,**kw): self.__dict__.update(kw) def blackout_images(image,ticlass): """Takes a page image and a tic...
apache-2.0
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/pandas/tests/indexes/period/test_indexing.py
9
12184
from datetime import datetime import pytest import numpy as np import pandas as pd from pandas.util import testing as tm from pandas.compat import lrange from pandas._libs import tslib from pandas import (PeriodIndex, Series, DatetimeIndex, period_range, Period, _np_version_under1p9) class TestG...
mit
cauchycui/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
dr-nate/msmbuilder
msmbuilder/project_templates/landmarks/find-landmarks.py
9
1323
"""Cluster based on RMSD between conformations {{header}} Meta ---- depends: - meta.pandas.pickl - trajs - top.pdb """ import mdtraj as md from msmbuilder.cluster import MiniBatchKMedoids from msmbuilder.io import load_meta, itertrajs, save_generic, backup ## Set up parameters kmed = MiniBatchKMedoids( n_...
lgpl-2.1
nvoron23/scikit-learn
sklearn/cluster/tests/test_k_means.py
63
26190
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/sklearn/metrics/cluster/__init__.py
91
1468
""" The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation: - supervised, which uses a ground truth class values for each sample. - unsupervised, which does not and measures the 'quality' of the model itself. """ from .supervised import ...
mit
deepesch/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
242
5885
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
bkendzior/scipy
scipy/signal/fir_filter_design.py
17
36232
# -*- coding: utf-8 -*- """Functions for FIR filter design.""" from __future__ import division, print_function, absolute_import from math import ceil, log import warnings import numpy as np from numpy.fft import irfft, fft, ifft from scipy.special import sinc from scipy.linalg import toeplitz, hankel, pinv from scipy...
bsd-3-clause
ephes/scikit-learn
examples/plot_johnson_lindenstrauss_bound.py
134
7452
""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected in...
bsd-3-clause
Djabbz/scikit-learn
examples/linear_model/plot_sparse_recovery.py
27
7466
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
phdowling/scikit-learn
sklearn/metrics/tests/test_regression.py
272
6066
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils....
bsd-3-clause
espenhgn/nest-simulator
pynest/examples/glif_psc_neuron.py
5
9575
# -*- coding: utf-8 -*- # # glif_psc_neuron.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License...
gpl-2.0
lhilt/scipy
scipy/signal/_arraytools.py
9
7561
""" Functions for acting on a axis of an array. """ from __future__ import division, print_function, absolute_import import numpy as np def axis_slice(a, start=None, stop=None, step=None, axis=-1): """Take a slice along axis 'axis' from 'a'. Parameters ---------- a : numpy.ndarray The array ...
bsd-3-clause
josenavas/qiime
scripts/plot_taxa_summary.py
15
12355
#!/usr/bin/env python # File created on 19 Jan 2011 from __future__ import division __author__ = "Jesse Stombaugh" __copyright__ = "Copyright 2011, The QIIME project" __credits__ = ["Jesse Stombaugh", "Julia Goodrich", "Justin Kuczynski", "John Chase", "Jose Antonio Navas Molina"] __license__ = "GPL" __...
gpl-2.0
kaichogami/scikit-learn
sklearn/utils/validation.py
19
25724
"""Utilities for input validation""" # Authors: Olivier Grisel # Gael Varoquaux # Andreas Mueller # Lars Buitinck # Alexandre Gramfort # Nicolas Tresegnie # License: BSD 3 clause import warnings import numbers import numpy as np import scipy.sparse as sp from ..externals...
bsd-3-clause
winklerand/pandas
pandas/tests/test_multilevel.py
1
106143
# -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101,W0141 from warnings import catch_warnings import datetime import itertools import pytest import pytz from numpy.random import randn import numpy as np from pandas.core.index import Index, MultiIndex from pandas import Panel, DataFrame, Series, notna, isna, Tim...
bsd-3-clause
robbymeals/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
gosox5555/data
pew-religions/Religion-Leah.py
37
3271
#!/usr/bin/env python import numpy as np import pandas as pd religions = ['Buddhist', 'Catholic', 'Evangel Prot', 'Hindu', 'Hist Black Prot', 'Jehovahs Witness', 'Jewish', 'Mainline Prot', 'Mormon', 'Muslim', 'Orthodox Christian', 'Unaffiliated'] csv = open("current.csv", 'w') csv.truncate() def write_row(matrix): a...
mit
shanwai1234/Maize_Phenotype_Map
hyperspectral_PCA_visualization.py
1
7348
import numpy as np import cv2 from matplotlib import pyplot as plt import os import sys from scipy import linalg as LA from matplotlib import cm ##############################Hyperspectral Image PCA Visualization##########################################################################################################...
bsd-3-clause
mayblue9/scikit-learn
examples/text/document_classification_20newsgroups.py
222
10500
""" ====================================================== Classification of text documents using sparse features ====================================================== This is an example showing how scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a scipy.spars...
bsd-3-clause
mkukielka/oddt
oddt/scoring/functions/RFScore.py
1
8333
from __future__ import print_function import sys from os.path import dirname, isfile, join as path_join import numpy as np from scipy.stats import pearsonr from sklearn.metrics import r2_score import warnings try: import compiledtrees except ImportError: compiledtrees = None from oddt import random_seed fro...
bsd-3-clause
courtarro/gnuradio
gnuradio-runtime/examples/volk_benchmark/volk_plot.py
78
6117
#!/usr/bin/env python import sys, math import argparse from volk_test_funcs import * try: import matplotlib import matplotlib.pyplot as plt except ImportError: sys.stderr.write("Could not import Matplotlib (http://matplotlib.sourceforge.net/)\n") sys.exit(1) def main(): desc='Plot Volk performanc...
gpl-3.0
vladpopovici/WSItk
WSItk/segm/nuclei.py
1
2446
from __future__ import (absolute_import, division, print_function, unicode_literals) __author__ = 'vlad' __version__ = 0.2 import numpy as np from scipy import ndimage # from sklearn.cluster import KMeans import skimage.morphology as morph # from skimage.restoration import denoise_tv_bregman from skimage.feature im...
mit
schets/scikit-learn
sklearn/metrics/tests/test_common.py
7
44042
from __future__ import division, print_function from functools import partial from itertools import product import numpy as np import scipy.sparse as sp from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer from sklearn.utils.multiclass impo...
bsd-3-clause
aitatanit/filterpy
filterpy/memory/tests/test_fading_memory.py
4
1896
# -*- coding: utf-8 -*- """Copyright 2015 Roger R Labbe Jr. FilterPy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is licensed under an MIT license. See the readme.MD file for mor...
mit
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/io/gbq.py
13
4006
""" Google BigQuery support """ def _try_import(): # since pandas is a dependency of pandas-gbq # we need to import on first use try: import pandas_gbq except ImportError: # give a nice error message raise ImportError("Load data from Google BigQuery\n" ...
apache-2.0
DynamicGravitySystems/DGP
examples/pyqtgraph_line_selection_plot.py
1
2135
import os import sys import uuid import logging import datetime import traceback from PyQt5 import QtCore import PyQt5.QtWidgets as QtWidgets import PyQt5.Qt as Qt import numpy as np from pandas import Series, DatetimeIndex os.chdir('..') import dgp.lib.project as project from dgp.gui.plotting.plotters import PqtLine...
apache-2.0
elijah513/scikit-learn
examples/linear_model/plot_logistic_l1_l2_sparsity.py
384
2601
""" ============================================== L1 Penalty and Sparsity in Logistic Regression ============================================== Comparison of the sparsity (percentage of zero coefficients) of solutions when L1 and L2 penalty are used for different values of C. We can see that large values of C give mo...
bsd-3-clause
dhruv13J/scikit-learn
sklearn/utils/tests/test_utils.py
215
8100
import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import pinv2 from itertools import chain from sklearn.utils.testing import (assert_equal, assert_raises, assert_true, assert_almost_equal, assert_array_equal, SkipTest, ...
bsd-3-clause
abimannans/scikit-learn
examples/cluster/plot_agglomerative_clustering_metrics.py
402
4492
""" Agglomerative clustering with different metrics =============================================== Demonstrates the effect of different metrics on the hierarchical clustering. The example is engineered to show the effect of the choice of different metrics. It is applied to waveforms, which can be seen as high-dimens...
bsd-3-clause
Unidata/MetPy
dev/_downloads/900d76c7356d09e4ca20b90f94a0732e/declarative_tutorial.py
2
21541
# Copyright (c) 2018 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ MetPy Declarative Syntax Tutorial ================================= The declarative syntax that is a part of the MetPy packaged is designed to aid in simple data exploration and...
bsd-3-clause
yati-sagade/incubator-airflow
airflow/contrib/hooks/bigquery_hook.py
1
49029
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
apache-2.0
jmcnamara/pandas_xlsxwriter_charts
examples/chart_grouped_column.py
1
1616
############################################################################## # # An example of creating a chart with Pandas and XlsxWriter. # # Copyright 2013, John McNamara, jmcnamara@cpan.org # import random import pandas as pd from vincent.colors import brews # Some sample data to plot. cat_4 = ['Metric_' + str(...
bsd-2-clause
viniciusd/DCO1008---Digital-Signal-Processing
projeto2/question1.py
1
1741
from pprint import pprint import matplotlib.pyplot as plt from common import Fft def fft_padded_plot(x): X = Fft(x, sample_rate=8192, padded=True) plt.figure() plt.plot(X.hz, X.abs) plt.xlabel('Frequency (Hz)') plt.ylabel('|H|') plt.savefig('q1_fft_padded.png') def fft_not_padded_plot(x): ...
mit
amjames/psi4
psi4/driver/qcdb/util/gph_uno_bipartite.py
1
24398
"""Functions to enumerate all perfect and maximum matchings in bipartite graph. Implemented following the algorithms in the paper "Algorithms for Enumerating All Perfect, Maximum and Maximal Matchings in Bipartite Graphs" by Takeaki Uno, using numpy and networkx modules of python. NOTICE: optimization needed. Author...
lgpl-3.0
pelson/numpy
numpy/lib/npyio.py
9
65323
__all__ = ['savetxt', 'loadtxt', 'genfromtxt', 'ndfromtxt', 'mafromtxt', 'recfromtxt', 'recfromcsv', 'load', 'loads', 'save', 'savez', 'savez_compressed', 'packbits', 'unpackbits', 'fromregex', 'DataSource'] import numpy as np import format import sys import os import re import sys import itertoo...
bsd-3-clause
reflectometry/osrefl
setup.py
1
1759
#!/usr/bin/env python import sys import os # Find the version number of the application for line in open("osrefl/__init__.py").readlines(): if line.startswith('__version__'): exec line #from distutils.core import Extension from setuptools import setup, find_packages, Extension #import fix_setuptools_chmod...
bsd-3-clause
jlegendary/scikit-learn
examples/semi_supervised/plot_label_propagation_digits.py
268
2723
""" =================================================== Label Propagation digits: Demonstrating performance =================================================== This example demonstrates the power of semisupervised learning by training a Label Spreading model to classify handwritten digits with sets of very few labels....
bsd-3-clause
ioam/holoviews
holoviews/plotting/bokeh/annotation.py
1
11706
from __future__ import absolute_import, division, unicode_literals from collections import defaultdict import param import numpy as np from bokeh.models import Span, Arrow, Div as BkDiv try: from bokeh.models.arrow_heads import TeeHead, NormalHead arrow_start = {'<->': NormalHead, '<|-|>': NormalHead} arr...
bsd-3-clause
yanlend/scikit-learn
sklearn/mixture/tests/test_gmm.py
48
17414
import unittest import copy import sys 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_ma...
bsd-3-clause
belltailjp/scikit-learn
examples/svm/plot_separating_hyperplane.py
62
1274
""" ========================================= SVM: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a Support Vector Machines classifier with linear kernel. """ print(__doc__) import numpy as np impo...
bsd-3-clause
eclee25/flu-SDI-exploratory-age
scripts/create_fluseverity_figs_v3/functions_v3.py
1
76886
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 10/15/14 ## Purpose: script of functions for data cleaning and processing to draw flu severity figures; supports figures in create_fluseverity_figs ## v2: swap child:adult OR to adult:child OR ## v3: ...
mit
equialgo/scikit-learn
sklearn/tests/test_multioutput.py
3
7954
import numpy as np import scipy.sparse as sp from sklearn.utils import shuffle from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regex from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing impor...
bsd-3-clause
elkingtonmcb/scikit-learn
examples/gaussian_process/gp_diabetes_dataset.py
223
1976
#!/usr/bin/python # -*- coding: utf-8 -*- """ ======================================================================== Gaussian Processes regression: goodness-of-fit on the 'diabetes' dataset ======================================================================== In this example, we fit a Gaussian Process model onto...
bsd-3-clause
zobristnicholas/PMM_Readout
pmmcontrol/simulator/detector.py
1
8816
from pmmcontrol.simulator.hysteresis import Hysteresis import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker from scipy.constants import pi from random import randrange class Detector(): def __init__(self, rows=9, cols=10): self.rows = rows self.cols = cols ...
agpl-3.0
UMN-Hydro/GSFLOW_pre-processor
python_scripts/plot_gsflow_csv.py
1
2455
# -*- coding: utf-8 -*- """ Created on Sun Oct 29 15:26:24 2017 @author: gcng """ # plot_gsflow_csv.m # # List of StatVarNames: see Table 12 of GSFLOW manual and # create_table_gsflowcsv.m import sys import platform import numpy as np from matplotlib import pyplot as plt import pandas as pd import datetime as dt ...
gpl-3.0
samzhang111/scikit-learn
examples/ensemble/plot_gradient_boosting_oob.py
230
4762
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
bsd-3-clause
hlin117/scikit-learn
sklearn/svm/setup.py
83
3160
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('svm', parent_package, top_path) config.add_subpackage('tests') # Section L...
bsd-3-clause
UDST/activitysim
activitysim/abm/models/cdap.py
2
4936
# ActivitySim # See full license in LICENSE.txt. from __future__ import (absolute_import, division, print_function, ) from future.standard_library import install_aliases install_aliases() # noqa: E402 import logging import pandas as pd from activitysim.core import simulate from activitysim.core import tracing from...
bsd-3-clause
rothnic/bokeh
examples/plotting/file/burtin.py
43
4765
from collections import OrderedDict from math import log, sqrt import numpy as np import pandas as pd from six.moves import cStringIO as StringIO from bokeh.plotting import figure, show, output_file antibiotics = """ bacteria, penicillin, streptomycin, neomycin, gram Mycobacterium tuberculosis...
bsd-3-clause
GuessWhoSamFoo/pandas
pandas/tests/indexes/period/test_period.py
1
21238
import numpy as np import pytest from pandas._libs.tslibs.period import IncompatibleFrequency import pandas.util._test_decorators as td import pandas as pd from pandas import ( DataFrame, DatetimeIndex, Index, NaT, Period, PeriodIndex, Series, date_range, offsets, period_range) from pandas.util import testing...
bsd-3-clause