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
nrhine1/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
AnasGhrab/scikit-learn
examples/applications/plot_out_of_core_classification.py
255
13919
""" ====================================================== Out-of-core classification of text documents ====================================================== This is an example showing how scikit-learn can be used for classification using an out-of-core approach: learning from data that doesn't fit into main memory. ...
bsd-3-clause
spallavolu/scikit-learn
benchmarks/bench_plot_incremental_pca.py
374
6430
""" ======================== IncrementalPCA benchmark ======================== Benchmarks for IncrementalPCA """ import numpy as np import gc from time import time from collections import defaultdict import matplotlib.pyplot as plt from sklearn.datasets import fetch_lfw_people from sklearn.decomposition import Incre...
bsd-3-clause
heli522/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
plotly/python-api
packages/python/plotly/_plotly_utils/tests/validators/test_integer_validator.py
2
4681
# Array not ok # ------------ import pytest from pytest import approx from _plotly_utils.basevalidators import IntegerValidator import numpy as np import pandas as pd # ### Fixtures ### @pytest.fixture() def validator(): return IntegerValidator("prop", "parent") @pytest.fixture def validator_min_max(): retu...
mit
yask123/scikit-learn
sklearn/pipeline.py
61
21271
""" The :mod:`sklearn.pipeline` module implements utilities to build a composite estimator, as a chain of transforms and estimators. """ # Author: Edouard Duchesnay # Gael Varoquaux # Virgile Fritsch # Alexandre Gramfort # Lars Buitinck # Licence: BSD from collections import defaultdict...
bsd-3-clause
ralbayaty/KaggleRetina
testing/circleDetect.py
1
1170
import numpy as np import matplotlib.pyplot as plt from skimage import data, color from skimage.transform import hough_circle from skimage.feature import peak_local_max, canny from skimage.draw import circle_perimeter from skimage.util import img_as_ubyte # Load picture and detect edges image = img_as_ubyte(data.coi...
gpl-2.0
gahoo/SNAP
core/gantt.py
1
6208
import dash from dash.dependencies import Input, Output, State from core.misc import * from core import models from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy.exc import IntegrityError from collections import defaultdict import dash_core_components as dcc import dash_html_co...
mit
ahmadia/bokeh
bokeh/charts/builder/line_builder.py
43
5360
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Line class which lets you build your Line charts just passing the arguments to the Chart class and calling the proper functions. """ #-----------------------------------------------------------------...
bsd-3-clause
StepicOrg/Stepic-API
examples/external-reports/library/models.py
1
24967
import argparse import shutil import os import time import datetime import matplotlib.pyplot as plt import pandas as pd from library.api import API_HOST, get_token, fetch_objects, fetch_objects_by_pk from library.settings import ITEM_FORMAT, OPTION_FORMAT, STEP_FORMAT, STEP_STAT_FORMAT from library.utils import (html...
mit
tomlof/scikit-learn
benchmarks/bench_20newsgroups.py
377
3555
from __future__ import print_function, division from time import time import argparse import numpy as np from sklearn.dummy import DummyClassifier from sklearn.datasets import fetch_20newsgroups_vectorized from sklearn.metrics import accuracy_score from sklearn.utils.validation import check_array from sklearn.ensemb...
bsd-3-clause
sfepy/sfepy
sfepy/discrete/iga/plot_nurbs.py
5
6344
from __future__ import absolute_import import numpy as nm import matplotlib.pyplot as plt from sfepy.discrete.fem.geometry_element import GeometryElement from sfepy.mesh.mesh_generators import get_tensor_product_conn import sfepy.postprocess.plot_dofs as pd from sfepy.postprocess.plot_dofs import _get_axes from sfepy...
bsd-3-clause
diana-hep/carl
carl/distributions/transforms.py
1
1770
# Carl is free software; you can redistribute it and/or modify it # under the terms of the Revised BSD License; see LICENSE file for # more details. import numpy as np from sklearn.utils import check_random_state from . import TheanoDistribution class LinearTransform(TheanoDistribution): """Apply a linear tran...
bsd-3-clause
jlegendary/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
dankessler/cogfusion
cogfusion/farmcogatlas.py
1
3055
#!/usr/bin/python """ Based on an example from https://github.com/CognitiveAtlas/cogat-python by Vanessa Sochat """ try: from cognitiveatlas.api import get_concept, get_task except: pass # EXAMPLE 1: ######################################################### # We are going to retrieve all cognitive ...
mit
viveksck/langchangetrack
langchangetrack/tsconstruction/displacements.py
1
8624
#!/usr/bin/env python # -*- coding: utf-8 -*- from argparse import ArgumentParser import os from os import path import cPickle as pickle import numpy as np import scipy import itertools from scipy.spatial.distance import cosine, euclidean, norm import pandas as pd import more_itertools from joblib import Parallel, de...
bsd-3-clause
ankurankan/scikit-learn
examples/cluster/plot_agglomerative_clustering_metrics.py
20
4491
""" Agglomerative clustering with different metrics =============================================== Demonstrates the effect of different metrics on the hierarchical clustering. The example is engineered to show the effect of the choice of different metrics. It is applied to waveforms, which can be seen as high-dimens...
bsd-3-clause
CallaJun/hackprince
indico/matplotlib/tests/test_delaunay.py
14
7090
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import xrange import warnings import numpy as np from matplotlib.testing.decorators import image_comparison, knownfailureif from matplotlib.cbook import MatplotlibDeprecationWarning ...
lgpl-3.0
yashsavani/rechorder
makeTrainingSet.py
1
3651
#!/usr/bin/python import util import chordKMeans import sys import numpy as np import matplotlib import matplotlib.pyplot as plt import pylab import random from sklearn import svm from operator import itemgetter '''This file generates a training set to be used in our SVM, consisting of a list of previous-n -> curren...
mit
knights-lab/SHOGUN
docs/shear_results_fix.py
2
2157
# usage: python me.py \ # alignment.burst.otu.txt db.tax sheared_bayes.txt import os import sys import csv import pandas as pd import numpy as np from scipy.sparse import csr_matrix with open(sys.argv[1], 'r') as inf: csv_inf = csv.reader(inf, delimiter="\t") columns = next(csv_inf) columns = dict(zip(co...
agpl-3.0
BorisJeremic/Real-ESSI-Examples
analytic_solution/test_cases/Contact/Stress_Based_Contact_Verification/HardContact_NonLinHardSoftShear/Normal_Load/Sigma_n_1/Normal_Stress_Plot.py
72
2800
#!/usr/bin/python import h5py import matplotlib.pylab as plt import matplotlib as mpl import sys import numpy as np; import matplotlib; import math; from matplotlib.ticker import MaxNLocator plt.rcParams.update({'font.size': 28}) # set tick width mpl.rcParams['xtick.major.size'] = 10 mpl.rcParams['xtick.major.width']...
cc0-1.0
mahak/spark
python/pyspark/pandas/tests/plot/test_frame_plot.py
15
4733
# # 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
smartkit/COVITAS
V1.0_ngix:apache_mosquitto_RESTful_Solr_LIRE/octo-ninja/rest-pandas/OctoNinja/app/views.py
1
1324
# views.py from rest_pandas import PandasView from .models import TimeSeries class TimeSeriesView(PandasView): model = TimeSeries # In response to get(), the underlying Django REST Framework ListAPIView # will load the default queryset (self.model.objects.all()) and then pass # it to the following func...
unlicense
bhillmann/gingivere
tests/test_lr.py
2
1117
from sklearn.linear_model import LinearRegression from sklearn.cross_validation import StratifiedKFold import numpy as np from sklearn.metrics import classification_report from sklearn.metrics import roc_auc_score from tests import shelve_api XX, yy = shelve_api.load('lr') X = XX[2700:] y = yy[2700:] clf = LinearRe...
mit
tosolveit/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
equialgo/scikit-learn
sklearn/datasets/__init__.py
5
3683
""" 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_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
bsd-3-clause
NunoEdgarGub1/scikit-learn
examples/datasets/plot_random_dataset.py
348
2254
""" ============================================== Plot randomly generated classification dataset ============================================== Plot several randomly generated 2D classification datasets. This example illustrates the :func:`datasets.make_classification` :func:`datasets.make_blobs` and :func:`datasets....
bsd-3-clause
COSMOGRAIL/COSMOULINE
pipe/5_pymcs_psf_scripts/6b_handcheck_psf_NU.py
1
7562
from Tkinter import * from tkMessageBox import * #~ try: #~ import ImageTk #~ import Image #~ except: from PIL import ImageTk from PIL import Image execfile("../config.py") from kirbybase import KirbyBase, KBError from variousfct import * from readandreplace_fct import * # import matplotlib.pyplot as pl...
gpl-3.0
mblondel/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
7
6830
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # Licence: BSD 3 clause from nose.tools import raises from nose.tools import assert_true import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process ...
bsd-3-clause
rspavel/spack
var/spack/repos/builtin/packages/py-seaborn/package.py
5
1184
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PySeaborn(PythonPackage): """Seaborn: statistical data visualization. Seaborn is a li...
lgpl-2.1
KennethPierce/pylearnk
pylearn2/optimization/test_batch_gradient_descent.py
5
6290
from pylearn2.optimization.batch_gradient_descent import BatchGradientDescent import theano.tensor as T from pylearn2.utils import sharedX import numpy as np from theano import config from theano.printing import min_informative_str def test_batch_gradient_descent(): """ Verify that batch gradient descent works...
bsd-3-clause
zackriegman/pydnn
examples/plankton/plankton.py
1
11695
__author__ = 'isaac' from pydnn import neuralnet as nn from pydnn import preprocess as pp from pydnn import tools from pydnn import data from pydnn import img_util import numpy as np import pandas as pd from scipy.misc import imread import os from os.path import join import time config = tools.load_config('PLANKTON...
mit
fspaolo/scikit-learn
sklearn/utils/tests/test_random.py
20
3872
from __future__ import division import numpy as np from scipy.misc import comb as combinations from sklearn.utils.random import sample_without_replacement from sklearn.utils.testing import ( assert_raises, assert_equal, assert_true) ######################################################################...
bsd-3-clause
RayMick/scikit-learn
sklearn/cluster/tests/test_k_means.py
63
26190
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
winklerand/pandas
pandas/tests/frame/test_to_csv.py
1
45142
# -*- 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.core.common import _all_none from pandas.errors import ParserError from pandas import (DataFrame, Index, Series, Mu...
bsd-3-clause
rs2/pandas
pandas/tests/frame/test_combine_concat.py
2
8607
from datetime import datetime import numpy as np import pytest import pandas as pd from pandas import DataFrame, Index, Series, Timestamp, date_range import pandas._testing as tm class TestDataFrameConcat: def test_concat_multiple_frames_dtypes(self): # GH 2759 A = DataFrame(data=np.ones((10, 2...
bsd-3-clause
wbinventor/openmc
openmc/data/photon.py
1
43051
from collections import OrderedDict from collections.abc import Mapping, Callable from copy import deepcopy from io import StringIO from numbers import Integral, Real import os import h5py import numpy as np import pandas as pd from scipy.interpolate import CubicSpline from openmc.mixin import EqualityMixin import op...
mit
ankurankan/scikit-learn
examples/applications/topics_extraction_with_nmf.py
106
2313
""" ======================================================== Topics extraction with Non-Negative Matrix Factorization ======================================================== This is a proof of concept application of Non Negative Matrix Factorization of the term frequency matrix of a corpus of documents so as to extra...
bsd-3-clause
glauffer/Conditional-Entropy
old_CE.py
1
2699
################################################################################ # # # Program to calculate the Conditional Entropy for a single pulsating star # # This program calculates and saves a file with periods and entropies # # To run: type in terminal -> python3 CE.py # # ...
gpl-2.0
michaelbramwell/sms-tools
lectures/04-STFT/plots-code/time-freq-compromise.py
19
1255
import numpy as np import time, os, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import stft as STFT import utilFunctions as UF import matplotlib.pyplot as plt from scipy.signal import hamming from scipy.fftpack import fft import math (fs, x) = UF.wavrea...
agpl-3.0
iulian787/spack
var/spack/repos/builtin/packages/py-inference-schema/package.py
3
1603
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyInferenceSchema(Package): """This package is intended to provide a uniform schema for common machine lear...
lgpl-2.1
gcarq/freqtrade
tests/strategy/test_strategy_helpers.py
1
3034
import numpy as np import pandas as pd from freqtrade.strategy import merge_informative_pair, timeframe_to_minutes def generate_test_data(timeframe: str, size: int): np.random.seed(42) tf_mins = timeframe_to_minutes(timeframe) base = np.random.normal(20, 2, size=size) date = pd.period_range('2020-0...
gpl-3.0
seckcoder/lang-learn
python/sklearn/sklearn/feature_selection/tests/test_rfe.py
4
3061
""" Testing Recursive feature elimination """ import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_equal from scipy import sparse from sklearn.feature_selection.rfe import RFE, RFECV from sklearn.datasets import load_iris from sklearn.metrics import ...
unlicense
bsipocz/bokeh
bokeh/charts/builder/tests/test_bar_builder.py
33
6390
""" This is the Bokeh charts testing interface. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with thi...
bsd-3-clause
pratapvardhan/scikit-learn
sklearn/cross_decomposition/cca_.py
151
3192
from .pls_ import _PLS __all__ = ['CCA'] class CCA(_PLS): """CCA Canonical Correlation Analysis. CCA inherits from PLS with mode="B" and deflation_mode="canonical". Read more in the :ref:`User Guide <cross_decomposition>`. Parameters ---------- n_components : int, (default 2). numb...
bsd-3-clause
dilawar/moogli
moogli/visualization/plots/line.py
2
9350
from moogli import constants from moogli.visualization.pipeline import SimulationDataConsumer from PyQt4.QtGui import QWidget from PyQt4.QtGui import QMenu from PyQt4.QtGui import QAction from PyQt4.QtGui import QGridLayout from PyQt4.QtCore import pyqtSlot from PyQt4 import QtCore from matplotlib.lines import Line2D f...
gpl-2.0
ThomasSweijen/yadesolute2
py/post2d.py
4
13849
# encoding: utf-8 # 2009 © Václav Šmilauer <eudoxos@arcig.cz> """ Module for 2d postprocessing, containing classes to project points from 3d to 2d in various ways, providing basic but flexible framework for extracting arbitrary scalar values from bodies/interactions and plotting the results. There are 2 basic component...
gpl-2.0
spallavolu/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
348
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
anaruse/chainer
chainer/training/extensions/plot_report.py
4
6421
import json from os import path import warnings import numpy import six from chainer import reporter from chainer import serializer as serializer_module from chainer.training import extension from chainer.training import trigger as trigger_module try: import matplotlib # NOQA _available = True except (Im...
mit
sguthrie/predicting-depression
scripts/find_subjects_behavior_data.py
1
4298
""" """ import csv import re import sys import argparse import numpy as np import matplotlib.pyplot as plt def check_valid_value(key, val): if key == "participant_id": if re.match(r'sub-[0-9]{6}', val) is None: return False return True # "else" statements not necessary because fun...
gpl-3.0
florian-f/sklearn
sklearn/cluster/setup.py
10
1202
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD Style. import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration cblas_libs, blas_info = ge...
bsd-3-clause
dingocuster/scikit-learn
sklearn/datasets/species_distributions.py
198
7923
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
kpolimis/kpolimis.github.io-src
content/downloads/code/utils.py
1
2245
import os import sys import glob import json import time import fiona import datetime import warnings import numpy as np import pandas as pd import matplotlib.pyplot as plt from IPython.display import Image from shapely.prepared import prep from descartes import PolygonPatch from shapely.geometry import Polygon from mp...
gpl-3.0
mendax-grip/cfdemUtilities
vonKarmanSingh/fftMultiple.py
2
4375
# This program analyses the X and Y drag coefficient (drag and lift) from the cylinder immersed # boundary test cases # It can be compared visually afterward to experimental data # Currently is not generic and can only load 2 data set, but anyway more makes it an unreadable mess # # USAGE : python ./FOLDERWHEREDATA-1...
lgpl-3.0
QISKit/qiskit-sdk-py
test/python/visualization/test_circuit_matplotlib_drawer.py
1
6355
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
apache-2.0
nkmk/python-snippets
notebook/pandas_to_csv.py
1
1404
import pandas as pd df = pd.read_csv('data/src/sample_pandas_normal.csv', index_col=0) print(df) # age state point # name # Alice 24 NY 64 # Bob 42 CA 92 # Charlie 18 CA 70 # Dave 68 TX 70 # Ellen 24 CA 88 # Frank 30 NY ...
mit
khyrulimam/pemrograman-linear-optimasi-gizi-anak-kos
nutrisi.py
1
1544
import numpy as np import pulp import seaborn as sns from matplotlib import pyplot as plt from matplotlib.patches import PathPatch from matplotlib.path import Path import solver bayam = 'bayam' tempe = 'tempe' problem_name = 'Optimasi Gizi Anak Kos' # decision variables (variabel keputusan) x = pulp.LpVariable(bayam...
apache-2.0
SanPen/GridCal
src/GridCal/Gui/GuiFunctions.py
1
37446
# This file is part of GridCal. # # GridCal 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 of the License, or # (at your option) any later version. # # GridCal is distributed in the hope that...
gpl-3.0
subutai/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/lines.py
69
48233
""" This module contains all the 2D line class which can draw with a variety of line styles, markers and colors. """ # TODO: expose cap and join style attrs from __future__ import division import numpy as np from numpy import ma from matplotlib import verbose import artist from artist import Artist from cbook import ...
agpl-3.0
seanli9jan/tensorflow
tensorflow/python/kernel_tests/constant_op_eager_test.py
33
21448
# Copyright 2015 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
erykoff/redmapper
tests/test_centeringcal.py
1
2880
import matplotlib matplotlib.use('Agg') import unittest import os import shutil import numpy.testing as testing import numpy as np import fitsio import tempfile from numpy import random from redmapper.configuration import Configuration from redmapper.calibration import WcenCalibrator class CenteringCalibratorTestCas...
apache-2.0
ajrichards/notebook
deep-learning/draw_simple_nn.py
2
3075
#!/usr/bin/env python import matplotlib.pyplot as plt import matplotlib.patches as mpatches def draw_neural_net(ax, left, right, bottom, top, layer_sizes): ''' Draw a neural network cartoon using matplotilb. :usage: >>> fig = plt.figure(figsize=(12, 12)) >>> draw_neural_net(fig.gca(),...
bsd-3-clause
callmewillig/NetViz
Interface/interface.py
1
6173
"""" interface.py This program will create a user interface with the capablilities to choose an address and gain various information based on that address. libraries(sudo aot-get install...) python3-pyqt5(PyQt5) matplotlib Authors Tommy Slota Mathew Willig Nicholas Miller """ #-----impo...
mit
victorbergelin/scikit-learn
examples/decomposition/plot_sparse_coding.py
247
3846
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
xzh86/scikit-learn
sklearn/metrics/__init__.py
214
3440
""" The :mod:`sklearn.metrics` module includes score functions, performance metrics and pairwise metrics and distance computations. """ from .ranking import auc from .ranking import average_precision_score from .ranking import coverage_error from .ranking import label_ranking_average_precision_score from .ranking imp...
bsd-3-clause
navoj/ecell4
ecell4/egfrd/legacy/samples/hardbody/plot.py
6
3594
#!/usr/bin/env/python import sys import numpy import scipy.io from matplotlib.pylab import * N_A = 6.0221367e23 def plot_data(N, T, fmt): T = numpy.array(T) mean = T.mean(1) std_err = T.std()/math.sqrt(len(T)) #errorbar(N, mean, yerr=std_err, fmt=fmt) print N, mean loglog(N, mean, fmt) ...
gpl-2.0
jrleeman/MetPy
setup.py
1
3270
# Copyright (c) 2008,2010,2015,2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Setup script for installing MetPy.""" from __future__ import print_function from setuptools import find_packages, setup import versioneer ver = versioneer.get_ve...
bsd-3-clause
dnet/proxmark3
fpga/tests/plot_edgedetect.py
14
1553
#!/usr/bin/env python #----------------------------------------------------------------------------- # Copyright (C) 2014 iZsh <izsh at fail0verflow.com> # # This code is licensed to you under the terms of the GNU GPL, version 2 or, # at your option, any later version. See the LICENSE.txt file for the text of # the lic...
gpl-2.0
PhilReinhold/pyqt_utils
plot_widgets.py
1
16851
from PyQt4 import QtGui, QtCore import warnings import numpy as np import pyqtgraph as pg pg.setConfigOption("useWeave", False) from pyqtgraph.dockarea import Dock, DockArea from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QTAgg class CrosshairPlo...
mit
clemkoa/scikit-learn
examples/ensemble/plot_adaboost_twoclass.py
72
3333
""" ================== Two-class AdaBoost ================== This example fits an AdaBoosted decision stump on a non-linearly separable classification dataset composed of two "Gaussian quantiles" clusters (see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision boundary and decision scores. The di...
bsd-3-clause
canavandl/bokeh
bokeh/protocol.py
3
4691
from __future__ import absolute_import import json import logging import datetime as dt import calendar import decimal import numpy as np try: import pandas as pd is_pandas = True except ImportError: is_pandas = False try: from dateutil.relativedelta import relativedelta is_dateutil = True excep...
bsd-3-clause
petroolg/robo-spline
graph.py
1
6668
# Coordinated Spline Motion and Robot Control Project # # Copyright (c) 2017 Olga Petrova <olga.petrova@cvut.cz> # Advisor: Pavel Pisa <pisa@cmp.felk.cvut.cz> # FEE CTU Prague, Czech Republic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentatio...
mit
wangz19/TEST
Bone_modeling/gaussian_distribution.py
1
1866
# function is defining a gaussian distribution parameter import numpy as np import matplotlib.pyplot as plt ###--------------parameter sampleSize = 1000 #total sample point mean_E = 50. # mean value of modulus #####----------------------gaussian distribution -------------------####### mu, sigma = 0, 11. E_tem...
gpl-2.0
mehdidc/scikit-learn
sklearn/linear_model/tests/test_theil_sen.py
234
9928
""" Testing for Theil-Sen module (sklearn.linear_model.theil_sen) """ # Author: Florian Wilhelm <florian.wilhelm@gmail.com> # License: BSD 3 clause from __future__ import division, print_function, absolute_import import os import sys from contextlib import contextmanager import numpy as np from numpy.testing import ...
bsd-3-clause
imk1/IMKTFBindingCode
runRandomForestClassification.py
1
2267
def makeRandomForestClassificationInputs(positivesFileName, negativesFileName, validPositivesFileName, validNegativesFileName): # Make inputs for a random forward classifier # ASSUMES THAT FEATURES ARE SORTED IN THE SAME WAY IN ALL FILES positivesFeatureMat = np.loadtxt(positivesFileName) negativesFeatureMat = ...
mit
lheagy/simpegem
simpegEM/Utils/SrcUtils.py
2
7432
from SimPEG import * from scipy.special import ellipk, ellipe from scipy.constants import mu_0, pi def MagneticDipoleVectorPotential(srcLoc, obsLoc, component, moment=1., dipoleMoment=(0., 0., 1.), mu = mu_0): """ Calculate the vector potential of a set of magnetic dipoles at given locations 'ref. ...
mit
luca76/QGIS
python/plugins/processing/algs/qgis/VectorLayerHistogram.py
6
2835
# -*- coding: utf-8 -*- """ *************************************************************************** EquivalentNumField.py --------------------- Date : January 2013 Copyright : (C) 2013 by Victor Olaya Email : volayaf at gmail dot com *******************...
gpl-2.0
YinongLong/scikit-learn
sklearn/cross_validation.py
11
69870
""" The :mod:`sklearn.cross_validation` module includes utilities for cross- validation and performance evaluation. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause fro...
bsd-3-clause
pechersky/keras-molecules
download_dataset.py
2
2215
import os import argparse import urllib import pandas import tempfile from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed DEFAULTS = { "chembl22": { "uri": "ftp://ftp.ebi.ac.uk/pub/databases/chembl/ChEMBLdb/latest/chembl_22_chemreps.txt.gz", "outfile": "data/chembl22.h5" ...
mit
jkthompson/nupic
examples/opf/tools/sp_plotter.py
8
15763
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions...
gpl-3.0
satishgoda/bokeh
bokeh/sampledata/gapminder.py
41
2655
from __future__ import absolute_import import pandas as pd from os.path import join import sys from . import _data_dir ''' This module provides a pandas DataFrame instance of four of the datasets from gapminder.org. These are read in from csvs that have been downloaded from Bokeh's sample data on S3. But the origina...
bsd-3-clause
wibeasley/PyCap
test/test_project.py
3
11950
#! /usr/bin/env python import unittest from redcap import Project, RedcapError skip_pd = False try: import pandas as pd except ImportError: skip_pd = True class ProjectTests(unittest.TestCase): """docstring for ProjectTests""" url = 'https://redcap.vanderbilt.edu/api/' bad_url = 'https://redcap...
mit
ChinaQuants/bokeh
examples/plotting/file/elements.py
43
1485
import pandas as pd from bokeh.plotting import figure, show, output_file from bokeh.sampledata import periodic_table elements = periodic_table.elements elements = elements[elements["atomic number"] <= 82] elements = elements[~pd.isnull(elements["melting point"])] mass = [float(x.strip("[]")) for x in elements["atomic...
bsd-3-clause
pianomania/scikit-learn
sklearn/cluster/mean_shift_.py
42
15514
"""Mean shift clustering algorithm. Mean shift clustering aims to discover *blobs* in a smooth density of samples. It is a centroid based algorithm, which works by updating candidates for centroids to be the mean of the points within a given region. These candidates are then filtered in a post-processing stage to elim...
bsd-3-clause
eramirem/astroML
book_figures/chapter6/fig_kmeans_metallicity.py
3
3200
""" EM example: K-means ------------------- Figure 6.13 The K-means analysis of the stellar metallicity data used in figure 6.6. Note how the background distribution "pulls" the cluster centers away from the locus where one would place them by eye. This is why more sophisticated models like GMM are often better in pra...
bsd-2-clause
backtou/longlab
gr-digital/examples/example_fll.py
17
4821
#!/usr/bin/env python from gnuradio import gr, digital from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser try: import scipy except ImportError: print "Error: could not import scipy (http://www.scipy.org/)" sys.exit(1) try: import pylab excep...
gpl-3.0
xzh86/scikit-learn
sklearn/metrics/cluster/__init__.py
312
1322
""" The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation: - supervised, which uses a ground truth class values for each sample. - unsupervised, which does not and measures the 'quality' of the model itself. """ from .supervised import ...
bsd-3-clause
winklerand/pandas
pandas/tests/io/msgpack/test_pack.py
9
4922
# coding: utf-8 import pytest import struct from pandas import compat from pandas.compat import u, OrderedDict from pandas.io.msgpack import packb, unpackb, Unpacker, Packer class TestPack(object): def check(self, data, use_list=False): re = unpackb(packb(data), use_list=use_list) assert re ==...
bsd-3-clause
alvarofierroclavero/scikit-learn
sklearn/naive_bayes.py
128
28358
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
goodfeli/pylearn2
pylearn2/train_extensions/live_monitoring.py
13
11530
""" Training extension for allowing querying of monitoring values while an experiment executes. """ __authors__ = "Dustin Webb" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["Dustin Webb"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ = "pylearn-dev@googlegroups" imp...
bsd-3-clause
fbagirov/scikit-learn
examples/applications/face_recognition.py
191
5513
""" =================================================== Faces recognition example using eigenfaces and SVMs =================================================== The dataset used in this example is a preprocessed excerpt of the "Labeled Faces in the Wild", aka LFW_: http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2...
bsd-3-clause
rishikksh20/scikit-learn
examples/manifold/plot_compare_methods.py
52
3878
""" ========================================= Comparison of Manifold Learning methods ========================================= An illustration of dimensionality reduction on the S-curve dataset with various manifold learning methods. For a discussion and comparison of these algorithms, see the :ref:`manifold module...
bsd-3-clause
shnizzedy/SM_openSMILE
openSMILE_preprocessing/arff_csv_to_pandas.py
1
6508
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ arff_csv_to_pandas.py Functions to import openSMILE outputs to Python pandas. Authors: – Jon Clucas, 2016 (jon.clucas@childmind.org) – Arno Klein, 2016 (arno.klein@childmind.org) – Bonhwang Koo, 2016 (bonhwang.koo@childmind.org) © 2016, Child Mind Instit...
apache-2.0
blaze/dask
dask/tests/test_distributed.py
3
5475
import pytest distributed = pytest.importorskip("distributed") import asyncio from functools import partial from operator import add from tornado import gen import dask from dask import persist, delayed, compute from dask.delayed import Delayed from dask.utils import tmpdir, get_named_args from distributed import f...
bsd-3-clause
nicholasmalaya/arcanus
disputatio/routines/vanes/bottom.py
2
4039
#!/bin/py # # interpolate over data field for bottom vanes # # # import numpy as np import matplotlib matplotlib.use('Agg') import itertools import matplotlib.pyplot as plt from scipy import integrate from scipy.integrate import ode radprime=3.0 radmin=0.6 def vf(t,x): # # Vector field function # the...
mit
secimTools/SECIMTools
src/scripts/secimtools/anovaModules/volcano.py
2
2710
#Add-on packages import matplotlib matplotlib.use('Agg') import numpy as np import pandas as pd from matplotlib.backends.backend_pdf import PdfPages # Plotting packages from secimtools.visualManager import module_box as box from secimtools.visualManager import module_hist as hist from secimtools.visualManager import m...
mit
simon-pepin/scikit-learn
sklearn/tests/test_kernel_ridge.py
342
3027
import numpy as np import scipy.sparse as sp from sklearn.datasets import make_regression from sklearn.linear_model import Ridge from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import pairwise_kernels from sklearn.utils.testing import ignore_warnings from sklearn.utils.testing import assert...
bsd-3-clause
stylianos-kampakis/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
Dapid/pywt
demo/benchmark.py
2
1911
#!/usr/bin/env python # -*- coding: utf-8 -*- import gc import sys import time import numpy as np import matplotlib.pyplot as plt import pywt if sys.platform == 'win32': clock = time.clock else: clock = time.time sizes = [20, 50, 100, 120, 150, 200, 250, 300, 400, 500, 600, 750, 1000, 2000, 3000,...
mit
jbogaardt/chainladder-python
chainladder/adjustments/parallelogram.py
1
4390
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. from sklearn.base import BaseEstimator, TransformerMixin from chainladder.core.io import EstimatorIO class Parallelog...
mit