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 |
|---|---|---|---|---|---|
griffinfoster/shapelets | scripts/plotShapelets.py | 1 | 6518 | #!/usr/bin/env python
"""
Plot a set of shapelet basis functions
"""
import sys
import numpy as np
from matplotlib import pyplot as plt
import shapelets
if __name__ == '__main__':
from optparse import OptionParser
o = OptionParser()
o.set_usage('%prog [options]')
o.set_description(__doc__)
o.add_o... | bsd-3-clause |
ual/urbansim | urbansim/tests/test_accounts.py | 5 | 2349 | import pandas as pd
import pytest
from pandas.util import testing as pdt
from .. import accounts
@pytest.fixture(scope='module')
def acc_name():
return 'test'
@pytest.fixture(scope='module')
def acc_bal():
return 1000
@pytest.fixture
def acc(acc_name, acc_bal):
return accounts.Account(acc_name, acc_b... | bsd-3-clause |
etkirsch/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 |
chengsoonong/digbeta | dchen/music/src/NSR_eval.py | 2 | 4886 | import os
import sys
import gzip
import numpy as np
import pickle as pkl
from scipy.sparse import issparse
# from sklearn.metrics.pairwise import cosine_similarity
from tools import calc_metrics, softmax # diversity
TOPs = [5, 10, 20, 30, 50, 100, 200, 300, 500, 700, 1000]
if len(sys.argv) != 4:
print('Usage:', ... | gpl-3.0 |
pelson/cartopy | lib/cartopy/examples/reprojected_wmts.py | 3 | 1980 | """
Displaying WMTS tiled map data on an arbitrary projection
---------------------------------------------------------
This example displays imagery from a web map tile service on two different
projections, one of which is not provided by the service.
This result can also be interactively panned and zoomed.
The exa... | lgpl-3.0 |
kmacinnis/sympy | sympy/external/tests/test_importtools.py | 6 | 1215 | from sympy.external import import_module
# fixes issue that arose in addressing issue 3434
def test_no_stdlib_collections():
'''
make sure we get the right collections when it is not part of a
larger list
'''
import collections
matplotlib = import_module('matplotlib',
__import__kwargs={... | bsd-3-clause |
fmetzger/videostreaming-bufferemulation | results_multi_stallingfreq.py | 1 | 4474 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 13 09:18:44 2011
@author: fm
"""
import sys
import os
import os.path
import subprocess
import string
from numpy import *
import matplotlib.pyplot as plt
import pylab
###############################################################################
# confs
algs = ["yt... | unlicense |
CKPalk/SeattleCrime_DM | DataMining/Class/KNN_Classifier.py | 1 | 1962 |
import pandas as pd
import numpy as np
import math
import zipfile
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
import sys
train_attrs = [ 'Lon', 'Lat' ]
#train_attrs = [ 'Lon', 'Lat', 'Temp', 'Rain' ]
def llfun(act, pred):
""" Logloss function for 1/0 probability """
retu... | mit |
mfjb/scikit-learn | examples/model_selection/randomized_search.py | 201 | 3214 | """
=========================================================================
Comparing randomized search and grid search for hyperparameter estimation
=========================================================================
Compare randomized search and grid search for optimizing hyperparameters of a
random forest.
... | bsd-3-clause |
liupfskygre/qiime | qiime/plot_rank_abundance_graph.py | 15 | 4175 | #!/usr/bin/env python
# File created on 17 Aug 2010
from __future__ import division
__author__ = "Jens Reeder"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Jens Reeder", "Emily TerAvest"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Justin Kuczynski"
__email__ = "justinak@gmai... | gpl-2.0 |
jjhelmus/wradlib | doc/source/pyplots/tutorial_zonal_statistics_polar.py | 1 | 11064 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Name: tutorial_zonal_statistics_polar.py
# Purpose:
#
# Author: Maik Heistermann, Kai Muehlbauer
#
# Created: 26.08.2015
# Copyright: (c) heistermann, muehlbauer 2015
# Lice... | mit |
xubenben/scikit-learn | examples/decomposition/plot_faces_decomposition.py | 204 | 4452 | """
============================
Faces dataset decompositions
============================
This example applies to :ref:`olivetti_faces` different unsupervised
matrix decomposition (dimension reduction) methods from the module
:py:mod:`sklearn.decomposition` (see the documentation chapter
:ref:`decompositions`) .
"""... | bsd-3-clause |
yask123/scikit-learn | sklearn/metrics/cluster/tests/test_unsupervised.py | 230 | 2823 | import numpy as np
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn.metrics.cluster.unsupervised import silhouette_score
from sklearn.metrics import pairwise_distances
from sklearn.utils.testing import assert_false, assert_almost_equal
from sklearn.utils.testing import assert_raises_regexp... | bsd-3-clause |
Barmaley-exe/scikit-learn | sklearn/datasets/samples_generator.py | 10 | 55091 | """
Generate samples of synthetic data sets.
"""
# Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel,
# G. Louppe, J. Nothman
# License: BSD 3 clause
import numbers
import warnings
import array
import numpy as np
from scipy import linalg
import scipy.sparse as sp
from ..preprocessing impo... | bsd-3-clause |
charanpald/wallhack | wallhack/modelselect/RealDataTreeExp3.py | 1 | 4315 | """
Test how the penalty varied for a fixed gamma with the number of examples.
"""
import logging
import numpy
import sys
import multiprocessing
from sandbox.util.PathDefaults import PathDefaults
from exp.modelselect.ModelSelectUtils import ModelSelectUtils
from sandbox.util.Sampling import Sampling
from exp.sa... | gpl-3.0 |
qkitgroup/qkit | qkit/drivers/IQ_Mixer.py | 1 | 40169 | # Toolset for calibrating and using IQ-Mixers as Single-Sideband-Mixers (SSB)
# Started by Andre Schneider 01/2015 <andre.schneider@student.kit.edu>
import qkit
from qkit.core.instrument_base import Instrument
import time
import types
import logging
import os
import numpy as np
if qkit.module_available("matp... | gpl-2.0 |
Sapphirine/Financial-Market-Volatility | MapReduce/reducer.py | 1 | 8560 | #!/Users/johnterzis/Library/Enthought/Canopy_64bit/User/bin/python
from operator import itemgetter
import sys
if '/Users/johnterzis/projects/source/MarketVol/Preprocessor/MapReduce' not in sys.path:
sys.path.append('/Users/johnterzis/projects/source/MarketVol/Preprocessor/MapReduce')
import constants as con
impor... | apache-2.0 |
chrsrds/scikit-learn | sklearn/svm/tests/test_svm.py | 1 | 38222 | """
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import numpy as np
import itertools
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.testing import assert_almost_equal
from numpy.testing import asse... | bsd-3-clause |
Becksteinlab/PDB_Ion_Survey | src/pdbionsurvey/coordination.py | 1 | 12791 | # PDB Ion Survey
# Copyright (c) 2016 Kacey Clark
# Published under the GPL v3
# https://github.com/Becksteinlab/PDB_Ion_Survey/
'''
Functions for analyzing ion coordination in PDB structures
'''
import os.path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import MDAnalysis as mda
import wa... | gpl-3.0 |
MatthieuBizien/scikit-learn | sklearn/tests/test_metaestimators.py | 57 | 4958 | """Common tests for metaestimators"""
import functools
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.externals.six import iterkeys
from sklearn.datasets import make_classification
from sklearn.utils.testing import assert_true, assert_false, assert_raises
from sklearn.pipeline import Pipeline... | bsd-3-clause |
Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/tseries/tests/test_frequencies.py | 9 | 25284 | from datetime import datetime, time, timedelta
from pandas.compat import range
import sys
import os
import nose
import numpy as np
from pandas import Index, DatetimeIndex, Timestamp, Series, date_range, period_range
import pandas.tseries.frequencies as frequencies
from pandas.tseries.tools import to_datetime
impor... | artistic-2.0 |
larsoner/mne-python | mne/cov.py | 3 | 78828 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
from copy import deepcopy
from distutils.version import LooseVersion
import itertools as itt
from math import log
import ... | bsd-3-clause |
brianlorenz/COSMOS_IMACS_Redshifts | PlotCodes/ReadEmission.py | 1 | 24020 | #Plots a lot of the various quantities that cna be extracted from emission lines
'''
'''
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import ascii
import sys, os, string
import pandas as pd
from astropy.io import fits
import collections
#Folder to save the figures
figout = '/Users/blorenz/COSMO... | mit |
shahankhatch/scikit-learn | sklearn/linear_model/tests/test_sag.py | 93 | 25649 | # Authors: Danny Sullivan <dbsullivan23@gmail.com>
# Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# Licence: BSD 3 clause
import math
import numpy as np
import scipy.sparse as sp
from sklearn.linear_model.sag import get_auto_step_size
from sklearn.linear_model.sag_fast import get_max_squared_sum
from skle... | bsd-3-clause |
Tong-Chen/scikit-learn | sklearn/cluster/mean_shift_.py | 3 | 11456 | """Meanshift clustering."""
# Authors: Conrad Lee <conradlee@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
from collections import defaultdict
import numpy as np
from ..externals import six
from ..utils import extmath, check_random_st... | bsd-3-clause |
liyu1990/sklearn | sklearn/utils/tests/test_utils.py | 35 | 9000 | import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import pinv2
from scipy.linalg import eigh
from itertools import chain
from sklearn.utils.testing import (assert_equal, assert_raises, assert_true,
assert_almost_equal, assert_array_equal,
... | bsd-3-clause |
LorenzoM1997/math-neural-network | math_neural_network_0.0.5.py | 1 | 5260 | import random
import matplotlib.pyplot as plt
def summation(result,first):
array = []
third = result - first
first = (16 + first)/96 #first character
third = (16 + third)/96 #third character
second = 11/96 #this correspond to the character '+'
array.append(first)
array.append(seco... | mit |
juehess/strava_prediction | src/main.py | 1 | 4810 | from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import os
import stravalib
import numpy as np
#for plotting
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import ran... | gpl-2.0 |
saketkc/statsmodels | statsmodels/sandbox/examples/example_nbin.py | 33 | 13139 | # -*- coding: utf-8 -*-
'''
Author: Vincent Arel-Bundock <varel@umich.edu>
Date: 2012-08-25
This example file implements 5 variations of the negative binomial regression
model for count data: NB-P, NB-1, NB-2, geometric and left-truncated.
The NBin class inherits from the GenericMaximumLikelihood statsmodels class
wh... | bsd-3-clause |
spark-test/spark | python/pyspark/sql/tests/test_pandas_cogrouped_map.py | 2 | 9264 | #
# 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 |
alexsavio/scikit-learn | sklearn/manifold/t_sne.py | 11 | 35451 | # Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de>
# Author: Christopher Moody <chrisemoody@gmail.com>
# Author: Nick Travers <nickt@squareup.com>
# License: BSD 3 clause (C) 2014
# This is the exact and Barnes-Hut t-SNE implementation. There are other
# modifications of the algorithm:
# * Fast Optimi... | bsd-3-clause |
ChanderG/scikit-learn | sklearn/ensemble/__init__.py | 217 | 1307 | """
The :mod:`sklearn.ensemble` module includes ensemble-based methods for
classification and regression.
"""
from .base import BaseEnsemble
from .forest import RandomForestClassifier
from .forest import RandomForestRegressor
from .forest import RandomTreesEmbedding
from .forest import ExtraTreesClassifier
from .fores... | bsd-3-clause |
mesnardo/snake | snake/petibm/logViewReader.py | 2 | 7857 | """
Collection of classes and function to parse a given PETSc log file.
"""
import re
import os
import collections
import numpy
from matplotlib import pyplot
class Run(object):
"""
A PetIBM run.
"""
def __init__(self, directory=os.getcwd(), label='', logpath=None):
"""
Sets the directory, the label,... | mit |
nmayorov/scikit-learn | examples/covariance/plot_robust_vs_empirical_covariance.py | 73 | 6451 | r"""
=======================================
Robust vs Empirical covariance estimate
=======================================
The usual covariance maximum likelihood estimate is very sensitive to the
presence of outliers in the data set. In such a case, it would be better to
use a robust estimator of covariance to guar... | bsd-3-clause |
sergpolly/Thermal_adapt_scripts | BOOTSTRAPS/DEPRECATED/BOOTSTRAP_RANDOM_extract_analyse_CAI.py | 1 | 6757 | import re
import os
import sys
from Bio import Seq
from Bio import SeqIO
from Bio import SeqUtils
import numpy as np
import pandas as pd
import cairi
from multiprocessing import Pool
import matplotlib.pyplot as plt
#MAYBE WE DONT NEED THAT ANYMORE ...
# # STUPID FIX TO AVOID OLDER PANDAS HERE ...
# # PYTHONPATH seems ... | mit |
apdjustino/DRCOG_Urbansim | src/drcog/variables/pums_vars.py | 1 | 8383 | import pandas as pd, numpy as np
import psycopg2
import pandas.io.sql as sql
def get_pums():
conn_string = "host='paris.urbansim.org' dbname='denver' user='drcog' password='M0untains#' port=5433"
conn = psycopg2.connect(conn_string)
cur = conn.cursor()
pums_hh = sql.read_frame('select * from pums_hh',c... | agpl-3.0 |
ezhouyang/class | tfidf.py | 1 | 4727 | #coding:utf-8
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import svm
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model impo... | apache-2.0 |
MatthieuBizien/scikit-learn | sklearn/cluster/tests/test_mean_shift.py | 48 | 3653 | """
Testing for mean shift clustering methods
"""
import numpy as np
import warnings
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import asser... | bsd-3-clause |
nvoron23/scikit-learn | examples/cluster/plot_color_quantization.py | 297 | 3443 | # -*- coding: utf-8 -*-
"""
==================================
Color Quantization using K-Means
==================================
Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace
(China), reducing the number of colors required to show the image from 96,615
unique colors to 64, while pre... | bsd-3-clause |
msarahan/bokeh | bokeh/charts/__init__.py | 3 | 1426 | from __future__ import absolute_import
from ..util.dependencies import import_required
import_required(
'pandas',
'The bokeh.charts interface requires Pandas (http://pandas.pydata.org) to be installed.'
)
# defaults and constants
from ..plotting.helpers import DEFAULT_PALETTE
# main components
from .chart im... | bsd-3-clause |
meteorcloudy/tensorflow | tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py | 30 | 40476 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
dsquareindia/scikit-learn | sklearn/datasets/__init__.py | 61 | 3734 | """
The :mod:`sklearn.datasets` module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
"""
from .base import load_breast_cancer
from .base import load_boston
from .base import load_diabetes
from .base import load_digi... | bsd-3-clause |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/model_selection/tests/test_validation.py | 6 | 57672 | """Test the validation module"""
from __future__ import division
import sys
import warnings
import tempfile
import os
from time import sleep
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.uti... | mit |
drdangersimon/image_diff | image_diff/utils/av.py | 1 | 3727 | import cv2
import numpy as np
import pylab as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import datetime
def plot(time, chi, filename=None, show=True, dpi=600):
'''Makes plots of time vs chi'''
majorLocator = MultipleLocator(5)
majorFormatter = FormatStrFormatter('%d')
mi... | mit |
mriosb08/palodiem-QE | src/SVR.py | 1 | 1936 | import sys
from sklearn.svm import SVR
from sklearn import grid_search
from math import sqrt
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import mean_absolute_error, mean_squared_error
from scipy.stats.mstats import mquantiles
from sklearn import preprocessing
import scipy as sp
import pickl... | apache-2.0 |
akhilaananthram/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/font_manager.py | 69 | 42655 | """
A module for finding, managing, and using fonts across platforms.
This module provides a single :class:`FontManager` instance that can
be shared across backends and platforms. The :func:`findfont`
function returns the best TrueType (TTF) font file in the local or
system font path that matches the specified :class... | agpl-3.0 |
chop-dbhi/arrc | tests/rs_tests.py | 1 | 4515 | import json
import unittest
import sys,os
sys.path.append('..')
import rs
import pandas as pd
from numpy.random import RandomState
import numpy as np
from learn import wrangle
__author__ = 'Aaron J. Masino'
class RSTestCase(unittest.TestCase):
def load_report(self, path):
f = open(path,'r')
text ... | mit |
thouska/spotpy | spotpy/examples/dds/dds_parallel_plot.py | 2 | 1866 | import numpy as np
import matplotlib.pylab as plt
import json
import matplotlib as mp
data_normalizer = mp.colors.Normalize()
color_map = mp.colors.LinearSegmentedColormap(
"my_map",
{
"red": [(0, 1.0, 1.0),
(1.0, .5, .5)],
"green": [(0, 0.5, 0.5),
(1.0, 0, 0)... | mit |
RPGOne/Skynet | scikit-learn-0.18.1/sklearn/model_selection/_validation.py | 5 | 36967 | """
The :mod:`sklearn.model_selection._validation` module includes classes and
functions to validate the model.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from __... | bsd-3-clause |
changebio/mamotif | MotifScan/motif.py | 1 | 14325 | #
# Copyright @ 2014, 2015 Jiawei Wang <jerryeah@gmail.com>, Zhen Shao <shao@enders.tch.harvard.edu>
#
# Licensed under the GPL License, Version 3.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.gnu.org/copyleft/gpl.html
#
... | gpl-3.0 |
CompPhysics/ThesisProjects | doc/MSc/msc_students/former/AudunHansen/Audun/Pythonscripts/CCD_HEG_Sparse_Implementation_2.py | 1 | 52290 | from numpy import *
from time import *
from matplotlib.pyplot import *
from scipy.sparse import csr_matrix, coo_matrix
class electronbasis():
def __init__(self, N, rs, Nparticles):
self.rs = rs
self.states = []
self.nstates = 0
self.nparticles = Nparticles
self.Em... | cc0-1.0 |
yunfeilu/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py | 227 | 5170 | """
=================================================
Hyper-parameters of Approximate Nearest Neighbors
=================================================
This example demonstrates the behaviour of the
accuracy of the nearest neighbor queries of Locality Sensitive Hashing
Forest as the number of candidates and the numb... | bsd-3-clause |
lrei/twitter_annotator | undersampler.py | 1 | 1206 | '''
Implements undersampling for pandas dataframes
'''
import numpy as np
from collections import Counter
def undersample(df, label_column, n=-1, seed=-1):
'''unsersamples a dataframe so that all classes have the same number of
examples.
Warning: dataframe is NOT shuffled. Examples will be ordered by cl... | mit |
michigraber/scikit-learn | sklearn/cluster/tests/test_affinity_propagation.py | 341 | 2620 | """
Testing for Clustering methods
"""
import numpy as np
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.cluster.affinity_propagation_ import AffinityPropagation
from sklearn.cluster.affinity_propagatio... | bsd-3-clause |
DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/examples/preprocessing/plot_function_transformer.py | 1 | 1992 | """
=========================================================
Using FunctionTransformer to select columns
=========================================================
Shows how to use a function transformer in a pipeline. If you know your
dataset's first principle component is irrelevant for a classification task,
you ca... | mit |
juliusbierk/scikit-image | doc/examples/plot_circular_elliptical_hough_transform.py | 11 | 4767 | """
========================================
Circular and Elliptical Hough Transforms
========================================
The Hough transform in its simplest form is a `method to detect
straight lines <http://en.wikipedia.org/wiki/Hough_transform>`__
but it can also be used to detect circles or ellipses.
The algo... | bsd-3-clause |
ian-r-rose/burnman | examples/example_averaging.py | 1 | 7470 | # This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU
# GPL v2 or later.
"""
example_averaging
-----------------
This example shows the effect of different averaging schemes. Currently fo... | gpl-2.0 |
akionakamura/scikit-learn | benchmarks/bench_random_projections.py | 397 | 8900 | """
===========================
Random projection benchmark
===========================
Benchmarks for random projections.
"""
from __future__ import division
from __future__ import print_function
import gc
import sys
import optparse
from datetime import datetime
import collections
import numpy as np
import scipy.s... | bsd-3-clause |
dhruv13J/scikit-learn | sklearn/semi_supervised/label_propagation.py | 128 | 15312 | # 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 |
scgmlz/BornAgain-tutorial | ba-school-2018/day_2/reflectometry_D/python_tutorial/task_script_key.py | 2 | 2656 | import numpy as np
from matplotlib import pyplot as plt
import bornagain as ba
from bornagain import deg, angstrom, nm
from plotter import PlotterSpecular
data_1 = np.loadtxt("python_exp_data_1.txt") # [deg, intensity], angle range [0, 3] deg
data_2 = np.loadtxt("python_exp_data_2.txt") # [deg, intensity], angle ran... | gpl-3.0 |
castelao/pyCEOF | ceof/ceof.py | 1 | 20821 | #!/usr/bin/env python
# -*- coding: Latin-1 -*-
""" Class to deal with Complex EOF
"""
from UserDict import UserDict
import numpy
import numpy as np
from numpy import ma
import scipy.fftpack
from pyclimate.svdeofs import svdeofs, getvariancefraction
from utils import scaleEOF
def ceof_scalar2D(data):
""" Est... | bsd-3-clause |
alephu5/Soundbyte | environment/lib/python3.3/site-packages/IPython/lib/tests/test_latextools.py | 10 | 4076 | # encoding: utf-8
"""Tests for IPython.utils.path.py"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this s... | gpl-3.0 |
mehdidc/scikit-learn | sklearn/metrics/tests/test_classification.py | 3 | 49751 | from __future__ import division, print_function
import numpy as np
from scipy import linalg
from functools import partial
from itertools import product
import warnings
from sklearn import datasets
from sklearn import svm
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import La... | bsd-3-clause |
r-mart/scikit-learn | examples/plot_johnson_lindenstrauss_bound.py | 127 | 7477 | r"""
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected i... | bsd-3-clause |
kod3r/Azure-MachineLearning-ClientLibrary-Python | azureml/services.py | 2 | 34218 | #-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License:
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the... | mit |
akrherz/iem | htdocs/plotting/auto/scripts/p59.py | 1 | 4672 | """u and v wind climatology"""
import datetime
import calendar
import numpy as np
import pandas as pd
from pandas.io.sql import read_sql
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFound
from metpy.units import units
from metpy.calc impo... | mit |
rebeccabilbro/machine-learning | 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... | mit |
seanpquig/study-group | neural-networks-and-deep-learning/src/old/mnist_pca.py | 4 | 1209 | """
mnist_pca
~~~~~~~~~
Use PCA to reconstruct some of the MNIST test digits.
"""
# My libraries
import mnist_loader
# Third-party libraries
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from sklearn.decomposition import RandomizedPCA
# Training
training_data, test_inputs, ... | mit |
rajat1994/scikit-learn | sklearn/linear_model/tests/test_base.py | 101 | 12205 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.linear_model.... | bsd-3-clause |
RayMick/scikit-learn | sklearn/decomposition/tests/test_factor_analysis.py | 222 | 3055 | # Author: Christian Osendorfer <osendorf@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Licence: BSD3
import numpy as np
from sklearn.utils.testing import assert_warns
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing im... | bsd-3-clause |
ehua7365/RibbonOperators | TEBD/mpstest16.py | 1 | 14538 | """
mpstest16.py
A test of manipulating matrix product states with numpy.
There is an upper bound chi for bond dimensions in getMPSOBC()
Variable bond dimension.
2014-08-29
"""
import numpy as np
import matplotlib.pyplot as plt
from cmath import *
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from ... | mit |
anielsen001/scipy | scipy/interpolate/fitpack.py | 22 | 46137 | #!/usr/bin/env python
"""
fitpack (dierckx in netlib) --- A Python-C wrapper to FITPACK (by P. Dierckx).
FITPACK is a collection of FORTRAN programs for curve and surface
fitting with splines and tensor product splines.
See
http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html
... | bsd-3-clause |
nelango/ViralityAnalysis | model/lib/pandas/stats/var.py | 16 | 16319 | from __future__ import division
from pandas.compat import range, lrange, zip, reduce
from pandas import compat
import numpy as np
from pandas.core.base import StringMixin
from pandas.util.decorators import cache_readonly
from pandas.core.frame import DataFrame
from pandas.core.panel import Panel
from pandas.core.serie... | mit |
kayarre/dicomwrangle | dcmreader.py | 1 | 2867 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 14:01:12 2015
@author: sansomk
"""
import dicom
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
#dcmpath='/Users/sansomk/Downloads/0.4/102'
dcmpath='/home/ksansom/caseFiles/mri/images/0.4/102'
... | bsd-2-clause |
pmorissette/ffn | tests/test_core.py | 1 | 24699 | import ffn
import pandas as pd
import numpy as np
from numpy.testing import assert_almost_equal as aae
try:
df = pd.read_csv("tests/data/test_data.csv", index_col=0, parse_dates=True)
except FileNotFoundError as e:
try:
df = pd.read_csv("data/test_data.csv", index_col=0, parse_dates=True)
except Fi... | mit |
ycasg/PyNLO | src/examples/simple_SSFM.py | 2 | 3646 | import numpy as np
import matplotlib.pyplot as plt
import pynlo
FWHM = 0.050 # pulse duration (ps)
pulseWL = 1550 # pulse central wavelength (nm)
EPP = 50e-12 # Energy per pulse (J)
GDD = 0.0 # Group delay dispersion (ps^2)
TOD = 0.0 # Third order dispersion (ps^3)
Window = 10.0 # simulatio... | gpl-3.0 |
Insight-book/data-science-from-scratch | first-edition/code-python3/nearest_neighbors.py | 8 | 7318 | from collections import Counter
from linear_algebra import distance
from stats import mean
import math, random
import matplotlib.pyplot as plt
def raw_majority_vote(labels):
votes = Counter(labels)
winner, _ = votes.most_common(1)[0]
return winner
def majority_vote(labels):
"""assumes that labels are ... | unlicense |
davidam/python-examples | elasticsearch/app/query.py | 1 | 1722 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from elasticsearch_dsl import Search, Q
#from util import ESConnection
import pandas as pd
class Query(object):
def query_metric_over_time(index, metric_name, metric_field, filters = []):
s = Search(using=es_conn, index=index) # Index selection
for filteri... | gpl-3.0 |
rbalda/neural_ocr | env/lib/python2.7/site-packages/matplotlib/backend_tools.py | 8 | 27963 | """
Abstract base classes define the primitives for Tools.
These tools are used by `matplotlib.backend_managers.ToolManager`
:class:`ToolBase`
Simple stateless tool
:class:`ToolToggleBase`
Tool that has two states, only one Toggle tool can be
active at any given time for the same
`matplotlib.backend_m... | mit |
kagayakidan/scikit-learn | sklearn/metrics/scorer.py | 211 | 13141 | """
The :mod:`sklearn.metrics.scorer` submodule implements a flexible
interface for model selection and evaluation using
arbitrary score functions.
A scorer object is a callable that can be passed to
:class:`sklearn.grid_search.GridSearchCV` or
:func:`sklearn.cross_validation.cross_val_score` as the ``scoring`` parame... | bsd-3-clause |
untom/scikit-learn | sklearn/gaussian_process/gaussian_process.py | 44 | 34602 | # -*- coding: utf-8 -*-
# Author: Vincent Dubourg <vincent.dubourg@gmail.com>
# (mostly translation, see implementation details)
# Licence: BSD 3 clause
from __future__ import print_function
import numpy as np
from scipy import linalg, optimize
from ..base import BaseEstimator, RegressorMixin
from ..metrics... | bsd-3-clause |
depet/scikit-learn | examples/ensemble/plot_gradient_boosting_oob.py | 7 | 4742 | """
======================================
Gradient Boosting Out-of-Bag estimates
======================================
Out-of-bag (OOB) estimates can be a useful heuristic to estimate
the "optimal" number of boosting iterations.
OOB estimates are almost identical to cross-validation estimates but
they can be compute... | bsd-3-clause |
lbishal/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 |
huzq/scikit-learn | sklearn/feature_extraction/tests/test_image.py | 14 | 11702 | # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import numpy as np
import scipy as sp
from scipy import ndimage
from scipy.sparse.csgraph import connected_components
import pytest
from sklearn.feature_extraction.im... | bsd-3-clause |
Labonneguigue/Machine-Learning | Project 3/hw3_clustering.py | 1 | 13773 | import csv
import sys
import numpy
import math
from numpy import genfromtxt
from numpy.linalg import inv
import random
from random import randint
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d, Axes3D
#import time
#start_time = time.time()
PrintEnabled = 0
X = genfromtxt(sys.argv[1], delimit... | mit |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/pyplots/pyplot_text.py | 1 | 1297 | """
===========
Pyplot Text
===========
"""
import numpy as np
import matplotlib.pyplot as plt
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 600)
plt.cla()
plt.clf()
plt.close('all')
def tempimage():
... | mit |
jmlorenzi/kmos | kmos/run/png.py | 2 | 5722 |
from ase.io.png import PNG
from ase.data.colors import jmol_colors
from ase.data import covalent_radii
from ase.utils import rotate
from math import sqrt
import numpy as np
class MyPNG(PNG):
def __init__(self, atoms,
rotation='',
show_unit_cell=False,
radii=None,... | gpl-3.0 |
asalomatov/variants | variants/work/bcm_cdfd_sf_compare.py | 1 | 30674 | import sys, os
import pandas
from variants import func
import ped
import argparse
import collections
sys.path.insert(0, '/mnt/xfs1/home/asalomatov/projects/variants/variants/work/')
from init_baylor_info import spID2labID
from init_baylor_info import labID2spID
from init_baylor_info import lab2batch
import summarizeVar... | mit |
marcoscrcamargo/ic | opencv/classifiers/mlp.py | 1 | 5294 | # import the necessary packages
from sklearn.neural_network import MLPClassifier
# from sklearn.cross_validation import train_test_split
# resolvendo problemas de compatibilidade
from sklearn.model_selection import train_test_split
from imutils import paths
import numpy as np
import argparse
import imutils
import cv2
... | gpl-3.0 |
krez13/scikit-learn | examples/covariance/plot_mahalanobis_distances.py | 348 | 6232 | r"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dis... | bsd-3-clause |
MingdaZhou/gnuradio | gr-utils/python/utils/plot_fft_base.py | 53 | 10449 | #!/usr/bin/env python
#
# Copyright 2007,2008,2011 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 |
c-PRIMED/puq | test/pdf_test.py | 1 | 12207 | #!/usr/bin/env python
"""
unit tests for basic math operations on PDFs.
"""
#from __future__ import absolute_import, division, print_function
from puq import *
import numpy as np
import sys, matplotlib, time
import scipy.stats
if sys.platform == 'darwin':
matplotlib.use('macosx', warn=False)
else:
matplotlib.u... | mit |
vinokurov/salty_tickets | salty_tickets/views.py | 1 | 25490 | from flask import render_template, request, Response
from flask import url_for, jsonify
from itsdangerous import BadSignature
from salty_tickets import app
from salty_tickets import config
from salty_tickets.controllers import OrderSummaryController, OrderProductController, FormErrorController
from salty_tickets.databa... | mit |
Micromeritics/report-models-python | micromeritics/plots.py | 3 | 4263 | """This module contains helper functions to show plots."""
import numpy as np
import tplot
import matplotlib.pyplot as plt
_AXIS_LABEL_QUANTADS = 'Quantity Adsorbed (cm^3/g STP)'
_AXIS_LABEL_RELPRESS = 'Relative Pressure($p/p^\circ$)'
_AXIS_LABEL_ABSPRESS = 'Absolute Pressure (mmHg)'
_AXIS_LABEL_THICKNESS = 'Thicknes... | gpl-3.0 |
abimannans/scikit-learn | sklearn/metrics/tests/test_pairwise.py | 17 | 24947 | 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 |
apache/beam | sdks/python/apache_beam/dataframe/transforms.py | 5 | 21160 | #
# 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 |
APMonitor/arduino | 3_On_Off_Control/Python/On_Off_Control_2_Heaters.py | 1 | 1854 | import numpy as np
from tclab import TCLab
import time
import matplotlib.pyplot as plt
a = TCLab()
# total time points
n = 10 * 60 + 1 # min in sec
# turn on LED
a.LED(100)
# store temperatures for plotting
T1s = np.ones(n) * a.T2
T2s = np.ones(n) * a.T1
T1sp = np.ones(n) * 25.0
T2sp = np.ones(n) *... | apache-2.0 |
binghongcha08/pyQMD | GWP/2D/1.0.3/traj.py | 14 | 1289 | #!/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 = f... | gpl-3.0 |
cwu2011/scikit-learn | examples/svm/plot_oneclass.py | 249 | 2302 | """
==========================================
One-class SVM with non-linear kernel (RBF)
==========================================
An example using a one-class SVM for novelty detection.
:ref:`One-class SVM <svm_outlier_detection>` is an unsupervised
algorithm that learns a decision function for novelty detection:
... | bsd-3-clause |
BigDataehealthTools/GOAT_Genetic_Output_Analysis_Tool | Tools/getPhenotypes.py | 2 | 2375 | # 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.