repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
schets/scikit-learn
examples/linear_model/plot_sgd_penalties.py
249
1563
""" ============== SGD: Penalties ============== Plot the contours of the three penalties. All of the above are supported by :class:`sklearn.linear_model.stochastic_gradient`. """ from __future__ import division print(__doc__) import numpy as np import matplotlib.pyplot as plt def l1(xs): return np.array([np....
bsd-3-clause
kevinhikali/ml_kevin
bottom/logistic_regression.py
1
1151
# -*- coding: utf-8 -*- """ @author: kevinhikali @email: hmingwei@gmail.com """ import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from math import exp # global variable SampleTh = np.array([[2], [5]]) # function def h(th, x): global SampleTh retur...
gpl-3.0
brentp/vcfanno
scripts/paper/parallelization-figure.py
2
2106
import toolshed as ts lookup = {'ALL.wgs.phase3_shapeit2_mvncall_integrated_v5a.20130502.sites': '1000G', 'ExAC.r0.3.sites.vep': 'ExAC'} data = {'1000G': [], 'ExAC': []} """ method procs time query var 20 888.29 seconds ALL.wgs.phase3_shapeit2_mvncall_integrated_v5a.20130502.sites var 19 897.02 seconds ALL...
mit
icfaust/TRIPPy
TRIPPy/plot/pyplot.py
1
5770
import scipy import scipy.special import matplotlib.pyplot as plt def plotTokamak(tokamak, pltobj=None, axis=True, pargs=None, **kwargs): if pltobj is None: pltobj = plt if pargs is None: pltobj.plot(tokamak.sagi.s, tokamak.norm.s, **kwargs) else: pltobj.plot(tokamak.sagi.s, t...
mit
stupid-coder/lwan
tools/benchmark.py
6
4379
#!/usr/bin/python import sys import json import commands import time try: import matplotlib.pyplot as plt except ImportError: plt = None def clearstderrline(): sys.stderr.write('\033[2K') def weighttp(url, n_threads, n_connections, n_requests, keep_alive): keep_alive = '-k' if keep_alive else '' command...
gpl-2.0
jjbrin/trading-with-python
lib/functions.py
76
11627
# -*- coding: utf-8 -*- """ twp support functions @author: Jev Kuznetsov Licence: GPL v2 """ from scipy import polyfit, polyval import datetime as dt #from datetime import datetime, date from pandas import DataFrame, Index, Series import csv import matplotlib.pyplot as plt import numpy as np import p...
bsd-3-clause
DonBeo/scikit-learn
sklearn/metrics/__init__.py
10
3328
""" The :mod:`sklearn.metrics` module includes score functions, performance metrics and pairwise metrics and distance computations. """ from .ranking import auc from .ranking import average_precision_score from .ranking import coverage_error from .ranking import label_ranking_average_precision_score from .ranking imp...
bsd-3-clause
yask123/scikit-learn
sklearn/tests/test_dummy.py
186
17778
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.base import clone from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_eq...
bsd-3-clause
galtys/galtys-addons
html_reports/controllers/reports.py
1
1044
import openerp.addons.web.http as oeweb import werkzeug.utils import werkzeug.wrappers import openerp from openerp import pooler from openerp import SUPERUSER_ID from werkzeug.wrappers import Response from mako.template import Template from mako.runtime import Context from StringIO import StringIO from openerp.module...
agpl-3.0
klusta-team/klustaviewa
klustaviewa/views/tests/test_correlogramsview.py
2
1678
"""Unit tests for correlograms view.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import os import numpy as np import numpy.random as rnd import pandas as pd from klustaviewa.views.tests.mo...
bsd-3-clause
mquezada/tweets-summarizer
src/doc2vec.py
1
1688
import gensim import numpy as np from collections import namedtuple from load_data import expanded_urls, df from process_text import process, replace_map_url from model_documents import docs from sklearn.manifold import TSNE import matplotlib.pyplot as plt from matplotlib.ticker import NullFormatter from sklearn.clust...
gpl-3.0
evgchz/scikit-learn
examples/classification/plot_classification_probability.py
242
2624
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
DerPhysikeR/pywbm
pywbm.py
1
1782
#!/usr/bin/env python """ 2017-05-13 21:05:35 @author: Paul Reiter """ import numpy as np import matplotlib.pyplot as plt from scipy.special import hankel2 from pywbm import Subdomain def vn(x, y, z, k): # incident velocity on left side # return (x == 0).astype(complex)*1j/(k*z) # incident velocity on le...
gpl-3.0
abimannans/scikit-learn
examples/svm/plot_svm_nonlinear.py
268
1091
""" ============== Non-linear SVM ============== Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. The color map illustrates the decision function learned by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn imp...
bsd-3-clause
bdh1011/wau
venv/lib/python2.7/site-packages/pandas/io/clipboard.py
14
2947
""" io on the clipboard """ from pandas import compat, get_option, option_context, DataFrame from pandas.compat import StringIO def read_clipboard(**kwargs): # pragma: no cover """ Read text from clipboard and pass to read_table. See read_table for the full argument list If unspecified, `sep` defaul...
mit
anhaidgroup/py_stringsimjoin
py_stringsimjoin/tests/test_suffix_filter.py
1
25219
import unittest from nose.tools import assert_equal, assert_list_equal, nottest, raises from py_stringmatching.tokenizer.delimiter_tokenizer import DelimiterTokenizer from py_stringmatching.tokenizer.qgram_tokenizer import QgramTokenizer import numpy as np import pandas as pd from py_stringsimjoin.filter.suffix_filte...
bsd-3-clause
murali-munna/scikit-learn
examples/model_selection/plot_roc.py
146
3697
""" ======================================= Receiver Operating Characteristic (ROC) ======================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality. ROC curves typically feature true positive rate on the Y axis, and false positive rate on the X a...
bsd-3-clause
etkirsch/scikit-learn
sklearn/semi_supervised/label_propagation.py
71
15342
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms per...
bsd-3-clause
pratapvardhan/scikit-learn
examples/plot_digits_pipe.py
70
1813
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Pipelining: chaining a PCA and a logistic regression ========================================================= The PCA does an unsupervised dimensionality reduction, while the logistic regression does the predictio...
bsd-3-clause
mavarick/jieba
test/extract_topic.py
65
1463
import sys sys.path.append("../") from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn import decomposition import jieba import time import glob import sys import os import random if len(sys.argv)<2: print("usage: extract_topic.py di...
mit
nicproulx/mne-python
examples/inverse/plot_label_from_stc.py
31
3963
""" ================================================= Generate a functional label from source estimates ================================================= Threshold source estimates and produce a functional label. The label is typically the region of interest that contains high values. Here we compare the average time ...
bsd-3-clause
DmitryYurov/BornAgain
Examples/Demos/simul_demo_lattice2.py
2
2472
''' Simulation demo: Cylinder form factor without interference ''' import numpy import matplotlib import math from bornagain import * M_PI = numpy.pi # ---------------------------------- # describe sample and run simulation # ---------------------------------- def RunSimulation(): # defining materials mAmbie...
gpl-3.0
fdeheeger/mpld3
mpld3/tests/test_elements.py
16
5658
""" Test creation of basic plot elements """ import numpy as np import matplotlib.pyplot as plt from .. import fig_to_dict, fig_to_html from numpy.testing import assert_equal def test_line(): fig, ax = plt.subplots() ax.plot(np.arange(10), np.random.random(10), '--k', alpha=0.3, zorder=10, lw=2) ...
bsd-3-clause
Myasuka/scikit-learn
sklearn/mixture/tests/test_gmm.py
200
17427
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
mickypaganini/SSI2016-jet-clustering
hdb.py
1
6413
print(__doc__) from sklearn import metrics import numpy as np from read_data import read_data from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from itertools import cycle import os from sklearn.neighbors import DistanceMetric def hdb(txtfile, even...
mit
vbalderdash/LMAsimulation
simulation_ellipse.py
1
12093
import numpy as np from scipy.linalg import lstsq from scipy.optimize import leastsq from coordinateSystems import GeographicSystem from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt from matplotlib.patches import Ellipse def travel_time(X, X_ctr, c, t0=0.0, get_r=False): """ Units are meter...
mit
grundgruen/zipline
zipline/utils/data_source_tables_gen.py
40
7380
# # Copyright 2014 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
allthroughthenight/aces
python/drivers/ext_Hs_analysis.py
1
22155
import sys import math import numpy as np import matplotlib.pyplot as plt sys.path.append('../functions') from base_driver import BaseDriver from helper_objects import BaseField import USER_INPUT from ERRSTP import ERRSTP from ERRWAVBRK1 import ERRWAVBRK1 from WAVELEN import WAVELEN from EXPORTER import EXPORTER ## ...
gpl-3.0
hugobowne/scikit-learn
sklearn/metrics/tests/test_pairwise.py
22
25505
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
HFO-detect/HFO-detect-python
pyhfo_detect/core/cs_detector.py
1
18781
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 20 14:27:15 2017 Ing.,Mgr. (MSc.) Jan Cimbálník, PhD. Biomedical engineering International Clinical Research Center St. Anne's University Hospital in Brno Czech Republic & Mayo systems electrophysiology lab Mayo Clinic 200 1st St SW Rochester, MN Un...
bsd-3-clause
ercius/openNCEM
setup.py
1
4143
"""A setuptools based setup module. See https://packaging.python.org/en/latest/distributing.html Addapted from https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from codecs import open from os import path from setuptools import setup , find_packages # To use a consistent encoding h...
gpl-3.0
mesnardo/PetIBM
examples/decoupledibpm/cylinder2dRe550_GPU/scripts/plotVorticity.py
3
1384
""" Computes, plots, and saves the 2D vorticity field from a PetIBM simulation after 1200 time steps (3 non-dimensional time-units). """ import pathlib import h5py import numpy from matplotlib import pyplot simu_dir = pathlib.Path(__file__).absolute().parents[1] # Read vorticity field and its grid from files. name ...
bsd-3-clause
niamoto/niamoto-core
niamoto/data_providers/plantnote_provider/plantnote_occurrence_provider.py
1
4162
# coding: utf-8 from sqlalchemy import * import pandas as pd from niamoto.data_providers.base_occurrence_provider import \ BaseOccurrenceProvider class PlantnoteOccurrenceProvider(BaseOccurrenceProvider): """ Pl@ntnote Occurrence Provider. Provide occurrences from a Pl@ntnote database. The Pl@ntnote...
gpl-3.0
balazsdukai/GEO1005-StormManager
SpatialDecision/external/networkx/convert_matrix.py
7
33333
"""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-2.0
gilyclem/larVolumeToObj
larVolumeToObjG/computation/step_calcchains_serial_tobinary_filter_proc_lisa.py
2
18114
# -*- coding: utf-8 -*- from lar import * from scipy import * import json # import scipy import numpy as np # import time as tm # import gc # from pngstack2array3d import * import struct import getopt import traceback # import matplotlib.pyplot as plt # threading import multiprocessing from multiprocessing import Proc...
mit
zorroblue/scikit-learn
examples/calibration/plot_calibration.py
41
4826
""" ====================================== Probability calibration of classifiers ====================================== When performing classification you often want to predict not only the class label, but also the associated probability. This probability gives you some kind of confidence on the prediction. However,...
bsd-3-clause
abhishekraok/LayeredNeuralNetwork
layeredneuralnetwork/layered_neural_network.py
1
5785
import numpy as np from layeredneuralnetwork import node_manager from layeredneuralnetwork import node from sklearn import svm, metrics from layeredneuralnetwork import transform_function from layeredneuralnetwork.classifier_interface import ClassifierInterface from layeredneuralnetwork import utilities retrain_thresh...
mit
CJ-Jewell/ThinkStats2
code/hypothesis.py
75
10162
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function, division import nsfg import nsfg2 import first import thinkstats2 import thinkplot ...
gpl-3.0
njcuk9999/neil_superwasp_periodogram
fastDFT.py
1
19103
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 08/03/17 at 12:41 PM @author: neil Program description here Version 0.0.0 """ import numpy as np from astropy.io import fits from numexpr import evaluate as ne # ============================================================================= # Define vari...
mit
satriaphd/bgc-learn
core/utils.py
1
8964
import sys import os import subprocess import json import straight.plugin from tempfile import TemporaryFile from os import path from core import log import warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") from Bio import SearchIO try: from cStringIO import StringIO except ImportErro...
gpl-3.0
qiime2/q2-types
q2_types/feature_data/_transformer.py
1
20226
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2021, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
bsd-3-clause
ntamas/yard
yard/curve.py
1
32746
""" Curve classes used in YARD. This package contains implementations for all the curves YARD can plot. At the time of writing, this includes: - ROC curves (`ROCCurve`) - CROC curves (`CROCCurve`) - Precision-recall curves (`PrecisionRecallCurve`) - Sensitivity-specificity plots (`SensitivitySpecifici...
mit
FreeSchoolHackers/data_hacking
dga_detection/dga_model_gen.py
6
13951
''' Build models to detect Algorithmically Generated Domain Names (DGA). We're trying to classify domains as being 'legit' or having a high probability of being generated by a DGA (Dynamic Generation Algorithm). We have 'legit' in quotes as we're using the domains in Alexa as the 'legit' set. ''' import o...
mit
VipinRathor/zeppelin
spark/interpreter/src/main/resources/python/zeppelin_pyspark.py
5
2768
# # 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
hmendozap/auto-sklearn
test/test_pipeline/components/feature_preprocessing/test_nystroem_sampler.py
1
4484
import unittest import numpy as np import sklearn.preprocessing from autosklearn.pipeline.components.feature_preprocessing.nystroem_sampler import \ Nystroem from autosklearn.pipeline.util import _test_preprocessing, get_dataset class NystroemComponentTest(unittest.TestCase): def test_default_configuration(...
bsd-3-clause
akionakamura/scikit-learn
examples/svm/plot_custom_kernel.py
115
1546
""" ====================== SVM with custom kernel ====================== Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface and the support vectors. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets # import some data...
bsd-3-clause
Solid-Mechanics/matplotlib-4-abaqus
matplotlib/animation.py
4
41616
# TODO: # * Loop Delay is broken on GTKAgg. This is because source_remove() is not # working as we want. PyGTK bug? # * Documentation -- this will need a new section of the User's Guide. # Both for Animations and just timers. # - Also need to update http://www.scipy.org/Cookbook/Matplotlib/Animations # * Blit ...
mit
glouppe/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
157
2409
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
SunPower/Carousel
examples/PVPower/pvpower/formulas/irradiance.py
1
3682
# -*- coding: utf-8 -*- """ This module contains formulas for calculating PV power. """ import pvlib import pandas as pd def f_linketurbidity(times, latitude, longitude): times = pd.DatetimeIndex(times) # latitude and longitude must be scalar or else linke turbidity lookup fails latitude, longitude = la...
bsd-3-clause
ville-k/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimators_test.py
23
5276
# 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...
apache-2.0
ZENGXH/scikit-learn
examples/decomposition/plot_sparse_coding.py
247
3846
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
jakobj/nest-simulator
pynest/examples/one_neuron.py
14
3680
# -*- coding: utf-8 -*- # # one_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, or ...
gpl-2.0
LiuVII/Self-driving-RC-car
script_multi.py
1
5002
import os, time import argparse import re import pandas as pd from datetime import datetime import shutil import csv from collections import deque def check_parameters(): if not os.path.exists(data_set_dir+args.record_set+"_log.csv"): print "Corresponding log.csv file for %s does not exists" % \ ...
mit
moutai/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
67
9084
import numpy as np from sklearn.utils import check_array from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklea...
bsd-3-clause
ClockworkOrigins/m2etis
configurator/quicktest/Reporting.py
1
4530
__author__ = 'amw' import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from configurator.persistence.PersistenceManager import PersistenceManager import configurator.util.util as util from scipy.interpolate import griddata from configurator.util.util import sanitize_results impor...
apache-2.0
yl565/statsmodels
statsmodels/datasets/nile/data.py
5
1907
"""Nile River Flows.""" __docformat__ = 'restructuredtext' COPYRIGHT = """This is public domain.""" TITLE = """Nile River flows at Ashwan 1871-1970""" SOURCE = """ This data is first analyzed in: Cobb, G. W. 1978. "The Problem of the Nile: Conditional Solution to a Changepoint Problem." *Bio...
bsd-3-clause
bsipocz/astropy
astropy/visualization/wcsaxes/tests/test_wcsapi.py
1
6661
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np import matplotlib.pyplot as plt from matplotlib.transforms import Affine2D, IdentityTransform from astropy import units as u from astropy.wcs.wcsapi import BaseLowLevelWCS from astropy.coordinates import SkyCoord from as...
bsd-3-clause
DEK11/Predicting-EOB-delay
withoutpayer.py
1
2272
import pandas as pd import numpy as np train = pd.read_csv('train.csv', header=0) test = pd.read_csv('test.csv', header=0) delcol = ['claim_file_arrival_year','claim_file_arrival_month','bill_print_year','bill_print_month','claim_min_service_year','claim_max_service_year','claim_frequency_type_code','claim_min_servic...
apache-2.0
blab/nextstrain-db
analysis/HIxFRA_plot.py
2
2607
import matplotlib.pyplot as plt import seaborn as sns; sns.set(color_codes=True) import numpy as np import math import argparse parser = argparse.ArgumentParser() parser.add_argument('--infile', default=None, type=str, help="file to graph") parser.add_argument('--rtype', default="linear", type=str, help="type of regr...
agpl-3.0
mehdidc/scikit-learn
doc/sphinxext/numpy_ext/docscrape_sphinx.py
408
8061
import re import inspect import textwrap import pydoc from .docscrape import NumpyDocString from .docscrape import FunctionDoc from .docscrape import ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config=None): config = {} if config is None else config self.use_plots...
bsd-3-clause
alekz112/statsmodels
statsmodels/examples/ex_misc_tarma.py
34
1875
# -*- coding: utf-8 -*- """ Created on Wed Jul 03 23:01:44 2013 Author: Josef Perktold """ from __future__ import print_function import numpy as np from statsmodels.tsa.arima_process import arma_generate_sample, ArmaProcess from statsmodels.miscmodels.tmodel import TArma from statsmodels.tsa.arima_model import ARMA...
bsd-3-clause
phdowling/scikit-learn
sklearn/utils/tests/test_random.py
230
7344
from __future__ import division import numpy as np import scipy.sparse as sp from scipy.misc import comb as combinations from numpy.testing import assert_array_almost_equal from sklearn.utils.random import sample_without_replacement from sklearn.utils.random import random_choice_csc from sklearn.utils.testing import ...
bsd-3-clause
huard/scipy-work
scipy/io/examples/read_array_demo1.py
2
1440
#========================================================================= # NAME: read_array_demo1 # # DESCRIPTION: Examples to read 2 columns from a multicolumn ascii text # file, skipping the first line of header. First example reads into # 2 separate arrays. Second example reads into a single array. Data are # then...
bsd-3-clause
mayblue9/scikit-learn
sklearn/decomposition/nmf.py
35
39369
""" Non-negative matrix factorization """ # Author: Vlad Niculae # Lars Buitinck <L.J.Buitinck@uva.nl> # Mathieu Blondel <mathieu@mblondel.org> # Tom Dupre la Tour # Author: Chih-Jen Lin, National Taiwan University (original projected gradient # ...
bsd-3-clause
ekansa/open-context-py
opencontext_py/apps/imports/kobotoolbox/dbupdate.py
1
48497
import copy import csv import uuid as GenUUID import os, sys, shutil import codecs import numpy as np import pandas as pd from django.db import models from django.db.models import Q from django.conf import settings from opencontext_py.apps.ocitems.manifest.models import Manifest from opencontext_py.apps.ocitems.assert...
gpl-3.0
Mecanon/morphing_wing
dynamic_model/results/flexinol_SMA/config_A/max_deflection/power_usage_2.py
3
11206
# -*- coding: utf-8 -*- """ Analyze the heating, current and power usage of teh actuation Created on Thu Apr 28 09:56:23 2016 @author: Pedro Leal """ import math import numpy as np import pickle import matplotlib.pyplot as plt #Time step delta_t = 0.005 sigma_o = 100e6 r = 0.000381/2. d = 2*r alpha = 0. #...
mit
leggitta/mne-python
examples/connectivity/plot_mne_inverse_connectivity_spectrum.py
18
3465
""" ============================================================== Compute full spectrum source space connectivity between labels ============================================================== The connectivity is computed between 4 labels across the spectrum between 5 and 40 Hz. """ # Authors: Alexandre Gramfort <alex...
bsd-3-clause
Lawrence-Liu/scikit-learn
sklearn/datasets/tests/test_samples_generator.py
181
15664
from __future__ import division from collections import defaultdict from functools import partial import numpy as np import scipy.sparse as sp from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing imp...
bsd-3-clause
grundgruen/zipline
zipline/protocol.py
1
17544
# # 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
davidgardenier/frbpoppy
frbpoppy/misc.py
1
4119
"""Convenience functions.""" import inspect import sys import numpy as np from scipy.integrate import quad from scipy.stats import chi2, norm def pprint(*s, output=True): """Hack to make for more informative print statements.""" f = inspect.stack()[1][1].split('/')[-1] m = '{:13.13} |'.format(f) if o...
mit
emon10005/sympy
sympy/physics/quantum/state.py
58
29186
"""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
SaikWolf/gnuradio
gr-filter/examples/synth_to_chan.py
18
3875
#!/usr/bin/env python # # Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your ...
gpl-3.0
gfyoung/pandas
pandas/tests/strings/test_string_array.py
1
3130
import numpy as np import pytest from pandas._libs import lib import pandas as pd from pandas import DataFrame, Series, _testing as tm def test_string_array(any_string_method): method_name, args, kwargs = any_string_method if method_name == "decode": pytest.skip("decode requires bytes.") data =...
bsd-3-clause
djgagne/scikit-learn
sklearn/decomposition/tests/test_kernel_pca.py
155
8058
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import (assert_array_almost_equal, assert_less, assert_equal, assert_not_equal, assert_raises) from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets import mak...
bsd-3-clause
amolkahat/pandas
pandas/tests/extension/base/reduce.py
2
1908
import warnings import pytest import pandas.util.testing as tm import pandas as pd from .base import BaseExtensionTests class BaseReduceTests(BaseExtensionTests): """ Reduction specific tests. Generally these only make sense for numeric/boolean operations. """ def check_reduce(self, s, op_name, sk...
bsd-3-clause
PG-TUe/tpot
tpot/config/classifier.py
1
6159
# -*- 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
Nyker510/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
Atzingen/controleForno-interface
imagens/bind.py
1
1237
# -*- coding: latin-1 -*- import numpy as np import cv2 from matplotlib import pyplot as plt perfil = cv2.imread('temperatura.jpg') forno = cv2.imread('forno-pre.jpg') col_perfil, lin_perfil, _ = perfil.shape col_forno, lin_forno, _ = forno.shape print 'perfil antes:', lin_perfil, col_perfil, 'forno:', lin_forno, col...
mit
RichHelle/data-science-from-scratch
scratch/visualization.py
3
4696
from matplotlib import pyplot as 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='green', marker='o', linestyle='solid') # add a title plt.title("Nominal GDP") # add...
unlicense
Winand/pandas
pandas/tests/io/parser/na_values.py
6
10530
# -*- coding: utf-8 -*- """ Tests that NA values are properly handled during parsing for all of the parsers defined in parsers.py """ import numpy as np from numpy import nan import pandas.io.common as com import pandas.util.testing as tm from pandas import DataFrame, Index, MultiIndex from pandas.compat import Str...
bsd-3-clause
hvasbath/beat
beat/heart.py
1
115730
""" Core module with functions to calculate Greens Functions and synthetics. Also contains main classes for setup specific parameters. """ import os import logging import shutil import copy from time import time from collections import OrderedDict from beat import psgrn, pscmp, utility, qseis2d from theano import co...
gpl-3.0
arabenjamin/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
348
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
beiko-lab/gengis
bin/Lib/site-packages/mpl_toolkits/axes_grid1/axes_divider.py
4
29599
""" The axes_divider module provide helper classes to adjust the positions of multiple axes at the drawing time. Divider: this is the class that is used calculates the axes position. It divides the given rectangular area into several sub rectangles. You initialize the divider by setting the horizontal and...
gpl-3.0
mantidproject/mantid
qt/python/mantidqt/widgets/samplelogs/test/test_samplelogs_presenter.py
3
4246
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # T...
gpl-3.0
cuemacro/chartpy
chartpy/chartconstants.py
1
11701
__author__ = 'saeedamen' # Saeed Amen # # Copyright 2016 Cuemacro # # 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 l...
apache-2.0
pearpai/TensorFlow-action
action/demo5/captcha_image.py
1
1686
# coding=utf-8 from captcha.image import ImageCaptcha # pip install captcha import numpy as np import matplotlib.pyplot as plt from PIL import Image import random # 验证码中的字符, 就不用汉字了 number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] # alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'...
apache-2.0
carrillo/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
zuku1985/scikit-learn
examples/cluster/plot_cluster_comparison.py
58
4681
""" ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example aims at showing characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. The last ...
bsd-3-clause
robcarver17/pysystemtrade
systems/rawdata.py
1
11935
from copy import copy import pandas as pd from systems.stage import SystemStage from syscore.objects import resolve_function from systems.system_cache import input, diagnostic, output from sysdata.sim.futures_sim_data import futuresSimData from sysdata.config.configdata import Config class RawData(SystemStage): ...
gpl-3.0
danielballan/vistools
vistools/qt_widgets.py
1
3165
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import PySide.QtCore as QtCore import PySide.QtGui as QtGui from . import images from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas # noqa from matplotlib.backends.b...
bsd-3-clause
sao-eht/lmtscripts
2017/loc.py
1
9254
# 1mm localization and total power in dreampy # 2015, 2016 LLB import numpy import matplotlib import shutil # matplotlib.use('agg') from matplotlib import pylab, mlab, pyplot import os np = numpy plt = pyplot # plt.ion() from argparse import Namespace from glob import glob import scipy.io from scipy.signal import butt...
mit
dvida/UnknownPleasuresGenerator
UnknownPleasuresGenerator.py
1
3075
import matplotlib.pyplot as plt import numpy as np # Number of curves to plot curves_no = 80 # Curve vertical spacing curve_v_space = 3 # Maximum munber of peaks in the center max_peaks = 9 # Maximum parabolic peak amplitude max_parab_peak_amplitude = 0.05 # Maximum pointy peak amplitude max_point_peak_amplitude = 0...
gpl-2.0
rosswhitfield/mantid
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSBeamCentreFinder.py
3
19739
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # py...
gpl-3.0
francisleunggie/openface
demos/sphere.py
7
8951
#!/usr/bin/env python2 # projectS and projectC were written by Gabriele Farina. import time start = time.time() import argparse import cv2 import os import dlib import numpy as np np.set_printoptions(precision=2) import openface from matplotlib import cm fileDir = os.path.dirname(os.path.realpath(__file__)) model...
apache-2.0
gotomypc/scikit-learn
examples/decomposition/plot_sparse_coding.py
247
3846
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
syl20bnr/nupic
examples/opf/tools/testDiagnostics.py
11
1762
import numpy as np ############################################################################ def printMatrix(inputs, spOutput): ''' (i,j)th cell of the diff matrix will have the number of inputs for which the input and output pattern differ by i bits and the cells activated differ at j places. Parameters: -...
gpl-3.0
timtammittee/thorns
thorns/util/dumpdb.py
1
3516
#!/usr/bin/env python # -*- coding: utf-8 -*- """This module implements permanent store for data. """ from __future__ import division, print_function, absolute_import from __future__ import unicode_literals __author__ = "Marek Rudnicki" import os import datetime import logging from itertools import izip_longest imp...
gpl-3.0
ajc158/beeworld
gigerommatidiamodelbeeworld.py
1
4121
import matplotlib.pyplot as plt import math import numpy from mpl_toolkits.mplot3d import Axes3D def vert(x): return (0.000734*(x**2))-(0.1042253*x)+4.9 def horr(x): if x>60: return (0.00037*(x**2))-(0.04462*x)+3.438 else: return (0.00069*(x**2))-(0.08333*x)+4.6 def radialDistortion(x,y): camYaw=0.0/180.0*...
gpl-3.0
bitmonk/pgcli
pgcli/packages/tabulate.py
28
38075
# -*- coding: utf-8 -*- """Pretty-print tabular data.""" from __future__ import print_function from __future__ import unicode_literals from collections import namedtuple from decimal import Decimal from platform import python_version_tuple from wcwidth import wcswidth import re if python_version_tuple()[0] < "3": ...
bsd-3-clause
SeldonIO/seldon-server
docker/examples/tensorflow_deep_mnist/create_pipeline.py
2
3690
from tensorflow.examples.tutorials.mnist import input_data #mnist = input_data.read_data_sets("MNIST_data/", one_hot = True) import tensorflow as tf from seldon.tensorflow_wrapper import TensorFlowWrapper from sklearn.pipeline import Pipeline import seldon.pipeline.util as sutl import argparse def weight_variable(shap...
apache-2.0