repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
harshaneelhg/scikit-learn
sklearn/metrics/tests/test_score_objects.py
138
14048
import pickle import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regexp from sklearn.utils.testing import assert_true from sklearn.utils.testing im...
bsd-3-clause
mgraupe/acq4
acq4/pyqtgraph/widgets/MatplotlibWidget.py
30
1442
from ..Qt import QtGui, QtCore, USE_PYSIDE, USE_PYQT5 import matplotlib if not USE_PYQT5: if USE_PYSIDE: matplotlib.rcParams['backend.qt4']='PySide' from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTA...
mit
aminert/scikit-learn
sklearn/linear_model/tests/test_randomized_l1.py
214
4690
# 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
0asa/scikit-learn
sklearn/linear_model/tests/test_ridge.py
3
22131
import numpy as np import scipy.sparse as sp from scipy import linalg from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
lzamparo/SdA_reduce
utils/lle_neighbours_pipeline.py
1
4247
""" ========== ISOMAP neighbours parameter CV pipeline ========== Use a pipeline to find the best neighbourhood size parameter for ISOMAP. Adapted from: http://scikit-learn.org/stable/auto_examples/decomposition/plot_kernel_pca.html#example-decomposition-plot-kernel-pca-py http://scikit-learn.org/stable/auto...
bsd-3-clause
VigneshMohan1/spark-branch-2.3
python/pyspark/sql/session.py
21
25693
# # 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
AllenDowney/ThinkStats2
code/chap13soln.py
68
2961
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import pandas import numpy as np import thinkplot import thinkstats2 import sur...
gpl-3.0
printedheart/opennars
nars_gui/src/main/python/nef_minimal/nef_minimal.py
1
10003
# A Minimal Example of the Neural Engineering Framework # # The NEF is a method for building large-scale neural models using realistic # neurons. It is a neural compiler: you specify the high-level computations # the model needs to compute, and the properties of the neurons themselves, # and the NEF determines the ...
agpl-3.0
vishank94/vishank94.github.io
markdown_generator/publications.py
197
3887
# coding: utf-8 # # Publications markdown generator for academicpages # # Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook, with the core python code in publications.py. Run either from the `markdown_g...
mit
yyjiang/scikit-learn
examples/ensemble/plot_voting_probas.py
316
2824
""" =========================================================== Plot class probabilities calculated by the VotingClassifier =========================================================== Plot the class probabilities of the first sample in a toy dataset predicted by three different classifiers and averaged by the `VotingC...
bsd-3-clause
rtrwalker/geotecha
examples/speccon/speccon1d_vr_mimic_terzaghi_with_pumping_at_mid_depth.py
1
10319
# speccon1d_vr example (if viewing this in docs, plots are at bottom of page) # Mimic Terzaghi pervious top pervious bottom 1D vertical consolidation # by specifying a time dependent pumping at mid-depth. # A surcharge of 100kPa is applied. At mid depth a pumping vleocity is # specified to keep the pore pressure zero...
gpl-3.0
Winand/pandas
doc/sphinxext/numpydoc/plot_directive.py
89
20530
""" A special directive for generating a matplotlib plot. .. warning:: This is a hacked version of plot_directive.py from Matplotlib. It's very much subject to change! Usage ----- Can be used like this:: .. plot:: examples/example.py .. plot:: import matplotlib.pyplot as plt plt.plot...
bsd-3-clause
xzh86/scikit-learn
sklearn/feature_extraction/image.py
263
17600
""" The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to extract features from images. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Olivier Grisel # Vlad Niculae # License: BSD 3 clause fro...
bsd-3-clause
jeffmkw/DAT210x-Lab
Module4/assignment2_helper.py
1
3825
import math import pandas as pd from sklearn import preprocessing # A Note on SKLearn .transform() calls: # # Any time you transform your data, you lose the column header names. # This actually makes complete sense. There are essentially two types # of transformations, those that change the scale of your features, # ...
mit
Myasuka/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
mhue/scikit-learn
benchmarks/bench_glm.py
297
1493
""" A comparison of different methods in GLM Data comes from a random square matrix. """ from datetime import datetime import numpy as np from sklearn import linear_model from sklearn.utils.bench import total_seconds if __name__ == '__main__': import pylab as pl n_iter = 40 time_ridge = np.empty(n_it...
bsd-3-clause
winklerand/pandas
pandas/core/indexes/datetimes.py
1
82224
# pylint: disable=E1101 from __future__ import division import operator import warnings from datetime import time, datetime, timedelta import numpy as np from pytz import utc from pandas.core.base import _shared_docs from pandas.core.dtypes.common import ( _NS_DTYPE, _INT64_DTYPE, is_object_dtype, is_datetim...
bsd-3-clause
btabibian/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
3
5427
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import itertools import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing impor...
bsd-3-clause
abhishekkrthakur/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
ChanderG/scikit-learn
sklearn/tests/test_cross_validation.py
70
41943
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy import stats from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn...
bsd-3-clause
Mutos/SoC-Test-001
utils/heatsim/heatsim.py
20
7285
#!/usr/bin/env python ####################################################### # # SIM CODE # ####################################################### # Imports from frange import * import math import matplotlib.pyplot as plt def clamp( a, b, x ): return min( b, max( a, x ) ) class heatsim: def __ini...
gpl-3.0
jangorecki/h2o-3
h2o-py/tests/testdir_misc/pyunit_export_file.py
6
1657
from __future__ import print_function from builtins import range import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.estimators.glm import H2OGeneralizedLinearEstimator import string import random import pandas as pd from pandas.util.testing import assert_frame_equal ''' Export...
apache-2.0
FNCS/ns-3.26
src/core/examples/sample-rng-plot.py
188
1246
# -*- Mode:Python; -*- # /* # * This program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License version 2 as # * published by the Free Software Foundation # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRA...
gpl-2.0
balazssimon/ml-playground
udemy/lazyprogrammer/deep-reinforcement-learning-python/atari/dqn_theano.py
1
10655
# https://deeplearningcourses.com/c/deep-reinforcement-learning-in-python # https://www.udemy.com/deep-reinforcement-learning-in-python from __future__ import print_function, division from builtins import range # Note: you may need to update your version of future # sudo pip install -U future import copy import gym im...
apache-2.0
alephu5/Soundbyte
environment/lib/python3.3/site-packages/matplotlib/backend_bases.py
1
106921
""" Abstract base classes define the primitives that renderers and graphics contexts must implement to serve as a matplotlib backend :class:`RendererBase` An abstract base class to handle drawing/rendering operations. :class:`FigureCanvasBase` The abstraction layer that separates the :class:`matplotlib.fi...
gpl-3.0
Sentient07/scikit-learn
examples/calibration/plot_calibration_curve.py
113
5904
""" ============================== Probability Calibration curves ============================== When performing classification one often wants to predict not only the class label, but also the associated probability. This probability gives some kind of confidence on the prediction. This example demonstrates how to di...
bsd-3-clause
MadsJensen/biomeg_class
classification.py
1
1551
import xgboost as xgb import numpy as np import mne from sklearn.cross_validation import StratifiedShuffleSplit, cross_val_score from sklearn.grid_search import GridSearchCV from sklearn.ensemble import AdaBoostClassifier from sklearn.externals import joblib from my_settings import * subject = 1 epochs = mne.read_e...
bsd-3-clause
arvidfm/masters-thesis
src/utils.py
1
23811
# Copyright (C) 2016 Arvid Fahlström Myrman # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distr...
gpl-2.0
jor-/scipy
scipy/ndimage/fourier.py
15
11266
# Copyright (C) 2003-2005 Peter J. Verveer # # 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 list of conditions and the following d...
bsd-3-clause
josephmfaulkner/stoqs
stoqs/loaders/CANON/realtime/Contour.py
1
39846
#!/usr/bin/env python __author__ = 'D.Cline' __version__ = '$Revision: $'.split()[1] __date__ = '$Date: $'.split()[1] __copyright__ = '2011' __license__ = 'GPL v3' __contact__ = 'dcline at mbari.org' __doc__ = ''' Creates still and animated contour and dot plots plots from MBARI LRAUV data D Cline MBARI 25 Se...
gpl-3.0
bthirion/scikit-learn
examples/gaussian_process/plot_gpr_noisy.py
104
3778
""" ============================================================= Gaussian process regression (GPR) with noise-level estimation ============================================================= This example illustrates that GPR with a sum-kernel including a WhiteKernel can estimate the noise level of data. An illustration...
bsd-3-clause
m4rx9/rna-pdb-tools
rna_tools/tools/clarna_play/ClaRNAlib/doublet-params.py
2
14757
#!/usr/bin/env python # import re import sys import itertools import multiprocessing import random from optparse import OptionParser import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt import scipy as scipy import numpy as np import scipy.cluster.hierarchy as sch from utils import * from distanc...
mit
dpshelio/astropy-helpers
astropy_helpers/tests/test_setup_helpers.py
1
13827
import os import sys import stat import shutil import importlib import contextlib import pytest from textwrap import dedent from setuptools import Distribution from ..setup_helpers import get_package_info, register_commands from ..commands import build_ext from . import reset_setup_helpers, reset_distutils_log # ...
bsd-3-clause
justincely/rolodex
cos_monitoring/dark/plotting.py
1
15970
""" Make darkrate plots """ from __future__ import absolute_import, division import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter import scipy from scipy.ndimage.filters import convolve import numpy as np import math import os from ..utils import r...
bsd-3-clause
luchko/latticegraph_designer
latticegraph_designer/app/mpl_pane.py
1
32631
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 9 18:13:18 2017 @author: Ivan Luchko (luchko.ivan@gmail.com) This module contains the definition of the matplotlib manipulation pane. class Arrow3D(FancyArrowPatch): class Annotation3D(Annotation): class GraphEdgesEditor(object): ...
mit
siutanwong/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
256
2406
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
psiq/gdsfactory
pp/pixelate.py
1
4481
import itertools as it import numpy as np from pp.geo_utils import polygon_grow DEG2RAD = np.pi / 180 RAD2DEG = 1.0 / DEG2RAD # from matplotlib import pyplot as plt def pixelate_path( pts, pixel_size=0.55, snap_res=0.05, middle_offset=0.5, theta_start=0, theta_end=90 ): """ From a path, add one pixel per...
mit
aspera1631/TweetScore
prob_weights.py
1
1505
__author__ = 'bdeutsch' import numpy as np import pandas as pd import MySQLdb def sql_to_df(database, table): con = MySQLdb.connect(host='localhost', user='root', passwd='', db=database) df = pd.read_sql_query("select * from %s" % table, con, index_col=None, coerce_float=True, params=None, parse_dates=None,...
mit
dingocuster/scikit-learn
examples/svm/plot_rbf_parameters.py
132
8096
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radial Basis Function (RBF) kernel SVM. Intuitively, the ``gamma`` parameter defines how far the influence of a single training example reaches, with low values meaning 'far' a...
bsd-3-clause
etkirsch/scikit-learn
sklearn/utils/random.py
234
10510
# Author: Hamzeh Alsalhi <ha258@cornell.edu> # # License: BSD 3 clause from __future__ import division import numpy as np import scipy.sparse as sp import operator import array from sklearn.utils import check_random_state from sklearn.utils.fixes import astype from ._random import sample_without_replacement __all__ =...
bsd-3-clause
rahul003/mxnet
example/gluon/dcgan.py
7
8812
# 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
trnet4334/img_colorization
landscape_colorizer/colorization_concate_pretrained_conv_layers.py
1
7895
from keras.models import Sequential, model_from_json from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape from keras.layers import Merge from keras.layers.convolutional import Convolution2D, MaxPooling2D,Conv2D from keras.utils import np_utils from keras.layers.normalization import BatchNormalizat...
mit
mclaughlin6464/pylearn2
pylearn2/optimization/test_batch_gradient_descent.py
44
6402
from __future__ import print_function from pylearn2.optimization.batch_gradient_descent import BatchGradientDescent import theano.tensor as T from pylearn2.utils import sharedX import numpy as np from theano.compat.six.moves import xrange from theano import config from theano.printing import min_informative_str def t...
bsd-3-clause
samueljackson92/tsp-solver
results/ipython_log.py
1
9972
# IPython log file get_ipython().magic(u'logstart') get_ipython().magic(u'matplotlib inline') import numpy as np import pandas as pd import matplotlib.pyplot as plt from tspsolver.tsp_generator import TSPGenerator from tspsolver.ga.simulator import Simulator from tspsolver.tuning import GeneticAlgorithmParameterEstim...
mit
perryjohnson/biplaneblade
biplane_blade_lib/layer_plane_angles_stn18.py
1
9219
"""Determine the layer plane angle of all the elements in a grid. Author: Perry Roth-Johnson Last modified: April 30, 2014 Usage: 1. Look through the mesh_stnXX.abq file and find all the element set names. (Find all the lines that start with "*ELSET".) 2. Enter each of the element set names in one of the f...
gpl-3.0
JPalmerio/GRB_population_code
grbpop/basic_example.py
1
1760
from cosmology import init_cosmology from GRB_population import create_GRB_population_from import io_grb_pop as io import numpy as np import logging import sys log = logging.getLogger(__name__) logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(asctime)s.%(msecs)03d [%(levelname)s...
gpl-3.0
facom/AstrodynTools
tides/animation-test.py
1
1276
""" See this interesting tutorial: http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial More examples at: http://matplotlib.org/1.3.1/examples/animation/index.html """ from util import * import numpy as np import matplotlib.animation as animation from matplotlib.pyplot import * #####################...
gpl-2.0
q1ang/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
157
13799
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import assert_array_almost_equal, assert_array_equal from sklearn.datasets import make_classification from sklearn.utils.sparsefuncs import (mean_variance_axis, inplace_column_scale, ...
bsd-3-clause
RomainBrault/scikit-learn
examples/linear_model/plot_logistic.py
73
1568
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic function ========================================================= Shown in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or tw...
bsd-3-clause
antiface/mne-python
mne/io/edf/tests/test_edf.py
6
10037
"""Data Equivalence Tests""" from __future__ import print_function # Authors: Teon Brooks <teon.brooks@gmail.com> # Martin Billinger <martin.billinger@tugraz.at> # Alan Leggitt <alan.leggitt@ucsf.edu> # Alexandre Barachant <alexandre.barachant@gmail.com> # # License: BSD (3-clause) import o...
bsd-3-clause
pnedunuri/scikit-learn
examples/mixture/plot_gmm_selection.py
248
3223
""" ================================= Gaussian Mixture Model Selection ================================= This example shows that model selection can be performed with Gaussian Mixture Models using information-theoretic criteria (BIC). Model selection concerns both the covariance type and the number of components in th...
bsd-3-clause
qiu997018209/MachineLearning
CSDN唐宇迪培训项目实战/机器学习之泰坦尼克号获救预测项目实战/机器学习之泰坦尼克号获救预测项目实战.py
1
8971
# coding: utf-8 # In[5]: import pandas titanic = pandas.read_csv("D:\\test\\titanic_train.csv") #进行简单的统计学分析 print titanic.describe()#std代表方差,Age中存在缺失值 # In[6]: #以下操作为对数据进行预处理 #算法大多是矩阵运算,不能存在缺失值,用均值来填充缺失值 titanic["Age"] = titanic["Age"].fillna(titanic["Age"].median()) print titanic.describe()#std代表方差,Age中存在缺失值 #...
apache-2.0
dettanym/Complex-Networks-Node-Removal
ERgraph_random_removal.py
1
3095
#!/usr/bin/python import igraph, random, bisect import matplotlib.pyplot as plt trials = 100 N = 1000 p = 0.01 # ( as p >= 1/(n-1), the graph will have a giant component initially) division=100 # No. of divisions of the occupation probability scale # Limits to vary the occupation probability within upper_limit=divis...
mit
mattjj/pyhawkes
examples/inference/svi_demo.py
2
8788
import numpy as np import os import cPickle import gzip # np.seterr(all='raise') import matplotlib.pyplot as plt from sklearn.metrics import adjusted_mutual_info_score, \ adjusted_rand_score, roc_auc_score from pyhawkes.models import \ DiscreteTimeNetworkHawkesModelGammaMixture, \ DiscreteTimeStandardHaw...
mit
neeraj-kumar/nkpylib
nkplotutils.py
1
4169
"""Lots of useful matplotlib utilities, written by Neeraj Kumar. Licensed under the 3-clause BSD License: Copyright (c) 2010, Neeraj Kumar (neerajkumar.org) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...
bsd-3-clause
crichardson17/starburst_atlas
Low_resolution_sims/Dusty_LowRes/Padova_cont/padova_cont_5/fullgrid/UV1.py
31
9315
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
kayarre/Tools
womersley/womersley/components.py
1
39174
import os import numpy as np import womersley.utils import scipy.special as special import matplotlib.pyplot as plt #import womersley.components class waveform_info(object): def __init__(self, dir_path, name, radius, period, kind="profile", mu=0.0035, rho=1050.0): """create instance of converted coeffic...
bsd-2-clause
18padx08/PPTex
PPTexEnv_x86_64/lib/python2.7/site-packages/matplotlib/hatch.py
10
7132
""" Contains a classes for generating hatch patterns. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import xrange import numpy as np from matplotlib.path import Path class HatchPatternBase: """ The base class for a...
mit
nrhine1/scikit-learn
sklearn/feature_extraction/text.py
110
50157
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
greytip/data-science-utils
datascienceutils/clusteringModels.py
1
3347
from bokeh.layouts import gridplot from sklearn import cluster from sklearn.neighbors import kneighbors_graph import numpy as np import pandas as pd import time # Custom utils from . import sklearnUtils as sku from . import plotter from . import utils #TODO: add a way of weakening the discovered cluster structure and...
gpl-3.0
laurent-george/bokeh
bokeh/charts/builder/tests/test_timeseries_builder.py
33
2825
""" 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
bokeh/bokeh
tests/unit/bokeh/core/property/test_container.py
1
9429
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
bsd-3-clause
AnasGhrab/scikit-learn
sklearn/metrics/tests/test_common.py
83
41144
from __future__ import division, print_function from functools import partial from itertools import product import numpy as np import scipy.sparse as sp from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import LabelBinarizer from sklearn.utils.multiclass import type_of_target fro...
bsd-3-clause
spbguru/repo1
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_fltkagg.py
69
20839
""" A backend for FLTK Copyright: Gregory Lielens, Free Field Technologies SA and John D. Hunter 2004 This code is released under the matplotlib license """ from __future__ import division import os, sys, math import fltk as Fltk from backend_agg import FigureCanvasAgg import os.path import matplotli...
gpl-3.0
xuewei4d/scikit-learn
examples/datasets/plot_random_multilabel_dataset.py
23
3379
""" ============================================== Plot randomly generated multilabel dataset ============================================== This illustrates the :func:`~sklearn.datasets.make_multilabel_classification` dataset generator. Each sample consists of counts of two features (up to 50 in total), which are dif...
bsd-3-clause
mne-tools/mne-python
tutorials/stats-sensor-space/50_cluster_between_time_freq.py
18
4878
""" ========================================================================= Non-parametric between conditions cluster statistic on single trial power ========================================================================= This script shows how to compare clusters in time-frequency power estimates between condition...
bsd-3-clause
SGenheden/Scripts
Projects/Gpcr/gpcr_plot_resjointcontacts.py
1
3408
# Author: Samuel Genheden samuel.genheden@gmail.com """ Program to plot residue joint contact probability Examples -------- gpcr_plot_rescontacts.py -f r1_md3_en_fit_joint.npz -m ohburr -l oh --mol b2 """ import os import argparse import sys import numpy as np import matplotlib if not "DISPLAY" in os.environ or os....
mit
crickert1234/ParamAP
ParamAP.py
1
51951
#!/usr/bin/env python3 ''' ParamAP.py (parametrization of sinoatrial myocyte action potentials) Copyright (C) 2018 Christian Rickert <christian.rickert@ucdenver.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the ...
gpl-2.0
Ecotrust/cogs-priorities
util/test_scenarios.py
3
6555
from django.core.management import setup_environ import os import sys sys.path.append(os.path.dirname(os.path.join('..','priorities',__file__))) import settings setup_environ(settings) #==================================# from seak.models import Scenario, ConservationFeature, PlanningUnit, Cost, PuVsCf, PuVsCost from ...
bsd-3-clause
kyleabeauchamp/HMCNotes
code/correctness/old/compare_acceptance_with_shift.py
1
1130
import lb_loader import pandas as pd import simtk.openmm.app as app import numpy as np import simtk.openmm as mm from simtk import unit as u from openmmtools import hmc_integrators, testsystems actual_timestep = 1.5 * u.femtoseconds data = [] for sysname in ["ljbox", "switchedljbox", "shiftedljbox", "shortwater", "sh...
gpl-2.0
nitish-tripathi/Simplery
ANN/Tensorflow_Tutorial/mnist.py
1
1354
import pylab import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # read data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) # show images """ img_ = mnist.train.images[1].reshape(28,28) print np.argmax(mnist.train.labe...
mit
ishank08/scikit-learn
sklearn/utils/tests/test_fixes.py
28
3156
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org> # Justin Vincent # Lars Buitinck # License: BSD 3 clause import pickle import numpy as np import math from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_true ...
bsd-3-clause
vermouthmjl/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
244
6011
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
neilslater/nn_practice
01_basic_mlp/mlp_pytorch.py
1
5143
import numpy as np import sklearn import sklearn.datasets import matplotlib.pyplot as plt import math import torch from torch import nn def get_data(): X, y = sklearn.datasets.make_moons(600, noise=0.30) y = y.reshape([600,1]) X_train = X[:400]; y_train = y[:400] X_cv = X[400:500]; y_cv = y[400:500] ...
mit
slinderman/pyhawkes
data/gifs/gif_demo.py
1
5035
import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import roc_auc_score import pyhawkes.models import imp imp.reload(pyhawkes.models) from pyhawkes.models import DiscreteTimeNetworkHawkesModelSpikeAndSlab from pyhawkes.internals.network import ErdosRenyiFixedSparsity from pyhawkes.plotting.plotti...
mit
tbtraltaa/medianshape
medianshape/experiment/median/test.py
1
11430
# encoding: utf-8 ''' 2D Median surface embedded in 3D -------------------------------- ''' from __future__ import absolute_import import importlib import os import numpy as np from scipy.spatial import Delaunay from medianshape.simplicial import pointgen3d, mesh from medianshape.simplicial.meshgen import meshgen2d, ...
gpl-3.0
wronk/mne-python
mne/viz/epochs.py
1
62947
"""Functions to plot epochs data """ # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # Jaakko Leppakangas <jaeilepp@student.jyu.f...
bsd-3-clause
hsuantien/scikit-learn
sklearn/metrics/ranking.py
75
25426
"""Metrics to assess performance on classification task given scores Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria....
bsd-3-clause
RPGOne/scikit-learn
sklearn/tests/test_discriminant_analysis.py
4
13141
import sys import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing im...
bsd-3-clause
sinhrks/scikit-learn
examples/plot_multilabel.py
236
4157
# Authors: Vlad Niculae, Mathieu Blondel # License: BSD 3 clause """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the number of labels: n ...
bsd-3-clause
vincent-noel/SigNetSim
signetsim/settings/Settings.py
2
1240
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br) # # This file is part of libSigNetSim. # # libSigNetSim 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 Fou...
agpl-3.0
zhakui/QMarkdowner
setup.py
4
14173
# -*- coding: utf-8 -*- """ 利用Python脚本从svn获取最新版本信息,然后利用py2exe进行打包,最新进行相应的清理操作 """ import os import time import glob import shutil import subprocess import sys import stat import zipfile import json from distribution import Distribution from Cheetah.Template import Template def change_package_from...
mit
arju88nair/projectCulminate
venv/lib/python3.5/site-packages/nltk/sentiment/util.py
7
31020
# coding: utf-8 # # Natural Language Toolkit: Sentiment Analyzer # # Copyright (C) 2001-2017 NLTK Project # Author: Pierpaolo Pantone <24alsecondo@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ Utility methods for Sentiment Analysis. """ from __future__ import division from copy i...
apache-2.0
DrigerG/IIITB-ML
experiments/image-analysis/mp-assignment-2/image_classification.py
1
5100
#!/usr/bin/env python """image_classification.py: Classify images to horses, bikes""" import argparse import os import cv2 import numpy as np from scipy.cluster import vq from sklearn.preprocessing import StandardScaler from sklearn.svm import LinearSVC from sklearn.neighbors import KNeighborsClassifier # Helper f...
apache-2.0
ebaste/word_cloud
doc/sphinxext/gen_rst.py
17
33207
""" Example generation for the python wordcloud project. Stolen from scikit-learn with modifications from PyStruct. Generate the rst files for the examples by iterating over the python example files. Hacked to plot every example (not only those that start with 'plot'). """ from time import time import os import shuti...
mit
jseabold/scikit-learn
sklearn/_build_utils/cythonize.py
19
5126
#!/usr/bin/env python """ cythonize Cythonize pyx files into C files as needed. Usage: cythonize [root_dir] Default [root_dir] is 'sklearn'. Checks pyx files to see if they have been changed relative to their corresponding C files. If they have, then runs cython on these files to recreate the C files. The script ...
bsd-3-clause
blink1073/scikit-image
doc/examples/features_detection/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
potash/drain
drain/exploration.py
1
10781
from tempfile import NamedTemporaryFile from pprint import pformat from itertools import product from sklearn import tree import pandas as pd from collections import Counter from six import StringIO from drain import util, step def explore(steps, reload=False): return StepFrame(index=step.load(steps, reload=rel...
mit
zfrenchee/pandas
pandas/tests/indexing/interval/test_interval_new.py
1
7320
import pytest import numpy as np import pandas as pd from pandas import Series, IntervalIndex, Interval import pandas.util.testing as tm pytestmark = pytest.mark.skip(reason="new indexing tests for issue 16316") class TestIntervalIndex(object): def setup_method(self, method): self.s = Series(np.arange...
bsd-3-clause
buguen/pylayers
pylayers/simul/examples/ex_simulem_fur.py
3
1157
from pylayers.simul.simulem import * from pylayers.signal.bsignal import * from pylayers.measures.mesuwb import * import matplotlib.pyplot as plt from pylayers.gis.layout import * #M=UWBMesure(173) M=UWBMesure(13) #M=UWBMesure(1) cir=TUsignal() cirf=TUsignal() #cir.readcir("where2cir-tx001-rx145.mat","Tx001") #cir...
lgpl-3.0
AyoubBelhadji/random_matrix_factorization
package/fast_svd.py
1
2031
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 12 11:45:41 2017 @author: ayoubbelhadji1 """ import numpy as np import matplotlib.pyplot as plt import matplotlib.pyplot from scipy.stats import chi2 import pylab as mp ### Parameters N = 1000 # Number of points d = 2 # Dimension s_n = 10 # Nu...
mit
evanl/vesa_tough_comparison
vesa/vesa_v02_13/vesa_writing_functions.py
2
13731
#Author - Evan Leister import eclipse_cells as ec import numpy as np import matplotlib.pyplot as plt class Injector(object): def __init__(self, index, x, y, ratio, layer_id, end_days, mass_rate): self.index = index self.x = x self.y = y self.ratio = ratio self.layer_id = lay...
mit
idlead/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
17
5726
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
r-mart/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
297
8265
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
justincassidy/scikit-learn
sklearn/linear_model/least_angle.py
57
49338
""" Least Angle Regression algorithm. See the documentation on the Generalized Linear Model for a complete discussion. """ from __future__ import print_function # Author: Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux # # License: BSD 3 ...
bsd-3-clause
rosswhitfield/mantid
qt/python/mantidqt/plotting/test/test_figuretype.py
3
2627
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # T...
gpl-3.0
choupi/NDHUDLWorkshop
mnist/xgboost/xg.py
1
2143
'''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility from keras.datasets im...
mit
sahat/bokeh
bokeh/protocol.py
1
3541
import json import logging import time import datetime as dt import numpy as np from six.moves import cPickle as pickle from .utils import get_ref try: import pandas as pd is_pandas = True except ImportError: is_pandas = False try: from dateutil.relativedelta import relativedelta is_dateutil = Tr...
bsd-3-clause
neutrons/FastGR
addie/processing/mantid/master_table/table_plot_handler.py
1
6631
from __future__ import (absolute_import, division, print_function) from qtpy.QtCore import Qt import os import numpy as np import glob import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cm from addie.processing.idl.sample_environment_handler import SampleEnvironmentHandler cla...
mit
rajat1994/scikit-learn
sklearn/linear_model/coordinate_descent.py
43
75144
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Gael Varoquaux <gael.varoquaux@inria.fr> # # License: BSD 3 clause import sys import warnings from abc import ABCMeta, abstractmethod import n...
bsd-3-clause