repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
jkarnows/scikit-learn
sklearn/grid_search.py
103
36232
""" The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # ...
bsd-3-clause
pulinagrawal/nupic
examples/opf/clients/hotgym/anomaly/one_gym/nupic_anomaly_output.py
49
9450
# ---------------------------------------------------------------------- # 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 apply: # # This progra...
agpl-3.0
georgid/sms-tools
lectures/5-Sinusoidal-model/plots-code/synthesis-window-2.py
2
2042
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, triang, blackmanharris import sys, os, functools, time from scipy.fftpack import fft, ifft, fftshift sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel as DFT import ...
agpl-3.0
ychfan/tensorflow
tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py
52
69800
# 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
kkozarev/mwacme
src/fit_powerlaw_spectra_normalized.py
2
4350
import numpy as np import os,sys from scipy import optimize import matplotlib.pyplot as plt import matplotlib.dates as pltdates from astropy.io import ascii from datetime import datetime #This script will fit a power law to the moving source synchrotron spectrum #The new data location #if sys.platform == 'darwin': B...
gpl-2.0
evgchz/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
chris-ch/omarket
python-lab/src/cointeg.py
1
9096
import numpy from scipy.signal import detrend from statsmodels.tsa import tsatools from numpy import linalg from statsmodels.tsa.stattools import adfuller __author__ = 'Christophe' def is_not_stationary(v, significance='5%', max_d=6, reg='nc', autolag='AIC'): """ Augmented Dickey Fuller test for a unit root in a...
apache-2.0
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/examples/mplot3d/mixed_subplots_demo.py
12
1032
""" Demonstrate the mixing of 2d and 3d subplots """ from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np def f(t): s1 = np.cos(2*np.pi*t) e1 = np.exp(-t) return np.multiply(s1,e1) ################ # First subplot ################ t1 = np.arange(0.0, 5.0, 0.1) t2 = n...
mit
ewels/genomics-status
status/sequencing.py
2
8779
""" Handlers related to data sequencing statistics. """ from collections import defaultdict import cStringIO from datetime import datetime import json from dateutil import parser import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg import numpy as np import tornado.web from stat...
mit
jhmadhav/pynopticon
src/em/info.py
4
2971
""" Routines for Gaussian Mixture Models and learning with Expectation Maximization =============================================================================== This module contains classes and function to compute multivariate Gaussian densities (diagonal and full covariance matrices), Gaussian mixtures, Gaussian ...
gpl-3.0
d-chambers/animations
simplex/simplex.py
1
13205
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 2 13:12:55 2017 @author: isti_ew """ import os import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Polygon from mpl_toolkits.mplot3d import Axes3D from matplotlib.collections import PatchCollection # import seaborn as...
mit
nafitzgerald/allennlp
allennlp/training/metrics/conll_coref_scores.py
1
8684
from typing import Dict, List, Tuple from collections import Counter import numpy as np from sklearn.utils.linear_assignment_ import linear_assignment from overrides import overrides from allennlp.training.metrics.metric import Metric @Metric.register("conll_coref_scores") class ConllCorefScores(Metric): def __i...
apache-2.0
3WiseMen/python
21. Showfreq.VISUAL/VisualShowfreq.v1.py
1
1944
#Refer to http://blog.rcnelson.com/building-a-matplotlib-gui-with-qt-designer-part-2/l from PyQt4.uic import loadUiType from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import (FigureCanvasQTAgg as FigureCanvas, NavigationToolbar2QT as NavigationToolbar) import sys from PyQt4 import QtGui im...
mit
tomlof/scikit-learn
sklearn/neural_network/rbm.py
46
12291
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause
acarmel/dreampie
dreampielib/subprocess/__init__.py
2
37126
# Copyright 2010 Noam Yorav-Raphael # # This file is part of DreamPie. # # DreamPie 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. # ...
gpl-3.0
mwv/scikit-learn
sklearn/tests/test_common.py
127
7665
""" General tests for all estimators in sklearn. """ # Authors: Andreas Mueller <amueller@ais.uni-bonn.de> # Gael Varoquaux gael.varoquaux@normalesup.org # License: BSD 3 clause from __future__ import print_function import os import warnings import sys import pkgutil from sklearn.externals.six import PY3 fr...
bsd-3-clause
bkuczenski/lca-tools
antelope_reports/charts/vertical.py
1
6321
import matplotlib.pyplot as plt import matplotlib.patches as mpatches from .base import standard_labels, label_vbar, prefab_colors, net_color, wrap def spread_bars(ax, data, color_gen, hi=None, lo=None, y_lim=None, barwidth=0.65, x_offset=0, labels=True, **kwargs): """ :param ax: :param data: :param...
gpl-2.0
andrewcmyers/tensorflow
tensorflow/contrib/learn/python/learn/estimators/kmeans.py
34
10130
# 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
shssoichiro/servo
tests/heartbeats/process_logs.py
139
16143
#!/usr/bin/env python # 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 http://mozilla.org/MPL/2.0/. import argparse import matplotlib.pyplot as plt import numpy as np import os from os import path ...
mpl-2.0
maxwell-lv/MyQuant
ssd.py
1
7030
from sqlalchemy.sql import select from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine, Column, Integer, String, Float, Date, MetaData from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() import sqlite3 from xlrd import open_workbook import re import click from datet...
gpl-3.0
jpinedaf/pyspeckit
pyspeckit/spectrum/models/modelgrid.py
5
2036
""" ========== Model Grid ========== Fit a line based on parameters output from a grid of models Module API ^^^^^^^^^^ """ import numpy as np from pyspeckit.mpfit import mpfit import matplotlib.cbook as mpcb import copy try: import scipy.interpolate import scipy.ndimage scipyOK = True except ImportError: ...
mit
hlin117/scikit-learn
examples/linear_model/plot_theilsen.py
100
3846
""" ==================== Theil-Sen Regression ==================== Computes a Theil-Sen Regression on a synthetic dataset. See :ref:`theil_sen_regression` for more information on the regressor. Compared to the OLS (ordinary least squares) estimator, the Theil-Sen estimator is robust against outliers. It has a breakd...
bsd-3-clause
ZENGXH/scikit-learn
sklearn/cluster/setup.py
263
1449
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause 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 = ...
bsd-3-clause
SaganBolliger/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_svg.py
69
23593
from __future__ import division import os, codecs, base64, tempfile, urllib, gzip, cStringIO try: from hashlib import md5 except ImportError: from md5 import md5 #Deprecated in 2.5 from matplotlib import verbose, __version__, rcParams from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ ...
agpl-3.0
msultan/msmbuilder
msmbuilder/tests/test_ghmm.py
3
6219
from __future__ import print_function, division import warnings from itertools import permutations import hmmlearn.hmm import numpy as np import pickle import tempfile from sklearn.pipeline import Pipeline from msmbuilder.example_datasets import AlanineDipeptide from msmbuilder.featurizer import SuperposeFeaturizer...
lgpl-2.1
nkhuyu/office-nfl-pool
transform.py
6
4239
""" transform ~~~~~~~~~ Helper functions for data manipulation using Pandas. """ import numpy as np import pandas as pd def from_byteam_to_bygame(df, augment=True, dont_mirror=[]): """Tranform data with one row per team to one row per game. In the 'byteam' format, there is one row per team -- one for the ...
mit
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/pandas/core/tools/datetimes.py
7
30773
from datetime import datetime, timedelta, time import numpy as np from collections import MutableMapping from pandas._libs import lib, tslib from pandas.core.dtypes.common import ( _ensure_object, is_datetime64_ns_dtype, is_datetime64_dtype, is_datetime64tz_dtype, is_integer_dtype, is_integer,...
mit
jay3sh/vispy
vispy/testing/__init__.py
21
2415
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ Testing ======= This module provides functions useful for running tests in vispy. Tests can be run in a few ways: * From Python, you can import ``vispy`` and do ``vis...
bsd-3-clause
akionakamura/scikit-learn
sklearn/utils/multiclass.py
92
13986
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain import warnings from scipy.sparse import issparse fro...
bsd-3-clause
rcrowder/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtkcairo.py
69
2207
""" GTK+ Matplotlib interface using cairo (not GDK) drawing operations. Author: Steve Chaplin """ import gtk if gtk.pygtk_version < (2,7,0): import cairo.gtk from matplotlib.backends import backend_cairo from matplotlib.backends.backend_gtk import * backend_version = 'PyGTK(%d.%d.%d) ' % gtk.pygtk_version + \ ...
agpl-3.0
ldirer/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause
andrewnc/scikit-learn
examples/ensemble/plot_feature_transformation.py
67
4285
""" =============================================== Feature transformations with ensembles of trees =============================================== Transform your features into a higher dimensional, sparse space. Then train a linear model on these features. First fit an ensemble of trees (totally random trees, a rand...
bsd-3-clause
mne-tools/mne-python
examples/simulation/simulate_raw_data.py
19
2830
""" =========================== Generate simulated raw data =========================== This example generates raw data by repeating a desired source activation multiple times. """ # Authors: Yousra Bekhti <yousra.bekhti@gmail.com> # Mark Wronkiewicz <wronk.mark@gmail.com> # Eric Larson <larson.eric....
bsd-3-clause
guschmue/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimators_test.py
21
6697
# 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
sebp/scikit-survival
sksurv/nonparametric.py
1
13820
# 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 program is distributed in the hope that it will be useful, # bu...
gpl-3.0
TK-TarunW/ecosystem
spark-2.0.2-bin-hadoop2.7/python/pyspark/sql/session.py
3
24896
# # 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
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/examples/axes_grid/demo_axes_divider.py
8
3104
import matplotlib.pyplot as plt def get_demo_image(): import numpy as np from matplotlib.cbook import get_sample_data f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) z = np.load(f) # z is a numpy array of 15x15 return z, (-3,4,-4,3) def demo_simple_image(ax): Z, ext...
gpl-2.0
hvanwyk/drifter
src/grid/mesh.py
1
15658
from grid.cell import Cell from grid.vertex import Vertex from grid.triangle import Triangle import numpy import matplotlib.pyplot as plt class Mesh(object): ''' Description: (Quad) Mesh object Attributes: bounding_box: [xmin, xmax, ymin, ymax] children: Cell, list of cel...
mit
kjung/scikit-learn
examples/gaussian_process/plot_gpr_noisy_targets.py
45
3680
""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression example computed in two different ways: 1. A noise-free case 2. A noisy case with known noise-level per ...
bsd-3-clause
CSyllabus/webapp
backend/apps/csyllabusapi/helper/generate_fixtures_from_polimi_dump.py
1
6681
import pandas as pd import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from lxml import html import json polimi_fixtures_json = open("../fixtures/polimi_fixtures_json.json", "w") # reading file polimi_courses_nodescription and extracting course description ...
mit
tonysyu/mpltools
mpltools/widgets/slider.py
2
4289
import matplotlib.widgets as mwidgets class Slider(mwidgets.Slider): """Slider widget to select a value from a floating point range. Parameters ---------- ax : :class:`~matplotlib.axes.Axes` instance The parent axes for the widget value_range : (float, float) (min, max) value allo...
bsd-3-clause
aarchiba/scipy
scipy/interpolate/ndgriddata.py
4
7600
""" Convenience interface to N-D interpolation .. versionadded:: 0.9 """ from __future__ import division, print_function, absolute_import import numpy as np from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \ CloughTocher2DInterpolator, _ndim_coords_from_arrays from scipy.spatial import cKDTree _...
bsd-3-clause
janscience/thunderfish
thunderfish/fishshapes.py
1
42376
""" Manipulate and plot fish outlines. ## Fish shapes All fish shapes of this module are accessible via these dictionaries: - `fish_shapes`: dictionary holding all electric fish shapes. - `fish_top_shapes`: dictionary holding electric fish shapes viewed from top. - `fish_side_shapes`: dictionary holding electric fis...
gpl-3.0
jhonatancasale/ML-T3
utils/dev/parse.csv.into.pandas/parse.csv.into.pandas.py
1
3609
#!env python3 # -*- coding: utf-8 -*- import click import logging import sys import requests import os.path import glob import re #logging.basicConfig(filename='history.log', level=logging.DEBUG, logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(message)s' ...
apache-2.0
andrewv587/pycharm-project
static-spark-na-sa.py
1
8935
#!/usr/bin/python # -*- coding:utf-8 -*- # Filename:na-sa.py # Function: # Author:Huang Weihang # Email:huangweihang14@mails.ucas.ac.cn # Data:2016-12-28 import os from pyspark import SparkConf os.environ["SPARK_HOME"] = "/usr/local/spark" import time from numpy import * from pyspark import SparkContext import p...
apache-2.0
redreamality/tushare
tushare/util/dateu.py
27
2184
# -*- coding:utf-8 -*- import datetime import pandas as pd def year_qua(date): mon = date[5:7] mon = int(mon) return[date[0:4], _quar(mon)] def _quar(mon): if mon in [1, 2, 3]: return '1' elif mon in [4, 5, 6]: return '2' elif mon in [7, 8, 9]: ...
bsd-3-clause
svebk/qpr-winter-2017
code/CP1_eval_script_v2.py
1
4171
#!/usr/bin/env python import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, roc_auc_score import sys import json # how to use: python CP1_eval_script.py ground_truth_sample_CP1.json submission_sample_CP1.json output_sample_CP1.pdf output_cg_chart.pdf ################################################ ...
mit
jontyjashan/PiNN_Caffe2
dc_iv_api.py
1
16120
import caffe2_paths import os import pickle from caffe2.python import ( workspace, layer_model_helper, schema, optimizer, net_drawer ) import caffe2.python.layer_model_instantiator as instantiator import numpy as np from pinn.pinn_lib import build_pinn, init_model_with_schemas import pinn.data_reader as data_reader im...
mit
Sklearn-HMM/scikit-learn-HMM
sklean-hmm/utils/tests/test_utils.py
12
4539
import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import pinv2 from sklearn.utils.testing import (assert_equal, assert_raises, assert_true, assert_almost_equal, assert_array_equal) from sklearn.utils import check_random_state from sklearn.utils import d...
bsd-3-clause
pandeylab/pyquant
pyquant/command_line.py
1
52961
from __future__ import division, unicode_literals, print_function import base64 import copy import gzip import os import operator import traceback import random import signal import sys from collections import defaultdict, OrderedDict from functools import partial from multiprocessing import Queue, Manager from string ...
mit
VladiMihaylenko/omim
search/search_quality/scoring_model.py
2
10118
#!/usr/bin/env python3 from math import exp, log from scipy.stats import pearsonr, t from sklearn import svm from sklearn.model_selection import GridSearchCV, KFold from sklearn.utils import resample import argparse import collections import itertools import numpy as np import pandas as pd import random import sys M...
apache-2.0
marqh/iris
lib/iris/symbols.py
16
7823
# (C) British Crown Copyright 2010 - 2015, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
lgpl-3.0
h2educ/scikit-learn
sklearn/decomposition/__init__.py
147
1421
""" The :mod:`sklearn.decomposition` module includes matrix decomposition algorithms, including among others PCA, NMF or ICA. Most of the algorithms of this module can be regarded as dimensionality reduction techniques. """ from .nmf import NMF, ProjectedGradientNMF from .pca import PCA, RandomizedPCA from .incrementa...
bsd-3-clause
dhruvparamhans/zipline
zipline/examples/pairtrade.py
11
4925
#!/usr/bin/env python # # Copyright 2013 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 ...
apache-2.0
mila-udem/blocks-extras
blocks_extras/scripts/plot.py
5
3705
from __future__ import division, print_function import fnmatch from six import iteritems from collections import OrderedDict from functools import reduce from blocks.config import config from blocks.utils import change_recursion_limit from blocks.log import TrainingLog from blocks.main_loop import MainLoop from bloc...
mit
varun-rajan/python-modules
Obsolete/mdutilities_crack3d.py
1
4822
import numpy as np import mdutilities_io as mduio import myio as Mio import mymath as Mmath import Ccircumradii14 as C import networkx as nx import scipy.spatial as spsp import matplotlib as mpl import matplotlib.tri as mtri import matplotlib.pyplot as plt def parseCrackData(crackdata,cR,option,r0=2**(1/6),timeincreme...
gpl-2.0
AlexandreMoulti/bachelier
bachelier.py
1
10663
# -*- coding: utf-8 -*- import numpy as np from math import * import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm import scipy as sc class DiscretisationGrid(object): """ Discretisation to be used for the Monte-Carlo simulations Time grid, discretisation of the time...
mit
cuilishen/cuilishenMissionPlanner
Lib/site-packages/numpy/core/code_generators/ufunc_docstrings.py
57
85797
# Docstrings for generated ufuncs docdict = {} def get(name): return docdict.get(name) def add_newdoc(place, name, doc): docdict['.'.join((place, name))] = doc add_newdoc('numpy.core.umath', 'absolute', """ Calculate the absolute value element-wise. Parameters ---------- x : array_like...
gpl-3.0
DouglasLeeTucker/DECam_PGCM
bin/rawdata_se_objects_exp_combine.py
1
5148
#!/usr/bin/env python """ rawdata_se_objects_exp_combine.py Example: rawdata_se_objects_exp_combine.py --help rawdata_se_objects_exp_combine.py --inputSEObjFile seobjfile.csv --inputExpFile expfile.csv --outputFile output...
gpl-3.0
mfjb/scikit-learn
examples/applications/plot_stock_market.py
227
8284
""" ======================================= Visualizing the stock market structure ======================================= This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote ...
bsd-3-clause
nelango/ViralityAnalysis
model/lib/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_...
mit
AlexRobson/scikit-learn
sklearn/cluster/tests/test_mean_shift.py
121
3429
""" Testing for mean shift clustering methods """ import numpy as np import warnings from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import asser...
bsd-3-clause
wangming28/syzygy
third_party/numpy/files/numpy/core/function_base.py
82
5474
__all__ = ['logspace', 'linspace'] import numeric as _nx from numeric import array def linspace(start, stop, num=50, endpoint=True, retstep=False): """ Return evenly spaced numbers over a specified interval. Returns `num` evenly spaced samples, calculated over the interval [`start`, `stop` ]. Th...
apache-2.0
ofgulban/scikit-image
doc/ext/plot2rst.py
21
20507
""" Example generation from python files. Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot'. To generate your own examples, add this extension to the list of ``extensions``in your Sphinx configuration file. In addition, make sure th...
bsd-3-clause
annoviko/pyclustering
pyclustering/cluster/tests/unit/ut_ttsas.py
1
3807
"""! @brief Unit-tests for TTSAS algorithm. @authors Andrei Novikov (pyclustering@yandex.ru) @date 2014-2020 @copyright BSD-3-Clause """ import unittest; import matplotlib; matplotlib.use('Agg'); from pyclustering.cluster.tests.ttsas_template import ttsas_test; from pyclustering.utils.metric impor...
gpl-3.0
mrshu/scikit-learn
sklearn/tree/tests/test_tree.py
1
15609
""" Testing for the tree module (sklearn.tree). """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_array_almost_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from nose.tools import assert...
bsd-3-clause
ajdawson/iris
lib/iris/tests/unit/plot/test_contourf.py
11
3169
# (C) British Crown Copyright 2014 - 2016, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
gpl-3.0
samleegithub/RestaurantRecs
src/data_counts.py
1
6364
from scrape_yelp_reviews import load_restaurant_ids import pyspark as ps import matplotlib.pyplot as plt plt.style.use('ggplot') def load_data(spark): restaurants_df = spark.read.parquet('../data/restaurants') ratings_df = spark.read.parquet('../data/ratings') return restaurants_df, ratings_df def get_f...
gpl-3.0
musically-ut/statsmodels
statsmodels/stats/tests/test_weightstats.py
30
21864
'''tests for weightstats, compares with replication no failures but needs cleanup update 2012-09-09: added test after fixing bug in covariance TODOs: - I don't remember what all the commented out code is doing - should be refactored to use generator or inherited tests - still gaps in test coverage...
bsd-3-clause
aroooshi/CloudFinalProject
application.py
1
8188
import os from flask import Flask, render_template, request, redirect, url_for, send_from_directory, json, jsonify, session import omdb import math app = Flask(__name__) import math import pandas as pd import re import pickle from sklearn.externals import joblib clf2 = joblib.load('model/tree.pkl') df110 = pd.read_p...
apache-2.0
exord/bayev
test.py
1
5761
import pickle import time import bayev.pastislib as pl import bayev.chib as chib import bayev.perrakis as perr import bayev.lib import numpy as n import matplotlib.pylab as plt from math import e, log10 __author__ = 'Rodrigo F. Diaz' def test_pastis_logprior(nsamples=300): # Read test data f = open('/Users...
mit
johnowhitaker/bobibabber
mlp_example_origional.py
1
1087
from sklearn.datasets import load_digits from multilayer_perceptron import MultilayerPerceptronClassifier, MultilayerPerceptronRegressor import numpy as np from matplotlib import pyplot as plt # contrive the "exclusive or" problem X = np.array([[0.0,0.1], [0.9,0], [0,0.85], [0.92,0.87]]) y = np.array([0, 1, 1, 0]) #...
mit
stevertaylor/NX01
NX01_processResults.py
1
11770
#!/usr/bin/env python """ Created by stevertaylor Copyright (c) 2014 Stephen R. Taylor Code contributions by Rutger van Haasteren (piccard) and Justin Ellis (PAL/PAL2). """ from __future__ import division import numpy as np from numpy import * import os, optparse, corner, json import h5py as h5 import matplotlib m...
mit
tacaswell/bokeh
bokeh/crossfilter/models.py
40
30635
from __future__ import absolute_import import logging import six import pandas as pd import numpy as np from ..plotting import curdoc from ..models import ColumnDataSource, GridPlot, Panel, Tabs, Range from ..models.widgets import Select, MultiSelect, InputWidget # crossfilter plotting utilities from .plotting impo...
bsd-3-clause
lgarren/spack
var/spack/repos/builtin/packages/py-pymatgen/package.py
3
2608
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
brennmat/ruediPy
python/classes/rgams_SRS.py
1
77748
# Code for the SRS RGA mass spec class # # DISCLAIMER: # This file is part of ruediPy, a toolbox for operation of RUEDI mass spectrometer systems. # # ruediPy 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, ...
gpl-3.0
morganics/bayesianpy
examples/iris_clustering_visualisation.py
1
4326
import pandas as pd import bayesianpy from bayesianpy.network import Builder as builder import logging import os import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Ellipse # Using the latent variable to cluster data points. Based upon the Iris dataset which has 3 distinct clusters # (...
apache-2.0
michigraber/scikit-learn
examples/plot_isotonic_regression.py
303
1767
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
bsd-3-clause
e-koch/BaSiCs
Examples/THINGS/catalog_comparison.py
1
6301
import numpy as np from astropy.table import Table from astropy.modeling.models import Ellipse2D from astropy.coordinates import SkyCoord from astropy.io import fits import astropy.units as u from spectral_cube import SpectralCube from basics import Bubble2D, Bubble3D import glob import matplotlib.pyplot as p ''' Com...
mit
numenta/htmresearch
htmresearch/frameworks/layers/physical_objects.py
10
25225
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
agpl-3.0
mmottahedi/neuralnilm_prototype
scripts/e147.py
2
5179
from __future__ import print_function, division import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import crossentropy, mse...
mit
paladin74/neural-network-animation
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
mmottahedi/neuralnilm_prototype
scripts/e429.py
2
7308
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectio...
mit
lixt/lily2-gem5
util/stats/barchart.py
90
12472
# Copyright (c) 2005-2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this ...
bsd-3-clause
imaculate/scikit-learn
sklearn/linear_model/tests/test_perceptron.py
378
1815
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_raises from sklearn.utils import check_random_state from sklearn.datasets import load_iris from sklearn.linear_model import Pe...
bsd-3-clause
kelle/astropy
astropy/visualization/scripts/tests/test_fits2bitmap.py
2
1749
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from ....io import fits try: import matplotlib # pylint: disable=W0611 HAS_MATPLOTLIB = True from ..fits2bitmap import fits2bitmap, main except ImportError: HAS_MATPLOTLIB = False @pytest.mark.skipif('...
bsd-3-clause
likelyzhao/mxnet
example/rcnn/rcnn/pycocotools/coco.py
1
14869
from __future__ import print_function __version__ = '1.0.1' __author__ = 'tylin' # Interface for accessing the Microsoft COCO dataset. # Microsoft COCO is a large image dataset designed for object detection, # segmentation, and caption generation. pycocotools is a Python API that # assists in loading, parsing and visu...
apache-2.0
TAMU-CPT/galaxy-tools
tools/genome_viz/dna_features_viewer/BiopythonTranslator/BiopythonTranslatorBase.py
1
4482
from ..biotools import load_record from ..GraphicRecord import GraphicRecord from ..CircularGraphicRecord import CircularGraphicRecord from ..GraphicFeature import GraphicFeature class BiopythonTranslatorBase: """Base class for all BiopythonTranslators. This class needs to be complemented with methods comput...
gpl-3.0
MayukhSobo/EnronFraud
poi_id.py
1
24774
from feature_engineering import feature_importance from feature_engineering import feature_loader from feature_engineering import feature_misc from sklearn.decomposition import PCA from sklearn.feature_selection import SelectKBest from sklearn.model_selection import GridSearchCV from sklearn.model_selection import Stra...
mit
JeanKossaifi/scikit-learn
sklearn/cluster/setup.py
263
1449
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause 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 = ...
bsd-3-clause
seemethere/nba_py
nba_py/__init__.py
1
4486
from datetime import datetime, timedelta import os from requests import get from nba_py.constants import League HAS_PANDAS = True try: from pandas import DataFrame except ImportError: HAS_PANDAS = False HAS_REQUESTS_CACHE = True CACHE_EXPIRE_MINUTES = int(os.getenv('NBA_PY_CACHE_EXPIRE_MINUTES', 10)) try: ...
bsd-3-clause
APMonitor/arduino
5_Moving_Horizon_Estimation/1st_order_linear/Python/main_mhe.py
1
3157
import tclab import numpy as np import time from APMonitor.apm import * import matplotlib.pyplot as plt # Connect to Arduino a = tclab.TCLab() # Run time in minutes run_time = 10.0 # Number of cycles (1 cycle per 2 seconds) loops = int(30.0*run_time) # Temperature (K) T1 = np.ones(loops) * a.T1 # measured T T1mhe =...
apache-2.0
mkraemer67/plugml
plugml/feature.py
1
3221
import numpy as np from nltk.corpus import stopwords from nltk.stem.lancaster import LancasterStemmer from nltk.tokenize import RegexpTokenizer from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.preprocessing import Imputer, StandardScale...
apache-2.0
sergpolly/Thermal_adapt_scripts
ArchNew/EDITING_composition_analysis_Thermo.py
1
15908
import pandas as pd import os import subprocess as sub import re import sys from Bio import SeqUtils import matplotlib.pyplot as plt import numpy as np from scipy import stats path = "." # ['DbxRefs','Description','FeaturesNum','GenomicID','GenomicLen','GenomicName','Keywords','NucsPresent','Organism_des', # 'Source...
mit
cccfran/sympy
examples/intermediate/mplot3d.py
14
1261
#!/usr/bin/env python """Matplotlib 3D plotting example Demonstrates plotting with matplotlib. """ import sys from sample import sample from sympy import sin, Symbol from sympy.external import import_module def mplot3d(f, var1, var2, show=True): """ Plot a 3d function using matplotlib/Tk. """ im...
bsd-3-clause
vigilv/scikit-learn
examples/ensemble/plot_gradient_boosting_regression.py
227
2520
""" ============================ Gradient Boosting regression ============================ Demonstrate Gradient Boosting on the Boston housing dataset. This example fits a Gradient Boosting model with least squares loss and 500 regression trees of depth 4. """ print(__doc__) # Author: Peter Prettenhofer <peter.prett...
bsd-3-clause
santosjorge/cufflinks
cufflinks/pandastools.py
1
2712
import pandas as pd import re def _screen(self,include=True,**kwargs): """ Filters a DataFrame for columns that contain the given strings. Parameters: ----------- include : bool If False then it will exclude items that match the given filters. This is the same as passing a regex ^keyword kwargs : ...
mit
lukebarnard1/bokeh
bokeh/cli/utils.py
42
8119
from __future__ import absolute_import, print_function from collections import OrderedDict from six.moves.urllib import request as urllib2 import io import pandas as pd from .. import charts from . import help_messages as hm def keep_source_input_sync(filepath, callback, start=0): """ Monitor file at filepath ch...
bsd-3-clause
benslice/ggplot
ggplot/tests/test_element_text.py
12
1362
from nose.tools import assert_equal, assert_true from ggplot.tests import image_comparison, cleanup from ggplot import * from numpy import linspace from pandas import DataFrame df = DataFrame({"blahblahblah": linspace(999, 1111, 9), "yadayadayada": linspace(999, 1111, 9)}) simple_gg = ggplot(aes(x="b...
bsd-2-clause
MikeDT/CNN_2_BBN
CNN_2_BBN_Optimiser.py
1
5940
from __future__ import print_function from hyperopt import Trials, STATUS_OK, tpe from keras.datasets import mnist from keras.layers.core import Dense, Dropout, Activation,Flatten from keras.models import Sequential from keras.utils import np_utils from Synthetic_Data_Creator import Synthetic_Data_Creator from hyperas...
apache-2.0