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 |
|---|---|---|---|---|---|
ikassi/menpo | menpo/visualize/viewmatplotlib.py | 3 | 17952 | import abc
import numpy as np
from menpo.visualize.base import Renderer
class MatplotlibRenderer(Renderer):
r"""
Abstract class for rendering visualizations using Matplotlib.
Parameters
----------
figure_id : int or ``None``
A figure id or ``None``. ``None`` assumes we maintain the Matp... | bsd-3-clause |
cragwen/hello-world | py/snippet-master/100w/100w.py | 1 | 2659 |
# coding: utf-8
# In[1]:
import matplotlib
import matplotlib.pyplot as plt
import datetime
x_data = []
y_data = []
with open('crossin-data.txt') as f:
for line in f:
k, v = line.split()
x_data.append(datetime.datetime.strptime(k,'%m/%d/%y'))
y_data.append(v)
plt.figure(figsize=(10, 6.18... | unlicense |
sankar-mukherjee/CoFee | scikit_algo/GradientBoostingClassifier.py | 1 | 2138 | """
Created on Tue Feb 24 16:08:39 2015
@author: mukherjee
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import preprocessing, metrics, cross_validation
from sklearn.ensemble import GradientBoostingClassifier
# read Form data
DATA_FORM_FILE = 'all-merged-cat.csv'
... | apache-2.0 |
schrummy14/LIGGGHTS_Flexible_Fibers | examples/BondPackage/Tutorials/python/cantilever_beam_bay_opt/bayOpt/bayOpt.py | 1 | 10950 | """ gp.py
Bayesian optimisation of loss functions.
"""
import numpy as np
import sklearn.gaussian_process as gp
import pyDOE2
from scipy.stats import norm
from scipy.optimize import minimize
def expected_improvement(x, gaussian_process, evaluated_loss, greater_is_better=False, n_params=1):
""" expect... | gpl-2.0 |
gef756/statsmodels | statsmodels/tsa/statespace/structural.py | 2 | 69937 | """
Univariate structural time series models
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
from warnings import warn
from statsmodels.compat.collections import OrderedDict
import numpy as np
import pandas as pd
from statsmodels.tsa.filters.hp_filter ... | bsd-3-clause |
peterjc/pyani | pyani/anib.py | 1 | 21116 | # Copyright 2013-2015, The James Hutton Insitute
# Author: Leighton Pritchard
#
# This code is part of the pyani package, and is governed by its licence.
# Please see the LICENSE file that should have been included as part of
# this package.
"""Code to implement the ANIb average nucleotide identity method.
Calculates... | mit |
WangWenjun559/Weiss | summary/sumy/sklearn/grid_search.py | 1 | 34641 | """
The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters
of an estimator.
"""
from __future__ import print_function
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# ... | apache-2.0 |
BigDataRepublic/bdr-analytics-py | bdranalytics/pdlearn/tests/test_pipeline.py | 1 | 4821 | import numpy as np
import pandas as pd
import unittest
from sklearn.pipeline import FeatureUnion, Pipeline
from bdranalytics.pdlearn.pipeline import PdFeatureUnion, PdFeatureChain
from bdranalytics.pdlearn.preprocessing import PdLagTransformer, PdWindowTransformer
class TestLagTransformer(unittest.TestCase):
def... | apache-2.0 |
shangwuhencc/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 |
UWPCE-PythonCert/IntroPython2016 | students/crobison/final_project/tweeter_connector.py | 4 | 2407 | #!/usr/bin/env python3
# Charles Robison
# Term project
import twitter
import json
import pandas as pd
import config
CONSUMER_KEY = config.CONSUMER_KEY
CONSUMER_SECRET = config.CONSUMER_SECRET
OAUTH_TOKEN = config.OAUTH_TOKEN
OAUTH_TOKEN_SECRET = config.OAUTH_TOKEN_SECRET
auth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUT... | unlicense |
niamoto/niamoto-core | niamoto/api/data_provider_api.py | 2 | 4702 | # coding: utf-8
"""
API Module for managing data providers.
"""
from sqlalchemy import *
import pandas as pd
from niamoto.db.connector import Connector
from niamoto.db.metadata import data_provider, \
synonym_key_registry
from niamoto.db.utils import fix_db_sequences
from niamoto.data_providers.base_data_provide... | gpl-3.0 |
bsipocz/glue | glue/clients/profile_viewer.py | 1 | 13763 | import numpy as np
from matplotlib.transforms import blended_transform_factory
from ..core.callback_property import CallbackProperty, add_callback
PICK_THRESH = 30 # pixel distance threshold for picking
class Grip(object):
def __init__(self, viewer, artist=True):
self.viewer = viewer
self.ena... | bsd-3-clause |
UMN-Hydro/GSFLOW_pre-processor | python_scripts/Plot_MODFLOW_3D_uzf.py | 1 | 11083 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 27 23:36:53 2017
@author: gcng
"""
import sys
import platform
import struct
import numpy as np
from matplotlib import pyplot as plt
from readSettings import Settings
import matplotlib.animation as manimation
# Set input file
if len(sys.argv) < 2:
settings_input_file ... | gpl-3.0 |
FedericoFontana/backtester | tests/test_portfolio_check_inputs.py | 1 | 9299 | import pytest
import numpy as np
import pandas as pd
from pandas import date_range as t
from datetime import datetime as day
from backtester.portfolio import Portfolio
def test_weights_type_reject_when_wrong():
prices = pd.DataFrame([[1, 2],
[2, 4]],
index=t('2... | gpl-3.0 |
muxiaobai/CourseExercises | python/kaggle/competition/titannic/titanic.py | 1 | 4661 |
# coding: utf-8
# In[80]:
#https://github.com/HanXiaoyang/Kaggle_Titanic/blob/master/Titanic.ipynb
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# In[81]:
data_train = pd.read_csv("train.csv")
print (data_train.describe())
# In[82]:
from sklearn.ensemble impor... | gpl-2.0 |
esatel/ADCPy | adcpy/adcpy_plot.py | 1 | 27568 | # -*- coding: utf-8 -*-
"""Tools for visualizing ADCP data that is read and processed by the adcpy module
This module is imported under the main adcpy, and should be available as
adcpy.plot. Some methods can be used to visualize flat arrays, independent of
adcpy, and the plots may be created quickly using the IPanel a... | mit |
mwv/scikit-learn | sklearn/cluster/tests/test_birch.py | 342 | 5603 | """
Tests for the birch clustering algorithm.
"""
from scipy import sparse
import numpy as np
from sklearn.cluster.tests.common import generate_clustered_data
from sklearn.cluster.birch import Birch
from sklearn.cluster.hierarchical import AgglomerativeClustering
from sklearn.datasets import make_blobs
from sklearn.l... | bsd-3-clause |
ryfeus/lambda-packs | LightGBM_sklearn_scipy_numpy/source/sklearn/utils/tests/test_testing.py | 6 | 14035 | import warnings
import unittest
import sys
import numpy as np
from scipy import sparse
from sklearn.utils.deprecation import deprecated
from sklearn.utils.metaestimators import if_delegate_has_method
from sklearn.utils.testing import (
assert_true,
assert_raises,
assert_less,
assert_greater,
assert... | mit |
dstndstn/unwise-coadds | fix-background.py | 1 | 4045 | import matplotlib
matplotlib.use('Agg')
import pylab as plt
import numpy as np
import sys
import fitsio
from scipy.ndimage.filters import gaussian_filter
from astrometry.util.plotutils import *
from astrometry.util.util import *
from astrometry.util.resample import *
from unwise_coadd import estimate_sky_2
def mai... | gpl-2.0 |
kou/arrow | dev/archery/archery/lang/python.py | 3 | 7778 | # 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 |
mayblue9/scikit-learn | sklearn/ensemble/tests/test_forest.py | 11 | 39141 | """
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 combinations
from itertools import product
import numpy ... | bsd-3-clause |
walterreade/scikit-learn | examples/feature_selection/plot_select_from_model_boston.py | 146 | 1527 | """
===================================================
Feature selection using SelectFromModel and LassoCV
===================================================
Use SelectFromModel meta-transformer along with Lasso to select the best
couple of features from the Boston dataset.
"""
# Author: Manoj Kumar <mks542@nyu.edu>... | bsd-3-clause |
georgid/SourceFilterContoursMelody | smstools/software/transformations_interface/sineTransformations_function.py | 25 | 5018 | # function call to the transformation functions of relevance for the sineModel
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import get_window
import sys, os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/'))
sys.path.append(os.path.join(os.path.dirname(os.p... | gpl-3.0 |
arahuja/scikit-learn | sklearn/cluster/tests/test_birch.py | 342 | 5603 | """
Tests for the birch clustering algorithm.
"""
from scipy import sparse
import numpy as np
from sklearn.cluster.tests.common import generate_clustered_data
from sklearn.cluster.birch import Birch
from sklearn.cluster.hierarchical import AgglomerativeClustering
from sklearn.datasets import make_blobs
from sklearn.l... | bsd-3-clause |
IndraVikas/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 142 | 4761 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
binghongcha08/pyQMD | GWP/2D/1.1.2/resample/c.py | 28 | 1767 | ##!/usr/bin/python
import numpy as np
import pylab as plt
import seaborn as sns
sns.set_context('poster')
#with open("traj.dat") as f:
# data = f.read()
#
# data = data.split('\n')
#
# x = [row.split(' ')[0] for row in data]
# y = [row.split(' ')[1] for row in data]
#
# fig = plt.figure()
#
# ax1 ... | gpl-3.0 |
wanderknight/tushare | tushare/stock/billboard.py | 13 | 11969 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
龙虎榜数据
Created on 2015年6月10日
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
import pandas as pd
from pandas.compat import StringIO
from tushare.stock import cons as ct
import numpy as np
import time
import re
import lxml.html
from lxml import etree
fr... | bsd-3-clause |
ktsaou/netdata | collectors/python.d.plugin/zscores/zscores.chart.py | 1 | 6110 | # -*- coding: utf-8 -*-
# Description: zscores netdata python.d module
# Author: andrewm4894
# SPDX-License-Identifier: GPL-3.0-or-later
from datetime import datetime
import re
import requests
import numpy as np
import pandas as pd
from bases.FrameworkServices.SimpleService import SimpleService
from netdata_pandas.d... | gpl-3.0 |
marcocaccin/scikit-learn | examples/linear_model/plot_sgd_separating_hyperplane.py | 84 | 1221 | """
=========================================
SGD: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a linear Support Vector Machines classifier
trained using SGD.
"""
print(__doc__)
import numpy as n... | bsd-3-clause |
jpautom/scikit-learn | examples/datasets/plot_random_multilabel_dataset.py | 278 | 3402 | """
==============================================
Plot randomly generated multilabel dataset
==============================================
This illustrates the `datasets.make_multilabel_classification` dataset
generator. Each sample consists of counts of two features (up to 50 in
total), which are differently distri... | bsd-3-clause |
juhi24/baecc | scripts/scr_tartu_tmatrix.py | 1 | 3890 | # -*- coding: utf-8 -*-
"""
@author: Jussi Tiira
"""
import pyart
import read
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from os import path
from pytmatrix import tmatrix, radar
from pytmatrix import refractive as ref
from pytmatrix import orientation as ori
from pytmatrix import tmatrix_au... | gpl-3.0 |
jaumebonet/libconfig | sphinx-docs/source/conf.py | 1 | 6368 | # -*- coding: utf-8 -*-
#
# libconfig documentation build configuration file, created by
# sphinx-quickstart on Thu Jan 18 11:39:05 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | mit |
alberto-antonietti/nest-simulator | pynest/examples/hh_phaseplane.py | 12 | 5096 | # -*- coding: utf-8 -*-
#
# hh_phaseplane.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 |
deepesch/scikit-learn | examples/mixture/plot_gmm_sin.py | 248 | 2747 | """
=================================
Gaussian Mixture Model Sine Curve
=================================
This example highlights the advantages of the Dirichlet Process:
complexity control and dealing with sparse data. The dataset is formed
by 100 points loosely spaced following a noisy sine curve. The fit by
the GMM... | bsd-3-clause |
nico-ralf-ii-fpuna/paper | waf/test_2_waf_speed/source.py | 1 | 4965 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Nico Epp and Ralf Funk
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pandas as pd
import pickle
import requests
... | mpl-2.0 |
factornado/factornado | examples/registry.py | 1 | 6292 | # -*- coding: utf-8 -*-
"""
Factornado registry example
---------------------------
You can run this example in typing:
>>> python registry.py &
[1] 15539
Then you can test it with:
>>> curl http://localhost:8800/hello
To end up the process, you can use:
>>> kill -SIGTERM -$(ps aux | grep 'python registry.py' | a... | mit |
pabryan/smc | src/scripts/test_install.py | 6 | 2775 | #!/usr/bin/env python
###############################################################################
#
# SageMathCloud: A collaborative web-based interface to Sage, IPython, LaTeX and the Terminal.
#
# Copyright (C) 2014, William Stein
#
# This program is free software: you can redistribute it and/or modify
# ... | gpl-3.0 |
rnder/data-science-from-scratch | code-python3/gradient_descent.py | 12 | 5816 | from collections import Counter
from linear_algebra import distance, vector_subtract, scalar_multiply
from functools import reduce
import math, random
def sum_of_squares(v):
"""computes the sum of squared elements in v"""
return sum(v_i ** 2 for v_i in v)
def difference_quotient(f, x, h):
return (f(x + h)... | unlicense |
zuku1985/scikit-learn | examples/model_selection/plot_train_error_vs_test_error.py | 349 | 2577 | """
=========================
Train error vs Test error
=========================
Illustration of how the performance of an estimator on unseen data (test data)
is not the same as the performance on training data. As the regularization
increases the performance on train decreases while the performance on test
is optim... | bsd-3-clause |
rhyolight/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/pyplot.py | 69 | 77521 | import sys
import matplotlib
from matplotlib import _pylab_helpers, interactive
from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike
from matplotlib.figure import Figure, figaspect
from matplotlib.backend_bases import FigureCanvasBase
from matplotlib.image import imread as _imread
from matplotl... | agpl-3.0 |
Ledoux/ShareYourSystem | Pythonlogy/ShareYourSystem/Standards/Recorders/Brianer/draft/05_ExampleDoc.py | 2 | 2975 | #ImportModules
import ShareYourSystem as SYS
import operator
#Definition
MyBrianer=SYS.BrianerClass(
).produce(
"Neurongroupers",
['E','I'],
SYS.NeurongrouperClass,
#Here are defined the brian classic shared arguments for each pop
{
'NeurongroupingKwargVariablesDict':
{
'model':
'''
dv/dt... | mit |
NicholasBermuda/transit | demo.py | 1 | 1285 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import time
import numpy as np
import matplotlib.pyplot as pl
from kplr import EXPOSURE_TIMES
import transit
texp = EXPOSURE_TIMES[1] / 86400.0
s = transit.System(transit.Central())
body = transit.Body(r=0.02, mass=0.0, ... | mit |
SalemAmeen/bayespy | bayespy/inference/vmp/nodes/node.py | 2 | 45306 | ################################################################################
# Copyright (C) 2013-2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
import numpy as np
import matplotlib.pyplot as plt
from bayespy.... | mit |
chriscrosscutler/scikit-image | doc/examples/plot_orb.py | 33 | 1807 | """
==========================================
ORB feature detector and binary descriptor
==========================================
This example demonstrates the ORB feature detection and binary description
algorithm. It uses an oriented FAST detection method and the rotated BRIEF
descriptors.
Unlike BRIEF, ORB is c... | bsd-3-clause |
cademarkegard/airflow | airflow/hooks/dbapi_hook.py | 2 | 8951 | # -*- 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 |
jameswells1982/redpandabot | redpandabot.py | 1 | 2620 | """"
Red Panda Scanning Bot
A Project by /u/NEWSBOT3 to find mentions of Red Pandas on reddit easily
see https://github.com/jameswells1982/redpandabot
"""
import time
import praw
import ConfigParser
import logging
import pprint
import ast
logging.basicConfig(filename='/var/log/redpandabot.log', format='%(asctime)s ... | gpl-2.0 |
dblalock/flock | python/datasets/utils.py | 2 | 28325 | #!/usr/bin/env/python
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from matplotlib.patches import Rectangle
DEFAULT_LABEL = 0
from synthetic import concatWithPadding, ensure2D
from ..utils.sequence import splitElementsBy, splitIdxsBy
# ==============================... | mit |
nhejazi/scikit-learn | examples/mixture/plot_concentration_prior.py | 21 | 5695 | """
========================================================================
Concentration Prior Type Analysis of Variation Bayesian Gaussian Mixture
========================================================================
This example plots the ellipsoids obtained from a toy dataset (mixture of three
Gaussians) fitte... | bsd-3-clause |
wanggang3333/scikit-learn | examples/bicluster/bicluster_newsgroups.py | 162 | 7103 | """
================================================================
Biclustering documents with the Spectral Co-clustering algorithm
================================================================
This example demonstrates the Spectral Co-clustering algorithm on the
twenty newsgroups dataset. The 'comp.os.ms-windows... | bsd-3-clause |
appapantula/scikit-learn | doc/tutorial/text_analytics/skeletons/exercise_01_language_train_model.py | 254 | 2005 | """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 |
tebeka/pythonwise | multi_col.py | 1 | 1963 | """Timeiming mulitple column query in Pandas DataFrame"""
from timeit import timeit
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import string
np.random.seed(17) # Repeatable results
def rand_letters(size):
return np.random.choice(list(string.ascii_lowercase), size)
def new_df(size):... | bsd-3-clause |
coli-saar/BayesianNLP2017 | Dirichlet_PDF.py | 1 | 1951 | """
This code is based on code found at: https://commons.wikimedia.org/wiki/File:Beta_distribution_pdf.svg by user Horas based on the work of user Krishnavedala
"""
from matplotlib.pyplot import *
from numpy import linspace
from scipy.stats import beta
x = linspace(0,1,75)
fig = figure()
ax = fig.add_subplot(111)
ax... | mit |
timothydmorton/bokeh | examples/plotting/file/glucose.py | 18 | 1552 | import pandas as pd
from bokeh.sampledata.glucose import data
from bokeh.plotting import figure, show, output_file, vplot
output_file("glucose.html", title="glucose.py example")
TOOLS = "pan,wheel_zoom,box_zoom,reset,save"
p1 = figure(x_axis_type="datetime", tools=TOOLS)
p1.line(data.index, data['glucose'], color=... | bsd-3-clause |
AIML/scikit-learn | benchmarks/bench_mnist.py | 154 | 6006 | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | bsd-3-clause |
PYPIT/PYPIT | pypeit/core/pca.py | 1 | 24970 | """ Module for PCA code"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import inspect
import numpy as np
from matplotlib import pyplot as plt
from pypeit import msgs
from pypeit import utils
from pypeit.core import qa
from pypeit import debugger
def func_vander(x, func, de... | gpl-3.0 |
CallaJun/hackprince | indico/matplotlib/backends/backend_wx.py | 10 | 65412 | """
A wxPython backend for matplotlib, based (very heavily) on
backend_template.py and backend_gtk.py
Author: Jeremy O'Donoghue (jeremy@o-donoghue.com)
Derived from original copyright work by John Hunter
(jdhunter@ace.bsd.uchicago.edu)
Copyright (C) Jeremy O'Donoghue & John Hunter, 2003-4
License: This work ... | lgpl-3.0 |
libornovax/master_thesis_code | caffe/python/detect.py | 36 | 5734 | #!/usr/bin/env python
"""
detector.py is an out-of-the-box windowed detector
callable from the command line.
By default it configures and runs the Caffe reference ImageNet model.
Note that this model was trained for image classification and not detection,
and finetuning for detection can be expected to improve results... | mit |
tdhopper/scikit-learn | sklearn/metrics/cluster/tests/test_supervised.py | 206 | 7643 | import numpy as np
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import homogeneity_score
from sklearn.metrics.cluster import completeness_score
from sklearn.metrics.cluster import v_measure_score
from sklearn.metrics.cluster import homogeneity_completeness_v_measure
from sklearn... | bsd-3-clause |
ephes/scikit-learn | examples/semi_supervised/plot_label_propagation_structure.py | 247 | 2432 | """
==============================================
Label Propagation learning a complex structure
==============================================
Example of LabelPropagation learning a complex internal structure
to demonstrate "manifold learning". The outer circle should be
labeled "red" and the inner circle "blue". Be... | bsd-3-clause |
eclee25/flu-SDI-exploratory-age | scripts/create_fluseverity_figs_v2/aF3_zOR_benchmark.py | 1 | 5006 | #!/usr/bin/python
##############################################
###Python template
###Author: Elizabeth Lee
###Date: 10/14/14
###Function: mean peak-based retro zOR metric vs. CDC benchmark index, mean Thanksgiving-based early zOR metric vs. CDC benchmark index. 10/14/14 OR age flip.
###Import data: /home/elee/Dropb... | mit |
gjermv/potato | sccs/gpx/geoEngineering/TunnelCreatorV2.py | 1 | 14192 | # -*- coding: UTF-8 -*-
import ezdxf
import math
import pandas as pd
from _operator import pos
import os
T_scale = 200 #skala på kartleggingskjema // Kan ikke endres
def hor_lines(start_coord, stop_coord, inc):
l = []
a = math.ceil(start_coord/inc)*inc
print('hor_lines a:',a)
... | gpl-2.0 |
cwu2011/scikit-learn | examples/tree/plot_tree_regression.py | 206 | 1476 | """
===================================================================
Decision Tree Regression
===================================================================
A 1D regression with decision tree.
The :ref:`decision trees <tree>` is
used to fit a sine curve with addition noisy observation. As a result, it
learns ... | bsd-3-clause |
billy-inn/scikit-learn | sklearn/tree/tests/test_tree.py | 57 | 47417 | """
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 |
roxyboy/bokeh | bokeh/charts/builder/tests/test_bar_builder.py | 33 | 6390 | """ This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | bsd-3-clause |
massmutual/scikit-learn | sklearn/decomposition/nmf.py | 5 | 39512 | """ 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 |
ehirvijo/fokker-planck-fenics | python/spherically_symmetric_backward_euler_stepping.py | 1 | 4366 | """
This script tests the implementation of
the spherically symmetric nonlinear
Fokker-Planck equation with a spherically
symmetric Gaussian source term. The script
can be used to investigate how the source
rate and the source width affect the evolution
of the distribution function.
"""
import matplotlib.pyplot as ... | gpl-3.0 |
ScholarTools/mendeley_python | mendeley/client_library.py | 2 | 36821 | # -*- coding: utf-8 -*-
"""
The goal of this code is to support hosting a client library. This module
should in the end function similarly to the Mendeley Desktop.
Features:
---------
1) Initializes a representation of the documents stored in a user's library
2) Synchronizes the local library with updates that have be... | mit |
rpetersburg/fiber_properties | scripts/center_accuracy.py | 2 | 4249 | from fiber_properties import FiberImage, circle_array, gaussian_array, show_image_array, plot_cross_sections
import numpy as np
import matplotlib.pyplot as plt
def testMethod(method):
tol = 1
test_range = 1
factor = 1.0
y_err = []
x_err = []
d_err = []
for i in xrange... | mit |
wavelets/zipline | tests/test_algorithm_gen.py | 5 | 7277 | #
# 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 |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tests/groupby/test_groupby.py | 4 | 150441 | # -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
from warnings import catch_warnings
from string import ascii_lowercase
from datetime import datetime
from numpy import nan
from pandas import (date_range, bdate_range, Timestamp,
Index, MultiIndex, DataFrame, Series,
... | mit |
IssamLaradji/scikit-learn | sklearn/decomposition/tests/test_nmf.py | 33 | 6189 | 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 |
franzpl/sweep | sweep_akf_kaiser_window/log_sweep_akf_window.py | 2 | 1944 | #!/usr/bin/env python3
"""AKF of windowed log. sweep.
"""
import sys
sys.path.append('..')
import plotting
import generation
import matplotlib.pyplot as plt
import windows
from scipy.signal import lfilter, fftconvolve
import numpy as np
# Parameters of the measuring system
fs = 44100
fstart = 1
fstop = 22050
d... | mit |
roxyboy/bokeh | bokeh/compat/mplexporter/exporter.py | 32 | 12403 | """
Matplotlib Exporter
===================
This submodule contains tools for crawling a matplotlib figure and exporting
relevant pieces to a renderer.
"""
import warnings
import io
from . import utils
import matplotlib
from matplotlib import transforms
from matplotlib.backends.backend_agg import FigureCanvasAgg
clas... | bsd-3-clause |
admcrae/tensorflow | tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py | 62 | 9268 | # 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 |
SiLab-Bonn/monopix_daq | monopix_daq/analysis/event_builder_inj.py | 1 | 6787 | import sys,time,os
import numpy as np
import matplotlib.pyplot as plt
from numba import njit
import tables
import yaml
TS_TLU=251
TS_INJ=252
TS_MON=253
TS_GATE=254
TLU=255
COL_SIZE=36
ROW_SIZE=129
### debug
### 1 = 1: contined to next file read 0: data is the end of file DONOT use this bit
### 2 = 1: reset inj_cnt wh... | gpl-2.0 |
mataevs/persondetector | detection/hog_svm_train.py | 2 | 2879 | from sklearn import svm
from skimage.feature import hog
import cv2
from os.path import isfile, join
from os import listdir
from sklearn.externals import joblib
def cmp(prefix):
def cmp_file_names(a, b):
a_n = int(a.replace(prefix, "").replace(".jpg", ""))
b_n = int(b.replace(prefix, "").replace(".... | mit |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/matplotlib/ticker.py | 6 | 79201 | """
Tick locating and formatting
============================
This module contains classes to support completely configurable tick
locating and formatting. Although the locators know nothing about major
or minor ticks, they are used by the Axis class to support major and
minor tick locating and formatting. Generic t... | gpl-3.0 |
pedrofeijao/RINGO | src/ringo/dcj_dupindel.py | 1 | 34925 | #!/usr/bin/env python2
import collections
import pyximport;
import re
pyximport.install()
from model import Ext, Chromosome
import argparse
import copy
import operator
import networkx as nx
from networkx.algorithms import connected_components, dfs_successors
import matplotlib.pyplot as plt
import file_ops
# HELPER ... | mit |
wzbozon/scikit-learn | sklearn/manifold/tests/test_isomap.py | 226 | 3941 | from itertools import product
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from sklearn import datasets
from sklearn import manifold
from sklearn import neighbors
from sklearn import pipeline
from sklearn import preprocessing
from sklearn.utils.testing import assert_less
... | bsd-3-clause |
glennq/scikit-learn | sklearn/feature_extraction/dict_vectorizer.py | 41 | 12562 | # Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# 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 ..ext... | bsd-3-clause |
chraibi/ptr5parser | scripts/plot_framewise.py | 1 | 1382 | # plots the trajectories framewise and produce png files
from sys import argv
import os
import glob
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
if len(argv) <= 1:
print("usage: %s <filename>"%argv[0])
exit(">>>>exit<<<<")
filename = argv[1]
print("load file %s.... | lgpl-3.0 |
fredhusser/scikit-learn | sklearn/datasets/tests/test_20news.py | 280 | 3045 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
DonBeo/scikit-learn | examples/cluster/plot_digits_linkage.py | 369 | 2959 | """
=============================================================================
Various Agglomerative Clustering on a 2D embedding of digits
=============================================================================
An illustration of various linkage option for agglomerative clustering on
a 2D embedding of the di... | bsd-3-clause |
tneumann/cmm | reproduce_fig3_convergence.py | 1 | 3666 | import sys
from collections import defaultdict, namedtuple
import numpy as np
from cmmlib.inout import load_mesh
from cmmlib import cmm
from cmmlib.vis.weights import show_weights
class Logger(object):
def __init__(self):
self.r_primals = []
self.r_duals = []
def __call__(self, *args, **kwa... | gpl-2.0 |
etkirsch/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 |
kiyoto/statsmodels | statsmodels/datasets/anes96/data.py | 3 | 4243 | """American National Election Survey 1996"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
http://www.electionstudies.org/
The American National Election Studies.
"""
DESCRSHORT = """This data is a subset of the American National Election Stud... | bsd-3-clause |
LohithBlaze/scikit-learn | examples/classification/plot_lda.py | 164 | 2224 | """
====================================================================
Normal and Shrinkage Linear Discriminant Analysis for classification
====================================================================
Shows how shrinkage improves classification.
"""
from __future__ import division
import numpy as np
import... | bsd-3-clause |
CrowdTruth/VU-Sound-Corpus | scripts/0-filtering.py | 1 | 1997 | import os
import unicodecsv
import seaborn as sns
import pandas as pd
import csv
def UnicodeDictReader(utf8_data, **kwargs):
csv_reader = csv.DictReader(utf8_data, **kwargs)
for row in csv_reader:
yield {key: unicode(value, 'utf-8') for key, value in row.iteritems()}
# filter judgments that are obviou... | apache-2.0 |
mohanprasath/Course-Work | data_analysis/uh_data_analysis_with_python/hy-data-analysis-with-python-spring-2020/part04-e02_powers_of_series/test/test_powers_of_series.py | 1 | 1814 | #!/usr/bin/env python3
import unittest
from unittest.mock import patch
import numpy as np
import pandas as pd
from tmc import points
from tmc.utils import load, get_out, patch_helper
module_name="src.powers_of_series"
powers_of_series = load(module_name, "powers_of_series")
main = load(module_name, "main")
ph = pat... | gpl-3.0 |
jor-/scipy | scipy/cluster/tests/test_hierarchy.py | 11 | 41545 | #
# Author: Damian Eads
# Date: April 17, 2008
#
# Copyright (C) 2008 Damian Eads
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this... | bsd-3-clause |
lkilcommons/atmodexplorer | atmodexplorer/atmodexplorer.py | 1 | 41802 | import sys
import os
import random
from matplotlib.backends import backend_qt4
import matplotlib.widgets as widgets
import matplotlib.axes
from PyQt4 import QtGui, QtCore, Qt
from PyQt4.QtCore import SIGNAL,SLOT,pyqtSlot,pyqtSignal
#Main imports
import numpy as np
#import pandas as pd
import sys, pdb, textwrap
import... | gpl-3.0 |
JPalmerio/GRB_population_code | grbpop/prototype_GRB_population.py | 1 | 3386 | import argparse
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import logging
import time
import sys
import pandas as pd
import physics as ph
import io_grb_pop as io
import miscellaneous as msc
from GRB_population import GRBPopulation
from cosmology import init_cosmology
from ECLAIRs import init_E... | gpl-3.0 |
louisLouL/pair_trading | capstone_env/lib/python3.6/site-packages/pandas/tests/test_resample.py | 3 | 127773 | # pylint: disable=E1101
from warnings import catch_warnings
from datetime import datetime, timedelta
from functools import partial
from textwrap import dedent
import pytest
import numpy as np
import pandas as pd
import pandas.tseries.offsets as offsets
import pandas.util.testing as tm
from pandas import (Series, Dat... | mit |
igmhub/picca | bin/picca_compute_fvoigt.py | 1 | 9312 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Computes the convolution term Fvoigt(k) and saves it in an ASCII file. The inputs are a DLA and a QSO catalog (both as fits binary tables). The DLA table must contain the columns "MOCKID" matching qso "THING_ID", and "Z_DLA_RSD". The QSO table must contain the columns "... | gpl-3.0 |
arabenjamin/scikit-learn | examples/cluster/plot_mean_shift.py | 351 | 1793 | """
=============================================
A demo of the mean-shift clustering algorithm
=============================================
Reference:
Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward
feature space analysis". IEEE Transactions on Pattern Analysis and
Machine Intelligence. 2002. ... | bsd-3-clause |
jopequ/leds-detect | leds/pair.py | 1 | 5197 | import cv2
import numpy as np
import math
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from .point import *
#
# Class Pair
#
# Stores two points, the distance, the relative ratio,
# the distance to diameter ratio
# and if they can be a pair
#
# Attributes:
# ori : first point
# ... | apache-2.0 |
lenovor/scikit-learn | examples/cluster/plot_cluster_iris.py | 350 | 2593 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
K-means Clustering
=========================================================
The plots display firstly what a K-means algorithm would yield
using three clusters. It is then shown what the effect of a bad
initializa... | bsd-3-clause |
process-asl/process-asl | procasl/externals/nistats/experimental_paradigm.py | 3 | 2517 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import with_statement
"""
An experimental protocol is handled as a pandas DataFrame
that includes an 'onset' field.
This yields the onset time of the events in the paradigm. It can also cont... | bsd-3-clause |
fyffyt/pylearn2 | pylearn2/cross_validation/dataset_iterators.py | 29 | 19389 | """
Cross-validation dataset iterators.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
import warnings
try:
from sklearn.cross_validation import (KFold, StratifiedKFold, ShuffleSplit,
... | bsd-3-clause |
robogen/CMS-Mining | RunScripts/es_hccTaskType.py | 1 | 5360 | from elasticsearch import Elasticsearch
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.dates import AutoDateLocator, AutoDateFormatter
import numpy as np
import datetime as dt
import math
import json
import pprint
with open("config", "r+") as txt:
contents = li... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.