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
togawa28/mousestyles
mousestyles/classification/clustering.py
3
7621
from __future__ import (absolute_import, division, print_function, unicode_literals) from scipy.cluster.hierarchy import linkage from sklearn.cluster import AgglomerativeClustering, KMeans from sklearn import metrics import numpy as np from scipy.cluster.hierarchy import cophenet from scipy.spa...
bsd-2-clause
tomlyscan/Ordenacao
sort.py
1
2277
import argparse import pandas as pd import bib parser = argparse.ArgumentParser() parser.add_argument('-f', action='store', dest='list_integers', help='Arquivo com os números a serem ordenados') parser.add_argument('-s', action='store_const', dest='sort_method', const='selection', help='Algoritmo selection sort sel...
gpl-3.0
sumspr/scikit-learn
sklearn/tests/test_cross_validation.py
27
41664
"""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
verdverm/pypge
test/test_odeint.py
1
1852
#!/usr/bin/env python """ Program to plot the motion of a "springy pendulum". (kindly taken from: http://julianoliver.com/share/free-science-books/comp-phys-python.pdf [page 102-103]) We actually have FOUR parameters to track, here: L, L dot, theta, and theta dot. So instead of the usual Nx2 array, make it Nx4. Each ...
mit
StuartLittlefair/astropy
astropy/visualization/wcsaxes/patches.py
3
6772
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from matplotlib.patches import Polygon from astropy import units as u from astropy.coordinates.representation import UnitSphericalRepresentation from astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product __all_...
bsd-3-clause
GGoussar/scikit-image
doc/examples/filters/plot_entropy.py
9
2234
""" ======= Entropy ======= In information theory, information entropy is the log-base-2 of the number of possible outcomes for a message. For an image, local entropy is related to the complexity contained in a given neighborhood, typically defined by a structuring element. The entropy filter can detect subtle variat...
bsd-3-clause
alistairlow/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator_input_test.py
72
12865
# 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
spallavolu/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
eleweek/dataisbeautiful
rbugs_statistics.py
1
2922
import os from datetime import datetime from datetime import date from collections import defaultdict import json import praw from praw.helpers import submissions_between import seaborn as sns import matplotlib.patches as mpatches def get_flair_stats(): user = os.environ['REDDIT_USERNAME'] user_agent = 'Cal...
mit
nitlev/deepforest
deepforest/models.py
1
3738
import numpy as np from sklearn import clone from sklearn.model_selection import KFold class Models(object): """ A class abstracting away a bunch of models. predict_proba and predict_proba returns all the individual predictions stacked on a new dimension. """ def __init__(self, models): s...
mit
ChanderG/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
jeffery-do/Vizdoombot
doom/lib/python3.5/site-packages/dask/array/numpy_compat.py
6
13707
from __future__ import absolute_import, division, print_function from ..compatibility import builtins import numpy as np import warnings try: isclose = np.isclose except AttributeError: def isclose(*args, **kwargs): raise RuntimeError("You need numpy version 1.7 or greater to use " ...
mit
lbdreyer/iris
lib/iris/tests/test_plot.py
3
31896
# Copyright Iris contributors # # This file is part of Iris and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. # import iris tests first so that some things can be initialised before # importing anything else import iris.tests as tests ...
lgpl-3.0
bdmckean/MachineLearning
fall_2017/hw3/CNN.py
2
4626
import argparse import pickle import gzip from collections import Counter, defaultdict import keras from keras.models import Sequential from keras.layers import Conv2D from keras.layers import Dense from keras.layers import MaxPool2D from keras.layers import Dropout from keras.layers import Flatten from keras.layers.c...
mit
h2oai/h2o-3
h2o-py/tests/testdir_algos/gbm/pyunit_PUBDEV_7269_multinomial_auc_large.py
2
6184
from __future__ import print_function import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.estimators.gbm import H2OGradientBoostingEstimator from tests.pyunit_utils import roc_auc_score def multinomial_auc_prostate_gbm(): data = h2o.import_file(pyunit_utils.locate("smallda...
apache-2.0
ahnitz/pycbc
pycbc/results/scatter_histograms.py
4
29832
# Copyright (C) 2016 Miriam Cabero Mueller, Collin Capano # # 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 3 of the License, or (at your # option) any later version. # # This pro...
gpl-3.0
boland1992/SeisSuite
build/lib/ambient/ant/psspectrum.py
8
7434
""" Module related to Fourier spectrum of trace """ import psutils import numpy as np from numpy.fft import rfft import matplotlib.pyplot as plt import itertools as it class FreqAmplSpectrum: """ Frequence-amplitude spectrum """ def __init__(self, trace): """ @type trace: L{obspy.co...
gpl-3.0
mblue9/tools-iuc
tools/vsnp/vsnp_build_tables.py
2
17888
#!/usr/bin/env python import argparse import multiprocessing import os import queue import re import pandas import pandas.io.formats.excel from Bio import SeqIO INPUT_JSON_AVG_MQ_DIR = 'input_json_avg_mq_dir' INPUT_JSON_DIR = 'input_json_dir' INPUT_NEWICK_DIR = 'input_newick_dir' # Maximum columns allowed in a Libre...
mit
sunzuolei/robot
Codes.python/P2/P2.py
1
1166
#-------by HYH -------# import numpy as np import matplotlib.pyplot as plt world=np.array(['green','red','red','green','green']) p=np.array([0.2,0.2,0.2,0.2,0.2]) z='green' pHit=0.6 pMiss=0.2 def plot_P2(): plt.figure(figsize=(8,10), dpi=80) plt.subplot(411) plt.bar(x=(0,1,2,3,4),height=p,color='red') plt.xlabel('P...
mit
luis-rr/nest-simulator
topology/examples/test_3d_exp.py
13
2956
# -*- coding: utf-8 -*- # # test_3d_exp.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or...
gpl-2.0
duncanmmacleod/gwsumm
gwsumm/tests/test_config.py
1
8714
# -*- coding: utf-8 -*- # Copyright (C) Duncan Macleod (2013) # # This file is part of GWSumm. # # GWSumm 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) ...
gpl-3.0
untom/scikit-learn
sklearn/setup.py
225
2856
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
cshallue/models
research/lexnet_nc/learn_path_embeddings.py
3
7726
#!/usr/bin/env python # Copyright 2017, 2018 Google, Inc. 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 re...
apache-2.0
biokit/biokit
biokit/rtools/pyper.py
1
18769
#!/usr/bin/env python """FORK of PyperR version 1.1.2 from pypi Reason for the fork. Code are written on top of pyper inside biokit. Yet, PypeR is failing sometimes (see examples below) and we may need to hack it. It had also Python 3 compat issues. Examples that fail: installed.packages() --> numpy.array faili...
bsd-2-clause
Achuth17/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
crichardson17/emgtemp
Metals_Sims/z_u_sim_plots.py
2
17136
import matplotlib.pyplot as plt import numpy as np import urllib import matplotlib.cm as cm Low_Temp_Color = 'k' Mid_Temp_Color = 'g' High_Temp_Color = 'r' #Temp_Color = 0.5 Cloudy_Sim_Color = 'cyan' markersize = 40 SDSS_File = '/Users/compastro/jenkins/emgtemp/data/4363_gr_5_0_err_dered.csv' SDSS_Data = np.genfromtxt(...
mit
jorge2703/scikit-learn
sklearn/metrics/cluster/tests/test_unsupervised.py
230
2823
import numpy as np from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.metrics.cluster.unsupervised import silhouette_score from sklearn.metrics import pairwise_distances from sklearn.utils.testing import assert_false, assert_almost_equal from sklearn.utils.testing import assert_raises_regexp...
bsd-3-clause
rahuldhote/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
0asa/scikit-learn
sklearn/metrics/tests/test_pairwise.py
2
21138
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_al...
bsd-3-clause
nmartensen/pandas
pandas/tests/io/test_stata.py
1
57819
# -*- coding: utf-8 -*- # pylint: disable=E1101 import datetime as dt import os import struct import sys import warnings from datetime import datetime from distutils.version import LooseVersion import numpy as np import pandas as pd import pandas.util.testing as tm import pytest from pandas import compat from pandas....
bsd-3-clause
q1ang/scikit-learn
doc/sphinxext/gen_rst.py
106
40198
""" Example generation for the scikit learn Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ from __future__ import division, print_function from time import time import ast import os import re import shutil import traceback i...
bsd-3-clause
wadda/Bari
bariscroller.py
1
8327
# coding=utf-8 import sys import matplotlib import numpy as np from PyQt4 import QtCore from PyQt4 import QtGui matplotlib.use("Qt4Agg") from matplotlib.figure import Figure from matplotlib.animation import TimedAnimation from matplotlib.lines import Line2D from matplotlib.backends.backend_qt4agg import FigureCanvasQ...
mit
PhonologicalCorpusTools/CorpusTools
corpustools/visualize.py
1
3419
import re import numpy as np import pdb from scipy.cluster.hierarchy import linkage, dendrogram from matplotlib import pyplot as plt from matplotlib.collections import LineCollection import seaborn as sns from sklearn.decomposition import PCA def organize_data(reader, visualization_method, value_column, segment_co...
bsd-3-clause
Jimmy-Morzaria/scikit-learn
examples/gaussian_process/gp_diabetes_dataset.py
223
1976
#!/usr/bin/python # -*- coding: utf-8 -*- """ ======================================================================== Gaussian Processes regression: goodness-of-fit on the 'diabetes' dataset ======================================================================== In this example, we fit a Gaussian Process model onto...
bsd-3-clause
agrimaldi/metaseq
metaseq/colormap_adjust.py
1
5162
""" Module to handle custom colormaps. `cmap_powerlaw_adjust`, `cmap_center_adjust`, and `cmap_center_adjust` are from https://sites.google.com/site/theodoregoetz/notes/matplotlib_colormapadjust """ import math import copy import numpy import numpy as np from matplotlib import pyplot, colors, cm import matplotlib imp...
mit
vital-ai/beaker-notebook
plugin/ipythonPlugins/src/dist/python3/beaker_runtime3.py
1
19742
# Copyright 2014 TWO SIGMA OPEN SOURCE, LLC # # 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 agre...
apache-2.0
RNAer/Calour
calour/database.py
1
18564
''' database access functions (:mod:`calour.database`) ================================================== .. currentmodule:: calour.database Functions ^^^^^^^^^ .. autosummary:: :toctree: generated add_terms_to_features enrichment ''' # ----------------------------------------------------------------------...
bsd-3-clause
AlexanderFabisch/scikit-learn
sklearn/feature_selection/__init__.py
33
1159
""" The :mod:`sklearn.feature_selection` module implements feature selection algorithms. It currently includes univariate filter selection methods and the recursive feature elimination algorithm. """ from .univariate_selection import chi2 from .univariate_selection import f_classif from .univariate_selection import f_...
bsd-3-clause
moble/sympy
sympy/plotting/plot.py
55
64797
"""Plotting module for Sympy. A plot is represented by the ``Plot`` class that contains a reference to the backend and a list of the data series to be plotted. The data series are instances of classes meant to simplify getting points and meshes from sympy expressions. ``plot_backends`` is a dictionary with all the bac...
bsd-3-clause
tristandeleu/switching-kalman-filter
test/test_skf_toyexample.py
1
4797
import numpy as np from utils.kalman import SwitchingKalmanState, SwitchingKalmanFilter, KalmanFilter, KalmanState from utils.kalman.models import NDCWPA, NDBrownian import matplotlib.pyplot as plt def angle_between(x,y): return min(y-x, y-x+2*np.pi, y-x-2*np.pi, key=np.abs) class ManeuveringTarget(object): ...
mit
buntyke/Python
Plotting/plot1.py
1
1694
#!/usr/bin/env import matplotlib.pyplot as plt from numpy import genfromtxt import numpy as np plt.rcParams.update({'font.size': '18'}) data = genfromtxt('data1',delimiter=',') xData = data[:,0] yData = data[:,1] zData = np.polyfit(xData, yData, 1) l1 = np.poly1d(zData) zData = np.polyfit(xData, yData, 2) l2 = np....
mit
dhuppenkothen/stingray
stingray/io.py
1
21680
from __future__ import (absolute_import, unicode_literals, division, print_function) import numpy as np import logging import warnings import os import stingray.utils as utils from .utils import order_list_of_arrays, is_string from .utils import assign_value_if_none try: # Python 2 imp...
mit
alexblaessle/PyFRAP
docs/source/conf.py
2
11634
# -*- coding: utf-8 -*- # # PyFRAP documentation build configuration file, created by # sphinx-quickstart on Fri Mar 25 21:59:01 2016. # # 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. # # Al...
gpl-3.0
wanghaven/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/cm.py
70
5385
""" This module contains the instantiations of color mapping classes """ import numpy as np from numpy import ma import matplotlib as mpl import matplotlib.colors as colors import matplotlib.cbook as cbook from matplotlib._cm import * def get_cmap(name=None, lut=None): """ Get a colormap instance, defaultin...
agpl-3.0
nhuntwalker/astroML
book_figures/chapter8/fig_cross_val_D.py
3
3153
""" Cross Validation Examples: Part 4 --------------------------------- Figure 8.15 The learning curves for the data given by eq. 8.75, with d = 2 and d = 3. Both models have high variance for a few data points, visible in the spread between training and validation error. As the number of points increases, it is clear...
bsd-2-clause
stylianos-kampakis/scikit-learn
doc/sphinxext/gen_rst.py
106
40198
""" Example generation for the scikit learn Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ from __future__ import division, print_function from time import time import ast import os import re import shutil import traceback i...
bsd-3-clause
jayflo/scikit-learn
examples/applications/svm_gui.py
287
11161
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
MartinSavc/scikit-learn
examples/applications/plot_model_complexity_influence.py
323
6372
""" ========================== Model Complexity Influence ========================== Demonstrate how model complexity influences both prediction accuracy and computational performance. The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for regression (resp. classification). For each class of models we m...
bsd-3-clause
flavour/Turkey
modules/s3chart.py
16
10983
# -*- coding: utf-8 -*- """ S3 Charting Toolkit @copyright: 2011-15 (c) Sahana Software Foundation @license: MIT @requires: U{B{I{NumPy}} <http://www.numpy.org>} @requires: U{B{I{MatPlotLib}} <http://matplotlib.sourceforge.net>} Permission is hereby granted, free of charge, to any person obt...
mit
HaroldMills/Vesper
scripts/detector_eval/manual/plot_precision_vs_calls.py
1
25972
""" Script that plots precision vs. number of calls for several detectors. The plots are made for the archive of the current working directory using the "Classification" and "Detector Score" annotations created by the detectors. """ from pathlib import Path import itertools import sqlite3 from bokeh.models import R...
mit
ElDeveloper/scikit-learn
examples/tree/plot_tree_regression_multioutput.py
22
1848
""" =================================================================== Multi-output Decision Tree Regression =================================================================== An example to illustrate multi-output regression with decision tree. The :ref:`decision trees <tree>` is used to predict simultaneously the ...
bsd-3-clause
thunderhoser/GewitterGefahr
setup.py
1
2199
"""Setup file for GewitterGefahr.""" from setuptools import setup PACKAGE_NAMES = [ 'gewittergefahr', 'gewittergefahr.gg_io', 'gewittergefahr.gg_utils', 'gewittergefahr.deep_learning', 'gewittergefahr.plotting', 'gewittergefahr.scripts', 'gewittergefahr.feature_selection_example', 'gewittergefahr.natu...
mit
mattcaldwell/zipline
zipline/utils/cli.py
4
6275
# # Copyright 2014 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
ssalonen/financedatahoarder
financedatahoarder/services/tests/test_data_access_api.py
1
15053
from functools import partial from itertools import chain import pkg_resources import grequests from financedatahoarder.services import data_access_api from financedatahoarder.services.data_access_api import NonCachingAsyncRequestsClient from nose.tools import eq_ from nose_parameterized import parameterized from datet...
bsd-3-clause
kiszk/spark
python/pyspark/sql/group.py
24
12490
# # 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
larrybradley/astropy
astropy/nddata/ccddata.py
5
27852
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module implements the base CCDData class.""" import itertools import numpy as np from .compat import NDDataArray from .nduncertainty import ( StdDevUncertainty, NDUncertainty, VarianceUncertainty, InverseVariance) from astropy.io import fits...
bsd-3-clause
jforbess/pvlib-python
pvlib/test/test_spa.py
5
14836
import os import datetime as dt import logging pvl_logger = logging.getLogger('pvlib') try: from importlib import reload except ImportError: try: from imp import reload except ImportError: pass import numpy as np import numpy.testing as npt import pandas as pd import unittest from nose.too...
bsd-3-clause
nrhine1/scikit-learn
sklearn/manifold/tests/test_spectral_embedding.py
216
8091
from nose.tools import assert_true from nose.tools import assert_equal from scipy.sparse import csr_matrix from scipy.sparse import csc_matrix import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_raises from nose.plugins.skip import SkipTest from sk...
bsd-3-clause
Silmathoron/nest-simulator
pynest/nest/tests/test_get_set.py
5
21303
# -*- coding: utf-8 -*- # # test_get_set.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, o...
gpl-2.0
modsim/molyso
molyso/mm/highlevel_interactive_advanced_ground_truth.py
1
28374
# -*- coding: utf-8 -*- """ documentation """ from __future__ import division, unicode_literals, print_function import numpy as np import time from .tracking_output import s_to_h from ..generic.etc import QuickTableDumper from .fluorescence import FluorescentChannel import json import jsonpickle import jsonpickle....
bsd-2-clause
lbishal/scikit-learn
sklearn/manifold/tests/test_mds.py
324
1862
import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_raises from sklearn.manifold import mds def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
lekshmideepu/nest-simulator
pynest/examples/one_neuron_with_noise.py
8
3161
# -*- coding: utf-8 -*- # # one_neuron_with_noise.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the L...
gpl-2.0
eshaw2/SoftwareSystems
HFC_ch5/thinkplot.py
88
12565
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ import math import matplotlib import matplotlib.pyplot as pyplot import numpy as np # customize some matplotlib attrib...
gpl-3.0
racu10/emapy
src/emapy.py
3
50258
# coding: utf-8 # In[1]: #Useful emapy @racu10 import pandas as pd import numpy as np import overpy import overpass import folium from osmapi import OsmApi import math import geopy import geopy.distance import time import unicodedata import sys; reload(sys); sys.setdefaultencoding("utf8") MyApi = OsmApi() apiOver...
bsd-3-clause
SixTrack/SixTrackLib
examples/python/test_footprint_from_sixtrack_input/003_gen_coord_for_footprint.py
1
2101
import pickle import pysixtrack import numpy as np import helpers as hp import footprint epsn_x = 3.5e-6 epsn_y = 3.5e-6 r_max_sigma = 6. N_r_footp = 10. N_theta_footp = 10. n_turns_beta = 150 with open('line.pkl', 'rb') as fid: line = pysixtrack.Line.from_dict(pickle.load(fid)) with open('particle_on_CO.pkl'...
lgpl-2.1
botswana-harvard/edc-rdb
bcpp_rdb/old/rdb/query.py
1
1515
import os import pandas as pd from datetime import datetime from bcpp_rdb.private_settings import Rdb from sqlalchemy import create_engine engine = create_engine('postgresql://{user}:{password}@{host}/{db}'.format( user=Rdb.user, password=Rdb.password, host=Rdb.host, db=Rdb.name)) class Pims(object): def _...
gpl-2.0
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/pandas/tseries/tdi.py
9
31432
""" implement the TimedeltaIndex """ from datetime import timedelta import numpy as np from pandas.core.common import (ABCSeries, _TD_DTYPE, _INT64_DTYPE, is_timedelta64_dtype, _maybe_box, _values_from_object, isnull, is_integer, is_float) from pandas.cor...
apache-2.0
grundgruen/powerline
tests/test_history.py
2
15600
from unittest import TestCase import numpy as np import pandas as pd from zipline.history.history import HistorySpec from zipline.protocol import BarData from zipline.finance.trading import TradingEnvironment from powerline.history.history_container import EpexHistoryContainer __author__ = 'Max' class TestHistory(...
apache-2.0
neale/CS-program
434-MachineLearning/final_project/linearClassifier/sklearn/metrics/tests/test_common.py
31
41654
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...
unlicense
TomAugspurger/pandas
pandas/tests/groupby/test_grouping.py
1
35091
""" test where we are determining what we are grouping, or getting groups """ import numpy as np import pytest import pandas as pd from pandas import ( CategoricalIndex, DataFrame, Index, MultiIndex, Series, Timestamp, date_range, ) import pandas._testing as tm from pandas.core.groupby.gro...
bsd-3-clause
BonexGu/Blik2D-SDK
Blik2D/addon/tensorflow-1.2.1_for_blik/tensorflow/contrib/learn/python/learn/estimators/estimator_input_test.py
72
12865
# 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...
mit
mhdella/scikit-learn
sklearn/decomposition/truncated_svd.py
199
7744
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck <L.J.Buitinck@uva.nl> # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sp...
bsd-3-clause
ssaeger/scikit-learn
sklearn/linear_model/randomized_l1.py
9
24350
""" Randomized Lasso/Logistic: feature selection based on Lasso and sparse Logistic Regression """ # Author: Gael Varoquaux, Alexandre Gramfort # # License: BSD 3 clause import itertools from abc import ABCMeta, abstractmethod import warnings import numpy as np from scipy.sparse import issparse from scipy import spar...
bsd-3-clause
mojoboss/scikit-learn
examples/cluster/plot_affinity_propagation.py
349
2304
""" ================================================= Demo of affinity propagation clustering algorithm ================================================= Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Points", Science Feb. 2007 """ print(__doc__) from sklearn.cluster impor...
bsd-3-clause
bospetersen/h2o-3
h2o-py/tests/testdir_algos/gbm/pyunit_weightsGBM.py
1
6149
import sys sys.path.insert(1, "../../../") import h2o, tests import random import copy def weights_check(ip,port): def check_same(data1, data2, min_rows_scale): gbm1_regression = h2o.gbm(x=data1[["displacement", "power", "weight", "acceleration", "year"]], y="ec...
apache-2.0
zorojean/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
lazywei/scikit-learn
sklearn/feature_selection/rfe.py
137
17066
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import warnings import numpy as np from ..utils import check_X_y, safe_sqr fro...
bsd-3-clause
luminescence/PolyLibScan
Analysis/plotting.py
1
19133
from matplotlib.artist import setp import matplotlib.patches as mpatches import matplotlib.pyplot as plt import pandas as pd import numpy as np import numba as nb import pymc as mc import numerics as num_ class Project(object): def scatter_plot(self, subset=None, with_errors=False, with_labels=False, with_crossva...
mit
B3AU/waveTree
sklearn/linear_model/tests/test_omp.py
5
8953
# Author: Vlad Niculae # Licence: BSD 3 clause import warnings import numpy as np from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_...
bsd-3-clause
kipohl/ncanda-data-integration
scripts/redcap/scoring/brief/__init__.py
2
9447
#!/usr/bin/env python ## ## See COPYING file distributed along with the ncanda-data-integration package ## for the copyright and license terms ## import os import time import datetime import pandas # # Behavior Rating Inventory of Executive Function (BRIEF) # input_fields = { 'youthreport2' : [ 'youthreport2_bri...
bsd-3-clause
tracierenea/gnuradio
gnuradio-runtime/examples/volk_benchmark/volk_plot.py
78
6117
#!/usr/bin/env python import sys, math import argparse from volk_test_funcs import * try: import matplotlib import matplotlib.pyplot as plt except ImportError: sys.stderr.write("Could not import Matplotlib (http://matplotlib.sourceforge.net/)\n") sys.exit(1) def main(): desc='Plot Volk performanc...
gpl-3.0
eramirem/astroML
examples/datasets/plot_LIGO_spectrum.py
3
2513
""" Plot the power spectrum of LIGO ------------------------------- This compares the power spectrum computed using the raw FFT, and using Welch's method (i.e. overlapping window functions that reduce noise). The top panel shows the raw signal, which is the measurements of the change in baseline length. The bottom pan...
bsd-2-clause
qiime2/q2-diversity
q2_diversity/tests/test_alpha.py
2
20675
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2021, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
bsd-3-clause
PG-TUe/tpot
tests/test_config_sparse.py
4
1422
# -*- coding: utf-8 -*- """This file is part of the TPOT library. TPOT was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - Weixuan Fu (weixuanf@upenn.edu) - Daniel Angell (dpa34@drexel.edu) - and many more generous open source contributors TPOT is f...
lgpl-3.0
UNR-AERIAL/scikit-learn
doc/sphinxext/numpy_ext/docscrape_sphinx.py
408
8061
import re import inspect import textwrap import pydoc from .docscrape import NumpyDocString from .docscrape import FunctionDoc from .docscrape import ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config=None): config = {} if config is None else config self.use_plots...
bsd-3-clause
aetilley/scikit-learn
examples/model_selection/plot_roc.py
146
3697
""" ======================================= Receiver Operating Characteristic (ROC) ======================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality. ROC curves typically feature true positive rate on the Y axis, and false positive rate on the X a...
bsd-3-clause
0x0all/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/units.py
70
4810
""" The classes here provide support for using custom classes with matplotlib, eg those that do not expose the array interface but know how to converter themselves to arrays. It also supoprts classes with units and units conversion. Use cases include converters for custom objects, eg a list of datetime objects, as we...
gpl-3.0
annaritz/fly-interactome
interactome/weighted-interactome/parameter-optimize.py
1
4407
from __future__ import print_function import sys import os ## NetworkX imports import numpy as np import networkx as nx from graph import Graph import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import glob A_PARAMS = [0.05, 0.1, 0.5, 1.0, 1.5, 2.0] W_PARAMS = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, ...
gpl-3.0
savoirfairelinux/odoo
addons/resource/faces/timescale.py
170
3902
############################################################################ # Copyright (C) 2005 by Reithinger GmbH # mreithinger@web.de # # This file is part of faces. # # faces is free software; you can redistribute it and/or modify # ...
agpl-3.0
ihmeuw/vivarium
tests/framework/test_state_machine.py
1
5788
import pandas as pd import numpy as np from vivarium import InteractiveContext from vivarium.framework.randomness import choice from vivarium.framework.state_machine import Machine, State, Transition def _population_fixture(column, initial_value): class PopFixture: @property def name(self): ...
gpl-3.0
natj/bender
bender.py
1
18533
import sys sys.path.append('/Users/natj/projects/arcmancer/lib/') import pyarcmancer as pyac import numpy as np import matplotlib as mpl #import matplotlib.pyplot as plt from pylab import * from matplotlib import cm #from scipy import interpolate import scipy.interpolate as interp from joblib import Parallel, delay...
mit
blaisb/cfdemUtilities
dem/rdfAnalysis/plotMultRdf.py
1
1745
# This plots the RDF of a LIGGGHTS post-processed analysis # # USAGE : python ./file # # Author : Bruno Blais #Python imports #---------------- import os import sys import numpy import matplotlib.pyplot as plt #---------------- #******************************** # OPTIONS AND USER PARAMETERS #********************...
lgpl-3.0
kianho/mpl_preamble
examples/stock_prices.py
1
1615
#!/usr/bin/env python # encoding: utf-8 """ Date: Sun Feb 15 21:57:25 AEDT 2015 Author: Kian Ho <hui.kian.ho@gmail.com> Description: TODO Usage: stock_prices.py """ from __future__ import print_function import datetime import mpl_preamble from pandas.io import data from mpl_preamble import mpl, ...
mit
pletisan/python-data-viz-cookbook
3367OS_Code/3367OS_07_Code/ch07/ch07_rec01_understand_log_plot.py
1
1045
from matplotlib import pyplot as plt import numpy as np x = np.linspace(1, 10) y = [10 ** el for el in x] z = [2 * el for el in x] fig = plt.figure(figsize=(10, 8)) ax1 = fig.add_subplot(2, 2, 1) ax1.plot(x, y, color='blue') ax1.set_yscale('log') ax1.set_title(r'Logarithmic plot of $ {10}^{x} $ ') ax1.set_ylabel(r'$...
mit
treycausey/scikit-learn
benchmarks/bench_plot_ward.py
290
1260
""" Benchmark scikit-learn's Ward implement compared to SciPy's """ import time import numpy as np from scipy.cluster import hierarchy import pylab as pl from sklearn.cluster import AgglomerativeClustering ward = AgglomerativeClustering(n_clusters=3, linkage='ward') n_samples = np.logspace(.5, 3, 9) n_features = n...
bsd-3-clause
magnunor/hyperspy
hyperspy/misc/rgb_tools.py
5
2801
import numpy as np from dask.array import Array rgba8 = np.dtype({'names': ['R', 'G', 'B', 'A'], 'formats': ['u1', 'u1', 'u1', 'u1']}) rgb8 = np.dtype({'names': ['R', 'G', 'B'], 'formats': ['u1', 'u1', 'u1']}) rgba16 = np.dtype({'names': ['R', 'G', 'B', 'A'], 'for...
gpl-3.0
btabibian/scikit-learn
examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py
87
3903
""" ============================================== Feature agglomeration vs. univariate selection ============================================== This example compares 2 dimensionality reduction strategies: - univariate feature selection with Anova - feature agglomeration with Ward hierarchical clustering Both metho...
bsd-3-clause
mikewiebe-ansible/ansible
hacking/cgroup_perf_recap_graph.py
54
4384
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2018, Matt Martz <matt@sivel.net> # # This file is part of Ansible # # Ansible 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 Licens...
gpl-3.0
ywcui1990/nupic.research
projects/wavelet_dataAggregation/runDataAggregationExperiment.py
11
21206
from os.path import isfile, join, exists import pandas as pd import numpy as np from scipy import signal import numpy.matlib import csv import os import time os.environ['TZ'] = 'GMT' time.tzset() display = True if display: import matplotlib.pyplot as plt plt.close('all') plt.ion() def plotWaveletPower(sig, cw...
agpl-3.0
jbedorf/tensorflow
tensorflow/lite/experimental/micro/examples/micro_speech/apollo3/captured_data_to_wav.py
11
1442
# Copyright 2018 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