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 |
|---|---|---|---|---|---|
jakevdp/wpca | wpca/utils.py | 1 | 4069 | import numpy as np
from sklearn.utils.validation import check_array
def check_array_with_weights(X, weights, **kwargs):
"""Utility to validate data and weights.
This calls check_array on X and weights, making sure results match.
"""
if weights is None:
return check_array(X, **kwargs), weights... | bsd-3-clause |
joergdietrich/astropy | astropy/visualization/wcsaxes/coordinates_map.py | 4 | 7453 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function, division, absolute_import
from ...extern import six
from .coordinate_helpers import CoordinateHelper
from .transforms import WCSPixel2WorldTransform
from .utils import coord_type_from_ctype
from .frame import Recta... | bsd-3-clause |
rvraghav93/scikit-learn | benchmarks/bench_saga.py | 45 | 8474 | """Author: Arthur Mensch
Benchmarks of sklearn SAGA vs lightning SAGA vs Liblinear. Shows the gain
in using multinomial logistic regression in term of learning time.
"""
import json
import time
from os.path import expanduser
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import fetch_rcv1, ... | bsd-3-clause |
andnovar/ggplot | ggplot/tests/test_geom_lines.py | 12 | 4895 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from six.moves import xrange
from nose.tools import assert_equal, assert_true, assert_raises
from . import get_assert_same_ggplot, cleanup
assert_same_ggplot = get_assert_same_ggplot(__file__)
from ggplot im... | bsd-2-clause |
debugger87/spark | python/setup.py | 5 | 10182 | #!/usr/bin/env python
#
# 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 "Li... | apache-2.0 |
mihail911/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/legend.py | 69 | 30705 | """
Place a legend on the axes at location loc. Labels are a
sequence of strings and loc can be a string or an integer
specifying the legend location
The location codes are
'best' : 0, (only implemented for axis legends)
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4... | gpl-3.0 |
theoryno3/scikit-learn | sklearn/manifold/isomap.py | 36 | 7119 | """Isomap for manifold learning"""
# Author: Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) 2011
import numpy as np
from ..base import BaseEstimator, TransformerMixin
from ..neighbors import NearestNeighbors, kneighbors_graph
from ..utils import check_array
from ..utils.graph import... | bsd-3-clause |
mattilyra/scikit-learn | examples/linear_model/plot_multi_task_lasso_support.py | 102 | 2319 | #!/usr/bin/env python
"""
=============================================
Joint feature selection with multi-task Lasso
=============================================
The multi-task lasso allows to fit multiple regression problems
jointly enforcing the selected features to be the same across
tasks. This example simulates... | bsd-3-clause |
jor-/scipy | scipy/special/add_newdocs.py | 1 | 208122 | # Docstrings for generated ufuncs
#
# The syntax is designed to look like the function add_newdoc is being
# called from numpy.lib, but in this file add_newdoc puts the
# docstrings in a dictionary. This dictionary is used in
# _generate_pyx.py to generate the docstrings for the ufuncs in
# scipy.special at the C level... | bsd-3-clause |
fja05680/pinkfish | pinkfish/itable.py | 1 | 14315 | '''
Keep track of styles for cells/headers in PrettyTable.
The MIT License (MIT)
Copyright (c) 2014 Melissa Gymrek <mgymrek@mit.edu>
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 Software without restr... | mit |
sujithvm/internationality-journals | src/IPP_SNIP_parse.py | 3 | 5729 | __author__ = 'Sukrit'
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
def poly_fit(x,y,deg):
#POLYNOMIAL FIT
# calculate polynomial
z = np.polyfit(x, y, deg)
f = np.poly1d(z)
# calculate new x's and y's
x_new = np.linspace(np.amin(x),... | mit |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/pandas/tests/frame/test_to_csv.py | 7 | 44295 | # -*- coding: utf-8 -*-
from __future__ import print_function
import csv
import pytest
from numpy import nan
import numpy as np
from pandas.compat import (lmap, range, lrange, StringIO, u)
from pandas.errors import ParserError
from pandas import (DataFrame, Index, Series, MultiIndex, Timestamp,
... | mit |
juanka1331/VAN-applied-to-Nifti-images | final_scripts/reconstruction/single_reconstructor.py | 1 | 5987 | import os
import sys
sys.path.append(os.path.dirname(os.getcwd()))
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
import settings
from lib import regenerate_utils
from lib import session_helper as session
from lib import utils
from lib.data_loader import MRI_stack_NORAD
from lib.data_... | gpl-2.0 |
ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/pandas/conftest.py | 1 | 7269 | import os
import pytest
import pandas
import numpy as np
import pandas as pd
from pandas.compat import PY3
import pandas.util._test_decorators as td
def pytest_addoption(parser):
parser.addoption("--skip-slow", action="store_true",
help="skip slow tests")
parser.addoption("--skip-networ... | mit |
3manuek/scikit-learn | examples/svm/plot_svm_regression.py | 249 | 1451 | """
===================================================================
Support Vector Regression (SVR) using linear and non-linear kernels
===================================================================
Toy example of 1D regression using linear, polynomial and RBF kernels.
"""
print(__doc__)
import numpy as np
... | bsd-3-clause |
NifTK/NiftyNet | tests/resampler_grid_warper_test.py | 1 | 13970 | from __future__ import absolute_import, print_function, division
import base64
import numpy as np
import tensorflow as tf
from niftynet.layer.grid_warper import AffineGridWarperLayer
from niftynet.layer.resampler import ResamplerLayer
from tests.niftynet_testcase import NiftyNetTestCase
test_case_2d_1 = {
'data... | apache-2.0 |
frank-tancf/scikit-learn | sklearn/utils/tests/test_validation.py | 56 | 18600 | """Tests for input validation functions"""
import warnings
from tempfile import NamedTemporaryFile
from itertools import product
import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true, assert_false, assert_equal
from sklearn.utils.... | bsd-3-clause |
KarrLab/wc_utils | tests/util/test_rand.py | 1 | 6920 | """ Random utility tests
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2016-11-03
:Copyright: 2016-2018, Karr Lab
:License: MIT
"""
from copy import deepcopy
from matplotlib import pyplot
from numpy import random
from scipy.stats import binom, poisson
from wc_utils.util.rand import RandomState, RandomStateManager, va... | mit |
ningchi/scikit-learn | sklearn/datasets/svmlight_format.py | 39 | 15319 | """This module implements a loader and dumper for the svmlight format
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable to
predict.
This format is used as the... | bsd-3-clause |
amolkahat/pandas | pandas/io/formats/format.py | 3 | 54799 | # -*- coding: utf-8 -*-
"""
Internal module for formatting output data in csv, html,
and latex files. This module also applies to display formatting.
"""
from __future__ import print_function
# pylint: disable=W0141
from functools import partial
import numpy as np
from pandas._libs import lib
from pandas._libs.tsli... | bsd-3-clause |
imaculate/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 176 | 12155 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | bsd-3-clause |
mshakya/PyPiReT | piret/checks/fasta.py | 1 | 2909 | #! /usr/bin/env python
"""Check fasta."""
import Bio
import re
import pandas as pd
import sys
class CheckFasta():
"""Check different instances of fasta."""
def __init__(self):
"""Initialize."""
# self.design_file = design_file
def confirm_fasta(self, fasta_file):
"""Check if the... | bsd-3-clause |
dhh17/categories_norms_genres | classifier_train.py | 1 | 6173 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Poem classifier
"""
import argparse
import glob
import logging
import pprint
import re
import csv
import gc
import pandas
from lxml import etree
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
from sklearn.externals ... | mit |
jonkrohn/study-group | neural-networks-and-deep-learning/src/old/mnist_autoencoder.py | 4 | 3399 | """
mnist_autoencoder
~~~~~~~~~~~~~~~~~
Implements an autoencoder for the MNIST data. The program can do two
things: (1) plot the autoencoder's output for the first ten images in
the MNIST test set; and (2) use the autoencoder to build a classifier.
The program is a quick-and-dirty hack --- we'll do things in ... | mit |
mbkumar/pymatgen | pymatgen/util/plotting.py | 3 | 21622 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Utilities for generating nicer plots.
"""
import math
import numpy as np
from pymatgen.core.periodic_table import Element
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Proje... | mit |
sanketloke/scikit-learn | examples/linear_model/plot_logistic_path.py | 349 | 1195 | #!/usr/bin/env python
"""
=================================
Path with L1- Logistic Regression
=================================
Computes path on IRIS dataset.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from datetime import datetime
import numpy as np
import... | bsd-3-clause |
Evolving-AI-Lab/innovation-engine | caffe/examples/web_demo/app.py | 9 | 7767 | import os
import time
import cPickle
import datetime
import logging
import flask
import werkzeug
import optparse
import tornado.wsgi
import tornado.httpserver
import numpy as np
import pandas as pd
import Image
import cStringIO as StringIO
import urllib
import exifutil
import caffe
REPO_DIRNAME = os.path.abspath(os.p... | mit |
knatz-personal/Scribbler | Scribbler/components/richtexttoolbar.py | 1 | 5818 | from kivy.uix.boxlayout import BoxLayout
from builtins import sorted
import itertools
import matplotlib.font_manager
from components.separator import HorizontalSeparator
from components.button.dropdowntoolbutton import DropSelectButton
from kivy.uix.dropdown import DropDown
from components.button.toolbutton import Tool... | mit |
pywr/pywr | pywr/recorders/recorders.py | 1 | 21745 | import sys
import pandas
import numpy as np
from functools import wraps
from pywr._core import AbstractNode, AbstractStorage
from ._recorders import *
from ._thresholds import *
from ._hydropower import *
from .events import *
from .calibration import *
from .kde import *
from pywr.h5tools import H5Store
from ..paramet... | gpl-3.0 |
pratapvardhan/pandas | pandas/tests/indexes/interval/test_interval_new.py | 4 | 13089 | from __future__ import division
import pytest
import numpy as np
from pandas import Interval, IntervalIndex, Int64Index
import pandas.util.testing as tm
pytestmark = pytest.mark.skip(reason="new indexing tests for issue 16316")
class TestIntervalIndex(object):
def _compare_tuple_of_numpy_array(self, result, ... | bsd-3-clause |
gfyoung/pandas | pandas/tests/util/test_assert_categorical_equal.py | 6 | 2748 | import pytest
from pandas import Categorical
import pandas._testing as tm
@pytest.mark.parametrize(
"c",
[Categorical([1, 2, 3, 4]), Categorical([1, 2, 3, 4], categories=[1, 2, 3, 4, 5])],
)
def test_categorical_equal(c):
tm.assert_categorical_equal(c, c)
@pytest.mark.parametrize("check_category_order"... | bsd-3-clause |
suttond/MODOI | ase/gui/graphs.py | 6 | 4750 | from math import sqrt
import gtk
from gettext import gettext as _
from ase.gui.widgets import pack, help
graph_help_text = _("""\
Help for plot ...
Symbols:
<c>e</c>:\t\t\t\ttotal energy
<c>epot</c>:\t\t\tpotential energy
<c>ekin</c>:\t\t\tkinetic energy
<c>fmax</c>:\t\t\tmaximum force
<c>fave</c>:\t\t\taverage forc... | lgpl-3.0 |
deo1/deo1 | KaggleKkboxChurn/custom_classifier_config_dict.py | 2 | 5063 | import numpy as np
classifier_config_dict = {
# Classifiers
'sklearn.naive_bayes.GaussianNB': {
},
'sklearn.naive_bayes.BernoulliNB': {
'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.],
'fit_prior': [True, False]
},
'sklearn.naive_bayes.MultinomialNB': {
'alpha': [1e-3, 1e-... | mit |
walterreade/scikit-learn | sklearn/cluster/tests/test_spectral.py | 262 | 7954 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
dymkowsk/mantid | MantidPlot/mantidplotrc.py | 3 | 2934 | #-------------------------------------------------------------------------------
# mantidplotrc.py
#
# Startup script for MantidPlot, executed once when the python environment
# is initialized. Any definitions added here will affect all Python scopes
# within the program.
#
#--------------------------------------------... | gpl-3.0 |
gclenaghan/scikit-learn | examples/neural_networks/plot_mlp_alpha.py | 17 | 4088 | """
================================================
Varying regularization in Multi-layer Perceptron
================================================
A comparison of different values for regularization parameter 'alpha' on
synthetic datasets. The plot shows that different alphas yield different
decision functions.
A... | bsd-3-clause |
dingocuster/scikit-learn | sklearn/decomposition/tests/test_nmf.py | 130 | 6059 | import numpy as np
from scipy import linalg
from sklearn.decomposition import nmf
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import raises
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_gr... | bsd-3-clause |
ocelot-collab/ocelot | demos/ebeam/linac_orb_correction_micado.py | 1 | 2964 | """
Linac Orbit Correction.
S.Tomin. 09.2019
"""
from ocelot import *
from ocelot.gui.accelerator import *
import dogleg_lattice as dl
from ocelot.cpbd.orbit_correction import *
from ocelot.cpbd.response_matrix import *
import seaborn as sns
import logging
#logging.basicConfig(level=logging.INFO)
method = MethodTM()... | gpl-3.0 |
takaakiaoki/PyFoam | PyFoam/Applications/IPythonNotebook.py | 3 | 26308 | """
Application-class that implements pyFoamIPythonNotebook.py
"""
from optparse import OptionGroup
from .PyFoamApplication import PyFoamApplication
from PyFoam.IPythonHelpers.Notebook import Notebook
from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory
from PyFoam.Basics.FoamOptionParser import Subcom... | gpl-2.0 |
Haunter17/MIR_SU17 | exp2/exp2_0c.py | 1 | 8381 | import numpy as np
import tensorflow as tf
import h5py
import time
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# Functions for initializing neural nets parameters
def init_weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1, dtype=tf.float32)
return tf.Variable(initia... | mit |
alexholcombe/twoWords | RansleySingleshotVersion/twoWordsWithStaircasecopy2.py | 1 | 79588 | #Alex Holcombe alex.holcombe@sydney.edu.au
#See the github repository for more information: https://github.com/alexholcombe/twoWords
from __future__ import print_function, division
from psychopy import monitors, visual, event, data, logging, core, sound, gui, microphone
from matplotlib import pyplot
import psych... | mit |
vvvityaaa/PyImgProcess | filter/median_filter.py | 1 | 1483 | from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import math
import time
import exmod
from open_image import open_image
def median_filter(path, region_size):
'''
Values for every pixel equals to the median of all values in the region
:param path: path to the image
:param regi... | mit |
Fireblend/scikit-learn | examples/semi_supervised/plot_label_propagation_versus_svm_iris.py | 286 | 2378 | """
=====================================================================
Decision boundary of label propagation versus SVM on the Iris dataset
=====================================================================
Comparison for decision boundary generated on iris dataset
between Label Propagation and SVM.
This demon... | bsd-3-clause |
mydongistiny/external_chromium_org | chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py | 35 | 11261 | #!/usr/bin/python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Do all the steps required to build and test against nacl."""
import optparse
import os.path
import re
import shutil
import subproc... | bsd-3-clause |
mkocka/galaxytea | modeling/novosad/disc_quantities.py | 1 | 3045 | import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import math
alpha = 0.5 #parameter of accretion [something]
M = 1.0 #change of mass of compact object [[10**16 g * s**(-1)]]
m = 5.0 #mass of compact object [M_sun]
R_star = 10.0**(-4) #radius of compact object [10**10 cm = 100 000 km, so ... | mit |
michaelpacer/scikit-image | doc/examples/plot_join_segmentations.py | 14 | 1967 | """
==========================================
Find the intersection of two segmentations
==========================================
When segmenting an image, you may want to combine multiple alternative
segmentations. The `skimage.segmentation.join_segmentations` function
computes the join of two segmentations, in wh... | bsd-3-clause |
jorge2703/scikit-learn | sklearn/neighbors/tests/test_dist_metrics.py | 230 | 5234 | import itertools
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
import scipy
from scipy.spatial.distance import cdist
from sklearn.neighbors.dist_metrics import DistanceMetric
from nose import SkipTest
def dist_func(x1, x2, p):
return np.sum((x1 - x2) ** p) ** (1. / p)
de... | bsd-3-clause |
Windy-Ground/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 |
fzalkow/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 |
ricsoncheng/sarcasm_machine | baseline.py | 1 | 1729 | #!/usr/bin/env python2
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.decomposition import PCA
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import f1_score
from sklearn.model_selection import R... | gpl-3.0 |
0asa/scikit-learn | sklearn/linear_model/tests/test_randomized_l1.py | 39 | 4706 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.linear_model.randomized_l1 i... | bsd-3-clause |
bmazin/SDR | Projects/Simulator/histPeaks.py | 1 | 9668 | import numpy as np
import matplotlib.pyplot as plt
from fitFunctions import gaussian
import mpfit
import scipy.stats
import scipy.interpolate
import smooth
def extrema(a):
nBins=300
hist,binEdges = np.histogram(a,bins=nBins,density=True)
smoothWindowSize=50
histSmooth = smooth.smooth(hist,smoothWindow... | gpl-2.0 |
NhuanTDBK/Kaggle_StackedOverflow | PairwiseRank.py | 1 | 3801 |
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
import seaborn as snb
import nltk
from gensim.models import Word2Vec, Phrases
from sklearn.utils import shuffle
import matplotlib.pyplot as plt
import re
import string
import gensim
from sklear... | apache-2.0 |
vivekmishra1991/scikit-learn | examples/ensemble/plot_random_forest_embedding.py | 286 | 3531 | """
=========================================================
Hashing feature transformation using Totally Random Trees
=========================================================
RandomTreesEmbedding provides a way to map data to a
very high-dimensional, sparse representation, which might
be beneficial for classificati... | bsd-3-clause |
lin-credible/scikit-learn | examples/linear_model/plot_sgd_separating_hyperplane.py | 260 | 1219 | """
=========================================
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 |
vkscool/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py | 70 | 9051 | from __future__ import division
"""
backend_wxagg.py
A wxPython backend for Agg. This uses the GUI widgets written by
Jeremy O'Donoghue (jeremy@o-donoghue.com) and the Agg backend by John
Hunter (jdhunter@ace.bsd.uchicago.edu)
Copyright (C) 2003-5 Jeremy O'Donoghue, John Hunter, Illinois Institute of
Technolo... | gpl-3.0 |
miic-sw/miic | miic.core/src/miic/core/inversion.py | 1 | 16293 | """
@author:
Eraldo Pomponi
@copyright:
The MIIC Development Team (eraldo.pomponi@uni-leipzig.de)
@license:
GNU Lesser General Public License, Version 3
(http://www.gnu.org/copyleft/lesser.html)
Created on Nov 8, 2011
"""
# Main imports
import os
import numpy as np
from numpy.linalg import LinAlgError
from scipy.nd... | gpl-3.0 |
waylonflinn/bquery | bquery/ctable.py | 1 | 23323 | # internal imports
from bquery import ctable_ext
# external imports
import numpy as np
import bcolz
import os
from bquery.ctable_ext import \
SUM, COUNT, COUNT_NA, COUNT_DISTINCT, SORTED_COUNT_DISTINCT, \
MEAN, STDEV
class ctable(bcolz.ctable):
def cache_valid(self, col):
"""
Checks wheth... | bsd-3-clause |
hammerlab/datacache | datacache/download.py | 1 | 8615 | # Copyright (c) 2015-2018. Mount Sinai School of Medicine
#
# 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 applicabl... | apache-2.0 |
dingocuster/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 |
DiCarloLab-Delft/PycQED_py3 | pycqed/simulations/cz_superoperator_simulation_functions_v2.py | 1 | 94448 | import numpy as np
import qutip as qtp
import scipy
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
import logging
log = logging.getLogger(__name__)
np.set_printoptions(threshold=np.inf)
# Hardcoded number of levels for the two transmons.
# Currently only 3,3 or 4,3 are supported. The bottle... | mit |
NunoEdgarGub1/scikit-learn | examples/linear_model/plot_sgd_loss_functions.py | 249 | 1095 | """
==========================
SGD: convex loss functions
==========================
A plot that compares the various convex loss functions supported by
:class:`sklearn.linear_model.SGDClassifier` .
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
def modified_huber_loss(y_true, y_pred):
z ... | bsd-3-clause |
neurokernel/retina | retina/screen/screen.py | 1 | 14459 | from __future__ import division
import os
from abc import ABCMeta, abstractmethod, abstractproperty
import contextlib
import numpy as np
from neurokernel.LPU.utils.simpleio import *
from retina.input.image2d import image2Dfactory
from .map.mapimpl import pointmapfactory
from .transform.imagetransform import ImageTr... | bsd-3-clause |
imsparsh/librosa | tests/test_onset.py | 2 | 5297 | #!/usr/bin/env python
# CREATED:2013-03-11 18:14:30 by Brian McFee <brm2132@columbia.edu>
# unit tests for librosa.beat
from __future__ import print_function
from nose.tools import raises, eq_
# Disable cache
import os
try:
os.environ.pop('LIBROSA_CACHE_DIR')
except:
pass
import matplotlib
matplotlib.use('A... | isc |
StefReck/Km3-Autoencoder | scripts/plotting/make_updown_acc_plot.py | 1 | 2179 | # -*- coding: utf-8 -*-
import h5py
import matplotlib.pyplot as plt
import numpy as np
"""
Make a plot that shows what fraction of events from a h5 file are down-going.
"""
datafile = "/home/woody/capn/mppi033h/Data/ORCA_JTE_NEMOWATER/h5_input_projections_3-100GeV/4dTo3d/h5/xzt/concatenated/test_muon-CC_and_elec-CC_ea... | mit |
StratsOn/zipline | zipline/sources/data_frame_source.py | 2 | 4942 | #
# Copyright 2015 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 |
zeeshanali/blaze | blaze/compute/expr/viz.py | 8 | 1342 | """
Visualize expression graphs using graphviz.
"""
from __future__ import absolute_import, division, print_function
try:
import networkx
have_networkx = True
except ImportError:
have_networkx = False
from io import BytesIO
import warnings
from subprocess import Popen, PIPE
from tempfile import NamedTemp... | bsd-3-clause |
schets/scikit-learn | sklearn/metrics/scorer.py | 13 | 13090 | """
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 |
nomadcube/scikit-learn | examples/decomposition/plot_pca_vs_lda.py | 182 | 1743 | """
=======================================================
Comparison of LDA and PCA 2D projection of Iris dataset
=======================================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
a... | bsd-3-clause |
NelisVerhoef/scikit-learn | examples/linear_model/plot_polynomial_interpolation.py | 251 | 1895 | #!/usr/bin/env python
"""
========================
Polynomial interpolation
========================
This example demonstrates how to approximate a function with a polynomial of
degree n_degree by using ridge regression. Concretely, from n_samples 1d
points, it suffices to build the Vandermonde matrix, which is n_samp... | bsd-3-clause |
jungla/ICOM-fluidity-toolbox | Detectors/offline_advection/plot_Richardson_3D_interpAll.py | 1 | 6158 | #!~/python
import fluidity_tools
import matplotlib as mpl
mpl.use('ps')
import matplotlib.pyplot as plt
import myfun
import numpy as np
import os
import lagrangian_stats
import advect_functions
from scipy import interpolate
import csv
import advect_functions
# read offline
print 'reading particles'
dim = '3D'
label ... | gpl-2.0 |
evanbiederstedt/RRBSfun | scripts/Normal_B_regions.py | 1 | 25300 | import glob
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib
import os
os.chdir('/Users/evanbiederstedt/Downloads/RRBS_data_files')
normal_B = glob.glob("RRBS_normal_B*")
newdf1 = pd.DataFrame()
for filename in normal_B:
df = pd.read_table(filename)
... | mit |
laurentgo/arrow | python/pyarrow/tests/strategies.py | 1 | 8426 | # 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 |
mdrumond/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py | 15 | 31142 | # 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 |
bloyl/mne-python | mne/decoding/tests/test_csp.py | 13 | 13483 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Romain Trachel <trachelr@gmail.com>
# Alexandre Barachant <alexandre.barachant@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import pytest
from numpy.testing... | bsd-3-clause |
howeverforever/SuperMotor | pic_data/0830/BODY3/main.py | 12 | 4519 | # import serial
import sys
import numpy as np
from lib import Parser, PresentationModel, AnalogData
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
def real_time_process(argv):
"""
When the model has built, then load data real-time to predict the state at the moment.
:param arg... | apache-2.0 |
Chiroptera/ThesisWriting | high_res_results_isabella_pc/experiments/QKMeans/testBench2.py | 2 | 10570 | '''
This version of the test bench is aimed to use with the Davies-Bouldin timings
from QK-Means and the early stop implementation.
'''
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from sklearn.cluster import KMeans
import oracle
import qubitLib
import DaviesBouldin
import QK_Mea... | mit |
asnorkin/sentiment_analysis | site/lib/python2.7/site-packages/sklearn/feature_extraction/tests/test_image.py | 38 | 11165 | # 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 numpy.testing import assert_raises
from sklearn.feature_extraction.image import (
img_to_gra... | mit |
strawlab/drosophila_eye_map | drosophila_eye_map/precompute_buchner71_optics.py | 1 | 42088 | # -*- coding: utf-8 -*-
# Copyright (c) 2005-2008, California Institute of Technology
# Copyright (c) 2017, Albert-Ludwigs-Universität Freiburg
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
... | bsd-2-clause |
thientu/scikit-learn | examples/linear_model/plot_theilsen.py | 232 | 3615 | """
====================
Theil-Sen Regression
====================
Computes a Theil-Sen Regression on a synthetic dataset.
See :ref:`theil_sen_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers. It has a breakd... | bsd-3-clause |
degoldschmidt/fly-analysis | src/experiment_stop.py | 1 | 2820 | """
Experiment stop (experiment_stop.py)
This script takes a video and calculates the frame number of when
the experiment was stopped, based on overall pixel changes.
D.Goldschmidt - 09/08/16
"""
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import cv2
import os
import matplotlib.pyplot a... | gpl-3.0 |
imaculate/scikit-learn | sklearn/decomposition/tests/test_pca.py | 21 | 18046 | import numpy as np
from itertools import product
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.u... | bsd-3-clause |
HWNi/DATA515-Project | uberTaxi/script/find_neighborhood.py | 1 | 1746 | import numpy as np
import pandas as pd
import pickle
import csv
import os
from check_points import point_inside_polygon
def find_neighborhood(result, csv_file):
"""
A function determines the coordinates belongs to which neighborhood.
Add a new column 'neighborhood' to the given csv file, then output a ne... | mit |
TheChymera/consciplot | vdoc.py | 1 | 1240 | from matplotlib import pyplot as plt
import numpy as np
from matplotlib_venn import venn2, venn2_circles
def vdoc_plot(overlap):
plt.figure(figsize=(13,13), facecolor="white")
#syntax: set1, set2, set1x2...
subset_tuple=(5,2,overlap)
v = venn2(subsets=subset_tuple, set_labels = ('A', 'B', 'C'))
v.get_patch_by_id... | gpl-3.0 |
maxlikely/scikit-learn | examples/linear_model/plot_logistic_l1_l2_sparsity.py | 4 | 2586 | """
==============================================
L1 Penalty and Sparsity in Logistic Regression
==============================================
Comparison of the sparsity (percentage of zero coefficients) of solutions when
L1 and L2 penalty are used for different values of C. We can see that large
values of C give mo... | bsd-3-clause |
xiandiancloud/edx-platform | docs/en_us/developers/source/conf.py | 30 | 6955 | # -*- coding: utf-8 -*-
# pylint: disable=C0103
# pylint: disable=W0622
# pylint: disable=W0212
# pylint: disable=W0613
import sys, os
from path import path
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
sys.path.append('../../../../')
from docs.shared.conf import *
# Add any paths that contain template... | agpl-3.0 |
SteveNguyen/QM_OptimalControl | plot_all.py | 1 | 2263 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from scipy import *
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import sys
meta_file=sys.argv[1]+"/meta.dat"
landscape_file=sys.argv[1]+"/landscape.dat"
#landscape_file=sys.argv[1]+"/learning.dat"
policy_file=sys.argv[1]+"/policy.dat"
control_file=sys.a... | gpl-2.0 |
johngeer/social-media-comparison | code/analysis/distinctive_words.py | 1 | 15456 | # This looks through the content from the different streams to find
# 'distinctive words'. These are words that are the most likely to come
# from a given stream. For example "RT" tends to be a distinctive word for
# the twitter stream because it is frequently used it tweets (to mean
# retweet) yet is rarely used in ... | gpl-2.0 |
mjgrav2001/scikit-learn | sklearn/svm/classes.py | 13 | 40017 | import warnings
import numpy as np
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
from ..base import BaseEstimator, RegressorMixin
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
LinearModel
from ..feature_selection.from_model import _LearntSelectorMixin
from ..utils import check_X... | bsd-3-clause |
ClimbsRocks/auto_ml | tests/utils_testing.py | 1 | 4371 | import sys, os
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
os.environ['is_test_suite'] = 'True'
import pandas as pd
from sklearn.datasets import load_boston
from sklearn.metrics import brier_score_loss, mean_squared_error
from sklearn.model_selection import train_test_split
from auto_ml import ... | mit |
sebchalmers/TrafficMHE | TrafficMHEExperiments.py | 1 | 15198 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 20:18:08 2012
@author: Sebastien Gros
Assistant Professor
Department of Signals and Systems
Chalmers University of Technology
SE-412 96 Gteborg, SWEDEN
grosse@chalmers.se
Python/casADi Code:
An MHE Scheme for Freeway Traffic Incident Detection
Requires the Python... | gpl-2.0 |
natasasdj/OpenWPM | analysis_redirect/word_cloud-master/test/test_wordcloud_cli.py | 1 | 4564 | import argparse
import os
from collections import namedtuple
from tempfile import NamedTemporaryFile
import wordcloud as wc
from wordcloud import wordcloud_cli as cli
from mock import patch
from nose.tools import assert_equal, assert_greater, assert_true, assert_in, assert_not_in
import matplotlib
matplotlib.use('Agg... | gpl-3.0 |
jenfly/python-practice | basemap-tutorial/code_examples/utilities/transform_vector.py | 3 | 1055 | from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from osgeo import gdal
import numpy as np
map = Basemap(projection='sinu',
lat_0=0, lon_0=0)
lons = np.linspace(-180, 180, 8)
lats = np.linspace(-90, 90, 8)
v10 = np.ones((lons.shape)) * 15
u10 = np.zeros((lons.shape))
u10, v10 ... | mit |
interrogator/corpkit | corpkit/env.py | 1 | 91557 | """
A corpkit interpreter, with natural language commands.
todo:
* documentation
* handling of kwargs tuples etc
* checking for bugs, tests
* merge entries with name
"""
from __future__ import print_function
help_text = "\nThis is a dedicated interpreter for corpkit, a tool for creating, searching\n" \
... | mit |
daviddiazvico/keras | tests/keras/wrappers/test_scikit_learn.py | 1 | 4581 | import pytest
import numpy as np
from keras.utils.test_utils import get_test_data
from keras.utils import np_utils
from keras import backend as K
from keras.models import Sequential
from keras.layers.core import Dense, Activation
from keras.wrappers.scikit_learn import KerasClassifier, KerasRegressor
np.random.seed(... | mit |
mcstrother/dicom-sr-qi | inquiries/operator_improvement.py | 2 | 10499 | from srqi.core import inquiry, Parse_Syngo, my_utils
import matplotlib.pyplot as plt
import numpy as np
import collections
import math
def get_procedures_helper(procs, extra_procs, min_reps):
"""Extract all the Syngo procedures that we're interested in
(i.e. all the ones that have enough repetitions ... | bsd-2-clause |
wheeler-microfluidics/pygtkhelpers | pygtkhelpers/utils.py | 1 | 9582 | # -*- coding: utf-8 -*-
"""
pygtkhelpers.utils
~~~~~~~~~~~~~~~~~~
Utilities for handling some of the wonders of PyGTK.
gproperty and gsignal are mostly taken from kiwi.utils
:copyright: 2005-2008 by pygtkhelpers Authors
:license: LGPL 2 or later (see README/COPYING/LICENSE)
"""
import string... | lgpl-3.0 |
aetilley/scikit-learn | examples/ensemble/plot_gradient_boosting_regularization.py | 355 | 2843 | """
================================
Gradient Boosting regularization
================================
Illustration of the effect of different regularization strategies
for Gradient Boosting. The example is taken from Hastie et al 2009.
The loss function used is binomial deviance. Regularization via
shrinkage (``lear... | bsd-3-clause |
qrqiuren/sms-tools | 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... | agpl-3.0 |
aminert/scikit-learn | doc/conf.py | 210 | 8446 | # -*- coding: utf-8 -*-
#
# scikit-learn documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 8 09:13:42 2010.
#
# 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.
... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.