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
KECB/learn
computer_vision/12_rmv_salt_pepper_median_blur.py
1
1464
import numpy as np import cv2 import matplotlib.pyplot as plt # load in image and add Salt and pepper noise moon = cv2.imread('images/moon.png', 0) ######################################################## ADD SALT & PEPPER NOISE # salt and peppering manually (randomly assign coords as either white or black) rows, col...
mit
mop/LTPTextDetector
scripts/pw_analyze/svmdelme.py
1
5600
import numpy as np from sklearn.cross_validation import cross_val_score, ShuffleSplit from sklearn.svm import LinearSVC, SVC from sklearn.grid_search import GridSearchCV from sklearn.metrics import precision_recall_fscore_support import matplotlib.pyplot as plt data = np.genfromtxt('dists_cleaned.csv', delimiter=','...
gpl-3.0
vorasagar7/sp17-i524
project/S17-IR-P001/code/ansible/ansible-node/files/visualization/FinalScript.py
4
15339
#Import the necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import json import pandas as pd from textblob import TextBlob from time import strptime import numpy as np import re import time import zipcode import sys, errno from n...
apache-2.0
mikekestemont/ruzicka
code/04latin_test_o2.py
1
3340
from __future__ import print_function import os import time import json import pickle import sys from itertools import product, combinations import matplotlib import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder from ruzicka.util...
mit
ndingwall/scikit-learn
sklearn/dummy.py
5
21753
# Author: Mathieu Blondel <mathieu@mblondel.org> # Arnaud Joly <a.joly@ulg.ac.be> # Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # License: BSD 3 clause import warnings import numpy as np import scipy.sparse as sp from .base import BaseEstimator, ClassifierMixin, RegressorMixin from .base impo...
bsd-3-clause
yasirkhan380/Tutorials
notebooks/fig_code/svm_gui.py
47
11549
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
maxlikely/scikit-learn
sklearn/ensemble/tests/test_partial_dependence.py
44
7031
""" Testing for the partial dependence module. """ import numpy as np from numpy.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import if_matplotlib from sklearn.ensemble.partial_dependence import partial_dependence from sklearn.ensemble.partial_dependence...
bsd-3-clause
hrjn/scikit-learn
examples/feature_selection/plot_f_test_vs_mi.py
75
1647
""" =========================================== 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
kushalbhola/MyStuff
Practice/PythonApplication/env/Lib/site-packages/pandas/tests/indexes/multi/test_contains.py
2
3306
import numpy as np import pytest from pandas.compat import PYPY import pandas as pd from pandas import MultiIndex import pandas.util.testing as tm def test_contains_top_level(): midx = MultiIndex.from_product([["A", "B"], [1, 2]]) assert "A" in midx assert "A" not in midx._engine def test_contains_wit...
apache-2.0
OpenTrading/OpenTrader
setup.py
1
2533
#!/usr/bin/env python import codecs import os import sys import glob from setuptools import setup, find_packages try: # http://stackoverflow.com/questions/21698004/python-behave-integration-in-setuptools-setup-py from setuptools_behave import behave_test except ImportError: behave_test = None dirname = o...
lgpl-3.0
WangWenjun559/Weiss
summary/sumy/sklearn/feature_selection/rfe.py
1
17079
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import warnings import numpy as np from ..utils import check_X_y, safe_sqr fro...
apache-2.0
alekz112/statsmodels
docs/source/plots/graphics_gofplots_qqplot.py
38
1911
# -*- coding: utf-8 -*- """ Created on Sun May 06 05:32:15 2012 Author: Josef Perktold editted by: Paul Hobson (2012-08-19) """ from scipy import stats from matplotlib import pyplot as plt import statsmodels.api as sm #example from docstring data = sm.datasets.longley.load() data.exog = sm.add_constant(data.exog, pre...
bsd-3-clause
Djabbz/scikit-learn
benchmarks/bench_plot_nmf.py
90
5742
""" Benchmarks of Non-Negative Matrix Factorization """ from __future__ import print_function from collections import defaultdict import gc from time import time import numpy as np from scipy.linalg import norm from sklearn.decomposition.nmf import NMF, _initialize_nmf from sklearn.datasets.samples_generator import...
bsd-3-clause
JeanKossaifi/scikit-learn
sklearn/datasets/lfw.py
141
19372
"""Loader for the Labeled Faces in the Wild (LFW) dataset This dataset is a collection of JPEG pictures of famous people collected over the internet, all details are available on the official website: http://vis-www.cs.umass.edu/lfw/ Each picture is centered on a single face. The typical task is called Face Veri...
bsd-3-clause
iainr/fridgid
Fridge.py
1
9372
import RPi.GPIO as GPIO import datetime import time import pandas as pd import logging import logging.handlers import sys logger = logging.getLogger('fridge') handler = logging.StreamHandler() fHandler = logging.FileHandler('fridge.log') formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s", "%Y-...
lgpl-3.0
ptkool/spark
python/pyspark/sql/tests/test_pandas_udf.py
12
10115
# # 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
raghavrv/scikit-learn
examples/linear_model/plot_logistic.py
73
1568
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic function ========================================================= Shown in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or tw...
bsd-3-clause
perryjohnson/biplaneblade
sandia_blade_lib/prep_stn32_mesh.py
1
10860
"""Write initial TrueGrid files for one Sandia blade station. Usage ----- start an IPython (qt)console with the pylab flag: $ ipython qtconsole --pylab or $ ipython --pylab Then, from the prompt, run this script: |> %run sandia_blade_lib/prep_stnXX_mesh.py or |> import sandia_blade_lib/prep_stnXX_mesh Au...
gpl-3.0
wilseypa/warped2-models
scripts/plotBags.py
1
12059
#!/usr/bin/python # Calculates statistics and plots the bag metrics from raw data from __future__ import print_function import csv import os, sys import numpy as np import scipy as sp import scipy.stats as sps import pandas as pd import re, shutil, tempfile import itertools, operator import subprocess import Gnuplot ...
mit
kivy-garden/garden.matplotlib
backend_kivy.py
1
50958
''' Backend Kivy ===== .. image:: images/backend_kivy_example.jpg :align: right The :class:`FigureCanvasKivy` widget is used to create a matplotlib graph. This widget has the same properties as :class:`kivy.ext.mpl.backend_kivyagg.FigureCanvasKivyAgg`. FigureCanvasKivy instead of rendering a static image, uses th...
mit
buckiracer/data-science-from-scratch
dataScienceFromScratch/DataScienceFromScratch/visualizing_data.py
58
5116
import matplotlib.pyplot as plt from collections import Counter def make_chart_simple_line_chart(plt): years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3] # create a line chart, years on x-axis, gdp on y-axis plt.plot(years, gdp, color='gr...
unlicense
stargaser/astropy
examples/io/split-jpeg-to-fits.py
3
2472
# -*- coding: utf-8 -*- """ ===================================================== Convert a 3-color image (JPG) to separate FITS images ===================================================== This example opens an RGB JPEG image and writes out each channel as a separate FITS (image) file. This example uses `pillow <htt...
bsd-3-clause
Averroes/statsmodels
statsmodels/tsa/statespace/tests/test_tools.py
19
4268
""" Tests for tools Author: Chad Fulton License: Simplified-BSD """ from __future__ import division, absolute_import, print_function import numpy as np import pandas as pd from statsmodels.tsa.statespace import tools # from .results import results_sarimax from numpy.testing import ( assert_equal, assert_array_eq...
bsd-3-clause
peckhams/topoflow
topoflow/components/met_base.py
1
111479
## Does "land_surface_air__latent_heat_flux" make sense? (2/5/13) # Copyright (c) 2001-2014, Scott D. Peckham # # Sep 2014. Fixed sign error in update_bulk_richardson_number(). # Ability to compute separate P_snow and P_rain. # Aug 2014. New CSDMS Standard Names and clean up. # Nov 2013. Con...
mit
liebermeister/flux-enzyme-cost-minimization
scripts/monod_curve.py
1
6430
# -*- coding: utf-8 -*- """ Created on Wed Oct 1 2015 @author: noore """ import os import numpy as np import matplotlib.pyplot as plt from matplotlib import gridspec from scipy.optimize import curve_fit import definitions as D import pandas as pd #LOW_GLUCOSE = D.LOW_CONC['glucoseExt'] LOW_GLUCOSE = 1e-3 # in mM, i...
gpl-2.0
aminert/scikit-learn
sklearn/linear_model/logistic.py
105
56686
""" Logistic Regression """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # Fabian Pedregosa <f@bianp.net> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Manoj Kumar <manojkumarsivaraj334@gmail.com> # Lars Buitinck # Simon Wu <s8wu@uwaterloo.ca> imp...
bsd-3-clause
Vimos/scikit-learn
sklearn/kernel_approximation.py
7
18505
""" The :mod:`sklearn.kernel_approximation` module implements several approximate kernel feature maps base on Fourier transforms. """ # Author: Andreas Mueller <amueller@ais.uni-bonn.de> # # License: BSD 3 clause import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import svd from .base im...
bsd-3-clause
pysb/pysb
pysb/examples/run_earm_hpp.py
5
2377
""" Run the Extrinsic Apoptosis Reaction Model (EARM) using BioNetGen's Hybrid-Particle Population (HPP) algorithm. NFsim provides stochastic simulation without reaction network generation, allowing simulation of models with large (or infinite) reaction networks by keeping track of species counts. However, it can fa...
bsd-2-clause
MDAnalysis/mdanalysis
package/MDAnalysis/analysis/encore/dimensionality_reduction/reduce_dimensionality.py
1
9928
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 # # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under t...
gpl-2.0
shiquanwang/pylearn2
pylearn2/cross_validation/tests/test_train_cv_extensions.py
49
1681
""" Tests for TrainCV extensions. """ import os import tempfile from pylearn2.config import yaml_parse from pylearn2.testing.skip import skip_if_no_sklearn def test_monitor_based_save_best_cv(): """Test MonitorBasedSaveBestCV.""" handle, filename = tempfile.mkstemp() skip_if_no_sklearn() trainer = ya...
bsd-3-clause
cactusbin/nyt
matplotlib/examples/user_interfaces/embedding_in_tk.py
9
1419
#!/usr/bin/env python import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg # implement the default mpl key bindings from matplotlib.backend_bases import key_press_handler from matplotlib.figure import Fig...
unlicense
justincassidy/scikit-learn
sklearn/ensemble/tests/test_forest.py
57
35265
""" 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
ianctse/pvlib-python
pvlib/test/test_modelchain.py
1
8186
import numpy as np import pandas as pd from numpy import nan from pvlib import modelchain, pvsystem from pvlib.modelchain import ModelChain from pvlib.pvsystem import PVSystem from pvlib.tracking import SingleAxisTracker from pvlib.location import Location from pandas.util.testing import assert_series_equal, assert_f...
bsd-3-clause
cwu2011/scikit-learn
sklearn/preprocessing/__init__.py
14
1184
""" The :mod:`sklearn.preprocessing` module includes scaling, centering, normalization, binarization and imputation methods. """ from .data import Binarizer from .data import KernelCenterer from .data import MinMaxScaler from .data import MaxAbsScaler from .data import Normalizer from .data import RobustScaler from .d...
bsd-3-clause
ElDeveloper/scikit-learn
sklearn/tree/tests/test_tree.py
13
52365
""" Testing for the tree module (sklearn.tree). """ import pickle from functools import partial from itertools import product import platform import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import sparse_rand...
bsd-3-clause
fmfn/UnbalancedDataset
imblearn/ensemble/_weight_boosting.py
2
11479
from copy import deepcopy import numpy as np from sklearn.base import clone from sklearn.ensemble import AdaBoostClassifier from sklearn.ensemble._base import _set_random_states from sklearn.utils import _safe_indexing from ..under_sampling.base import BaseUnderSampler from ..under_sampling import RandomUnderSampler...
mit
apdjustino/DRCOG_Urbansim
urbandeveloper/elasticity_model_2SLS.py
1
6896
__author__ = 'JMartinez' import numpy as np, pandas as pd, os from synthicity.utils import misc import pysal as py class elasticity_model(object): def __init__(self, dset): self.zones = dset.zones self.buildings_far = pd.merge(dset.buildings, dset.fars, left_on='far_id', right_index=True) ...
agpl-3.0
e-matteson/pipit-keyboard
extras/audio/make_audio_files.py
1
2652
#!/bin/python2 from __future__ import division import subprocess from time import sleep import os # for generating sound files import numpy as np import matplotlib.pyplot as plt import scipy.io.wavfile import scipy.signal as sig import scipy.stats as stats master_volume = 1 sounds = { 'A':{'filename':'tick1.wa...
gpl-3.0
arjunkhode/ASP
lectures/03-Fourier-properties/plots-code/symmetry-real-even.py
26
1150
import matplotlib.pyplot as plt import numpy as np import sys import math from scipy.signal import triang from scipy.fftpack import fft, fftshift M = 127 N = 128 hM1 = int(math.floor((M+1)/2)) hM2 = int(math.floor(M/2)) x = triang(M) fftbuffer = np.zeros(N) fftbuffer[:hM1] = x[hM2:] fftbuffer[N-hM2:] = x[:hM2] X =...
agpl-3.0
alexlib/openpiv-python
setup.py
2
1786
from os import path from setuptools import setup, find_packages # read the contents of your README file this_directory = path.abspath(path.dirname(__file__)) # with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_d...
gpl-3.0
evgchz/scikit-learn
sklearn/linear_model/ransac.py
16
13870
# coding: utf-8 # Author: Johannes Schönberger # # License: BSD 3 clause import numpy as np from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone from ..utils import check_random_state, check_array, check_consistent_length from ..utils.random import sample_without_replacement from .base import ...
bsd-3-clause
openworm/tracker-commons
src/Python/wcon/wcon_parser.py
3
28807
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Methods ------------ reject_duplicates Classes ------------ WCONWorms """ import six import warnings from collections import OrderedDict from six import StringIO from os import path import os import shutil import json import jsonschema import zipfile import numpy as n...
mit
winklerand/pandas
pandas/tests/test_resample.py
1
135497
# pylint: disable=E1101 from warnings import catch_warnings from datetime import datetime, timedelta from functools import partial from textwrap import dedent import pytz import pytest import dateutil import numpy as np import pandas as pd import pandas.tseries.offsets as offsets import pandas.util.testing as tm imp...
bsd-3-clause
mjudsp/Tsallis
sklearn/manifold/tests/test_locally_linear.py
27
5247
from itertools import product from nose.tools import assert_true import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy import linalg from sklearn import neighbors, manifold from sklearn.manifold.locally_linear import barycenter_kneighbors_graph from sklearn.utils.testi...
bsd-3-clause
lenovor/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
xwolf12/scikit-learn
benchmarks/bench_glm.py
297
1493
""" A comparison of different methods in GLM Data comes from a random square matrix. """ from datetime import datetime import numpy as np from sklearn import linear_model from sklearn.utils.bench import total_seconds if __name__ == '__main__': import pylab as pl n_iter = 40 time_ridge = np.empty(n_it...
bsd-3-clause
wateraccounting/wa
Collect/CFSR/DataAccess_CFSR.py
1
8868
# -*- coding: utf-8 -*- """ Authors: Tim Hessels UNESCO-IHE 2016 Contact: t.hessels@unesco-ihe.org Repository: https://github.com/wateraccounting/wa Module: Collect/CFSR """ # General modules import pandas as pd import os import numpy as np from netCDF4 import Dataset import re from joblib import Parallel, del...
apache-2.0
renyi533/tensorflow
tensorflow/python/kernel_tests/constant_op_eager_test.py
33
21448
# 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
andela-mfalade/python-pandas-csv-records-analysis
scripts/processor.py
1
5798
"""Initiate file analysis. This module is used to find the discrepancies between two given files """ import argparse import csv import logging import pandas as pd logger = logging.getLogger(__file__) logging.basicConfig(level=logging.DEBUG) mathching_records_path = 'matching_records.csv' non_mathching_records_path...
mit
yyjiang/scikit-learn
sklearn/neighbors/tests/test_kd_tree.py
129
7848
import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.kd_tree import (KDTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dist_metrics import Dista...
bsd-3-clause
MatthieuBizien/scikit-learn
sklearn/manifold/setup.py
24
1279
import os from os.path import join import numpy from numpy.distutils.misc_util import Configuration from sklearn._build_utils import get_blas_info def configuration(parent_package="", top_path=None): config = Configuration("manifold", parent_package, top_path) libraries = [] if os.name == 'posix': ...
bsd-3-clause
pllim/ginga
ginga/rv/plugins/Preferences.py
1
63607
# This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. """ Make changes to channel settings graphically in the UI. **Plugin Type: Local** ``Preferences`` is a local plugin, which means it is associated with a channel. An instance can be opened for each channel. *...
bsd-3-clause
yavalvas/yav_com
build/matplotlib/doc/mpl_examples/event_handling/viewlims.py
6
2880
# Creates two identical panels. Zooming in on the right panel will show # a rectangle in the first panel, denoting the zoomed region. import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Rectangle # We just subclass Rectangle so that it can be called with an Axes # instance, causing the r...
mit
abhiver222/perkt
face_recognition.py
2
5724
import cv2 import sys #import matplotlib.pyplot as pt import numpy as np import numpy.linalg as la import math as mt #Content of out eigens <<<<<<< HEAD:face_recognition.py # there would be five images of each person # the collumns would be the frob norm of each type # 4 rows for each person # 1)Smiling # 2)Sad # 3)Se...
mit
Unidata/MetPy
v0.11/startingguide-1.py
4
1432
import matplotlib.pyplot as plt import numpy as np import metpy.calc as mpcalc from metpy.plots import SkewT from metpy.units import units fig = plt.figure(figsize=(9, 9)) skew = SkewT(fig) # Create arrays of pressure, temperature, dewpoint, and wind components p = [902, 897, 893, 889, 883, 874, 866, 857, 849, 841, 8...
bsd-3-clause
joegomes/deepchem
deepchem/models/tests/test_overfit.py
1
35451
""" Tests to make sure deepchem models can overfit on tiny datasets. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals __author__ = "Bharath Ramsundar" __copyright__ = "Copyright 2016, Stanford University" __license__ = "MIT" import os import tempfile im...
mit
mattsmart/biomodels
oncogenesis_dynamics/firstpassage.py
1
15435
import matplotlib.pyplot as plt import numpy as np import time from os import sep from multiprocessing import Pool, cpu_count from constants import OUTPUT_DIR, PARAMS_ID, PARAMS_ID_INV, COLOURS_DARK_BLUE from data_io import read_varying_mean_sd_fpt_and_params, collect_fpt_mean_stats_and_params, read_fpt_and_params,\ ...
mit
soylentdeen/Graffity
src/Vibrations/VibrationExplorer.py
1
5531
import sys sys.path.append('../') import numpy import Graffity import CIAO_DatabaseTools import astropy.time as aptime from matplotlib import pyplot import colorsys def getFreqs(): while True: retval = [] enteredText = raw_input("Enter a comma separated list of frequencies: ") try: ...
mit
eoinmurray/icarus
Experiments/power_dep.py
1
1341
import os,sys parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0,parentdir) import numpy as np import matplotlib.pyplot as plt from constants import Constants import Icarus.Experiment as Experiment if __name__ == "__main__": """ Runs power dependance. """ constants = ...
mit
openai/baselines
baselines/results_plotter.py
1
3455
import numpy as np import matplotlib matplotlib.use('TkAgg') # Can change to 'Agg' for non-interactive mode import matplotlib.pyplot as plt plt.rcParams['svg.fonttype'] = 'none' from baselines.common import plot_util X_TIMESTEPS = 'timesteps' X_EPISODES = 'episodes' X_WALLTIME = 'walltime_hrs' Y_REWARD = 'reward' Y_...
mit
Sixshaman/networkx
doc/make_gallery.py
35
2453
""" Generate a thumbnail gallery of examples. """ from __future__ import print_function import os, glob, re, shutil, sys import matplotlib matplotlib.use("Agg") import matplotlib.pyplot import matplotlib.image from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCa...
bsd-3-clause
hainm/scikit-learn
examples/cluster/plot_kmeans_assumptions.py
270
2040
""" ==================================== Demonstration of k-means assumptions ==================================== This example is meant to illustrate situations where k-means will produce unintuitive and possibly unexpected clusters. In the first three plots, the input data does not conform to some implicit assumptio...
bsd-3-clause
kcarnold/autograd
examples/fluidsim/fluidsim.py
2
4623
from __future__ import absolute_import from __future__ import print_function import autograd.numpy as np from autograd import value_and_grad from scipy.optimize import minimize from scipy.misc import imread import matplotlib import matplotlib.pyplot as plt import os from builtins import range # Fluid simulation code...
mit
jenshnielsen/basemap
examples/maskoceans.py
4
1922
from mpl_toolkits.basemap import Basemap, shiftgrid, maskoceans, interp import numpy as np import matplotlib.pyplot as plt # example showing how to mask out 'wet' areas on a contour or pcolor plot. topodatin = np.loadtxt('etopo20data.gz') lonsin = np.loadtxt('etopo20lons.gz') latsin = np.loadtxt('etopo20lats.gz') #...
gpl-2.0
Juanlu001/pfc
demo/plot_h.py
1
6084
#****************************************************************************** # * # * ** * * * * * # * * * * * * * * * * ...
gpl-3.0
wogsland/QSTK
build/lib.linux-x86_64-2.7/QSTK/qstkstudy/Events.py
5
1878
# (c) 2011, 2012 Georgia Tech Research Corporation # This source code is released under the New BSD license. Please see # http://wiki.quantsoftware.org/index.php?title=QSTK_License # for license details. #Created on October <day>, 2011 # #@author: Vishal Shekhar #@contact: mailvishalshekhar@gmail.com #@summary: Examp...
bsd-3-clause
SitiBanc/1061_NCTU_IOMDS
1025/Homework 5/HW5_5.py
1
5472
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 26 21:05:37 2017 @author: sitibanc """ import pandas as pd import numpy as np import matplotlib.pyplot as plt # ============================================================================= # Read CSV # =============================================...
apache-2.0
Unidata/MetPy
v0.12/_downloads/7b1d8e864fd4783fdaff1a83cdf9c52f/Find_Natural_Neighbors_Verification.py
6
2521
# Copyright (c) 2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Find Natural Neighbors Verification =================================== Finding natural neighbors in a triangulation A triangle is a natural neighbor of a point if that point i...
bsd-3-clause
mxjl620/scikit-learn
examples/ensemble/plot_ensemble_oob.py
259
3265
""" ============================= OOB Errors for Random Forests ============================= The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where each new tree is fit from a bootstrap sample of the training observations :math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er...
bsd-3-clause
pfnet/chainer
examples/wavenet/train.py
6
5955
import argparse import os import pathlib import warnings import numpy import chainer from chainer.training import extensions import chainerx from net import EncoderDecoderModel from net import UpsampleNet from net import WaveNet from utils import Preprocess import matplotlib matplotlib.use('Agg') parser = argpars...
mit
JFriel/honours_project
networkx/build/lib/networkx/convert_matrix.py
10
33329
"""Functions to convert NetworkX graphs to and from numpy/scipy matrices. The preferred way of converting data to a NetworkX graph is through the graph constuctor. The constructor calls the to_networkx_graph() function which attempts to guess the input type and convert it automatically. Examples -------- Create a 10...
gpl-3.0
shahankhatch/scikit-learn
examples/text/document_clustering.py
230
8356
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
bsd-3-clause
mganeva/mantid
Framework/PythonInterface/mantid/plots/modest_image/modest_image.py
1
10141
# v0.2 obtained on March 12, 2019 """ Modification of Chris Beaumont's mpl-modest-image package to allow the use of set_extent. """ from __future__ import print_function, division import matplotlib rcParams = matplotlib.rcParams import matplotlib.image as mi import matplotlib.colors as mcolors import matplotlib.cbook...
gpl-3.0
xebitstudios/Kayak
examples/poisson_glm.py
3
1224
import numpy as np import numpy.random as npr import matplotlib.pyplot as plt import sys sys.path.append('..') import kayak N = 10000 D = 5 P = 1 learn = 0.00001 batch_size = 500 # Random inputs. X = npr.randn(N,D) true_W = npr.randn(D,P) lam = np.exp(np.dot(X, true_W)) Y = npr.poisson(lam) kyk_batcher = k...
mit
rohanp/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
23
45330
from itertools import product import pickle 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_scor...
bsd-3-clause
DistrictDataLabs/django-data-product
irisfinder/views.py
1
1948
from django.shortcuts import render import datetime from models import Iris, SVMModels from forms import UserIrisData import sklearn from sklearn import svm from sklearn.cross_validation import train_test_split import numpy as np from django.conf import settings import cPickle import scipy from pytz import timezone imp...
apache-2.0
ndardenne/pymatgen
pymatgen/io/abinit/tasks.py
2
166549
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """This module provides functions and classes related to Task objects.""" from __future__ import division, print_function, unicode_literals, absolute_import import os import time import datetime import shutil i...
mit
tmeits/pybrain
pybrain/auxiliary/gaussprocess.py
25
9240
from __future__ import print_function __author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de; Christian Osendorfer, osendorf@in.tum.de' from scipy import r_, exp, zeros, eye, array, asarray, random, ravel, diag, sqrt, sin, cos, sort, mgrid, dot, floor from scipy import c_ #@UnusedImport from scipy.linalg import solve,...
bsd-3-clause
cosmoharrigan/pylearn2
pylearn2/gui/tangent_plot.py
44
1730
""" Code for plotting curves with tangent lines. """ __author__ = "Ian Goodfellow" try: from matplotlib import pyplot except Exception: pyplot = None from theano.compat.six.moves import xrange def tangent_plot(x, y, s): """ Plots a curve with tangent lines. Parameters ---------- x : lis...
bsd-3-clause
dremio/arrow
integration/integration_test.py
4
33972
# 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
harisbal/pandas
pandas/tests/series/test_missing.py
1
51950
# coding=utf-8 # pylint: disable-msg=E1101,W0612 from datetime import datetime, timedelta from distutils.version import LooseVersion import numpy as np from numpy import nan import pytest import pytz from pandas._libs.tslib import iNaT from pandas.compat import range from pandas.errors import PerformanceWarning impo...
bsd-3-clause
pandegroup/osprey
osprey/strategies.py
2
12612
from __future__ import print_function, absolute_import, division import sys import inspect import socket import numpy as np from sklearn.utils import check_random_state from sklearn.model_selection import ParameterGrid try: from hyperopt import (Trials, tpe, fmin, STATUS_OK, STATUS_RUNNING, ...
apache-2.0
rhoscanner-team/pcd-plotter
delaunay_example.py
1
1435
import numpy as np from scipy.spatial import Delaunay points = np.random.rand(30, 2) # 30 points in 2-d tri = Delaunay(points) # Make a list of line segments: # edge_points = [ ((x1_1, y1_1), (x2_1, y2_1)), # ((x1_2, y1_2), (x2_2, y2_2)), # ... ] edge_points = [] edges = set() def ad...
gpl-2.0
remenska/rootpy
rootpy/plotting/contrib/plot_corrcoef_matrix.py
5
12192
# Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License from __future__ import absolute_import from ...extern.six.moves import range from ...extern.six import string_types __all__ = [ 'plot_corrcoef_matrix', 'corrcoef', 'cov', ] def plot_corrcoef_matrix(mat...
gpl-3.0
nathanshartmann/portuguese_word_embeddings
sentence_similarity.py
1
3369
""" This script evaluates a embedding model in a semantic similarity perspective. It uses the dataset of ASSIN sentence similarity shared task and the method of Hartmann which achieved the best results in the competition. ASSIN shared-task website: http://propor2016.di.fc.ul.pt/?page_id=381 Paper of Hartmann can be ...
gpl-3.0
hetajen/vnpy161
vn.trader/ctaStrategy/ctaBacktesting.py
1
40890
# encoding: UTF-8 ''' 本文件中包含的是CTA模块的回测引擎,回测引擎的API和CTA引擎一致, 可以使用和实盘相同的代码进行回测。 History <id> <author> <description> 2017051200 hetajen 样例:策略回测和优化 ''' from __future__ import division '''2017051200 Add by hetajen begin''' import time '''2017051200 Add by hetajen end''' from datetime import d...
mit
kylerbrown/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
aureooms/networkx
examples/algorithms/blockmodel.py
12
3014
#!/usr/bin/env python # encoding: utf-8 """ Example of creating a block model using the blockmodel function in NX. Data used is the Hartford, CT drug users network: @article{, title = {Social Networks of Drug Users in {High-Risk} Sites: Finding the Connections}, volume = {6}, shorttitle = {Social Networks of Drug ...
bsd-3-clause
sauloal/cnidaria
scripts/venv/lib/python2.7/site-packages/matplotlib/testing/compare.py
11
12935
""" Provides a collection of utilities for comparing (image) results. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six import hashlib import os import shutil import numpy as np import matplotlib from matplotlib.compat import subprocess from...
mit
ishank08/scikit-learn
sklearn/datasets/tests/test_base.py
16
9390
import os import shutil import tempfile import warnings import numpy from pickle import loads from pickle import dumps from sklearn.datasets import get_data_home from sklearn.datasets import clear_data_home from sklearn.datasets import load_files from sklearn.datasets import load_sample_images from sklearn.datasets im...
bsd-3-clause
lucidfrontier45/scikit-learn
sklearn/utils/tests/test_extmath.py
2
8819
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # License: BSD import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sk...
bsd-3-clause
DGrady/pandas
asv_bench/benchmarks/io_sql.py
7
4120
import sqlalchemy from .pandas_vb_common import * import sqlite3 from sqlalchemy import create_engine #------------------------------------------------------------------------------- # to_sql class WriteSQL(object): goal_time = 0.2 def setup(self): self.engine = create_engine('sqlite:///:memory:') ...
bsd-3-clause
merenlab/anvio
anvio/drivers/MODELLER.py
1
40930
# coding: utf-8 """ Interface to MODELLER (https://salilab.org/modeller/). """ import os import anvio import shutil import argparse import subprocess import pandas as pd import anvio.utils as utils import anvio.fastalib as u import anvio.terminal as terminal import anvio.constants as constants import anvio.filesnpath...
gpl-3.0
shahankhatch/scikit-learn
sklearn/decomposition/dict_learning.py
104
44632
""" Dictionary learning """ from __future__ import print_function # Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort # License: BSD 3 clause import time import sys import itertools from math import sqrt, ceil import numpy as np from scipy import linalg from numpy.lib.stride_tricks import as_strided from ..b...
bsd-3-clause
ChinaQuants/zipline
zipline/utils/data.py
31
12761
# # 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 law or agreed to in wr...
apache-2.0
PennyDreadfulMTG/Penny-Dreadful-Tools
decksite/charts/chart.py
1
2940
import os.path import pathlib from typing import Dict import matplotlib as mpl # This has to happen before pyplot is imported to avoid needing an X server to draw the graphs. # pylint: disable=wrong-import-position mpl.use('Agg') import matplotlib.pyplot as plt import seaborn as sns from decksite.data import deck fro...
gpl-3.0
ajdawson/windspharm
examples/iris/rws_example.py
1
2190
"""Compute Rossby wave source from the long-term mean flow. This example uses the iris interface. Additional requirements for this example: * iris (http://scitools.org.uk/iris/) * matplotlib (http://matplotlib.org/) * cartopy (http://scitools.org.uk/cartopy/) """ import warnings import cartopy.crs as ccrs import i...
mit
gkulkarni/JetMorphology
fitjet_3d.py
1
5370
""" File: fitjet_3d.py Fits a geometric model to mock jet data. Uses image subtraction; otherwise same as fitjet.py """ import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import cm import scipy.optimize as op import emcee import triangle import sys # These mock data are pr...
mit
ahoyosid/scikit-learn
sklearn/utils/arpack.py
265
64837
""" This contains a copy of the future version of scipy.sparse.linalg.eigen.arpack.eigsh It's an upgraded wrapper of the ARPACK library which allows the use of shift-invert mode for symmetric matrices. Find a few eigenvectors and eigenvalues of a matrix. Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/ """ #...
bsd-3-clause
sdbonin/SOQresearch
SOQswapRK4.py
1
8364
# -*- coding: utf-8 -*- """ This code uses a loop along with our set of coupled differential equations and matrix math to create arrays of 4-vector quaternions. The old plotting functions need to be updated and incorperated into the end of this code or a better visualization solution needs to be found. """ ...
mit