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
alexandrebarachant/mne-python
tutorials/plot_object_epochs.py
5
6185
""" .. _tut_epochs_objects: The :class:`Epochs <mne.Epochs>` data structure: epoched data ============================================================= """ from __future__ import print_function import mne import os.path as op import numpy as np from matplotlib import pyplot as plt ##################################...
bsd-3-clause
sinhrks/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
34
9987
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
fsimkovic/cptbx
conkit/plot/sequencecoverage.py
2
5705
# BSD 3-Clause License # # Copyright (c) 2016-19, University of Liverpool # 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 notic...
gpl-3.0
sjl767/woo
py/eudoxos.py
1
14383
# encoding: utf-8 # 2008 © Václav Šmilauer <eudoxos@arcig.cz> # # I doubt there functions will be useful for anyone besides me. # """Miscillaneous functions that are not believed to be generally usable, therefore kept in my "private" module here. They comprise notably oofem export and various CPM-related functions. ""...
gpl-2.0
wyom/sympy
sympy/physics/quantum/state.py
58
29186
"""Dirac notation for states.""" from __future__ import print_function, division from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.core.compatibility import u, range from sympy.printing.pretty.stringpict import stringPict from sympy.physics.quantum.qexpr ...
bsd-3-clause
Richert/BrainNetworks
BasalGanglia/stn_gpe_simple_cfit.py
1
6712
import os import warnings import numpy as np from pyrates.utility.genetic_algorithm import CGSGeneticAlgorithm from pandas import DataFrame, read_hdf from copy import deepcopy class CustomGOA(CGSGeneticAlgorithm): def eval_fitness(self, target: list, **kwargs): # define simulation conditions wor...
apache-2.0
pmathiot/PyChart
pychart.py
1
19903
#!/usr/bin/python import sys import argparse import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs import lib_misc as libpc def sanity_check(args): # sanity check if args.spfid: if len(args.spfid) != len(args.mapf): print('title list and file list not the same leng...
gpl-3.0
davidgbe/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause
orangehdc/GUI_for_PandF
draw_kline.py
1
4424
# -*- coding: utf-8 -*- """ Created on Wed Mar 12 19:45:23 2014 input table_name, start_price, unit @author: Administrator """ import numpy import matplotlib import sqlite3 matplotlib.use('Agg') ''' Very important! It must be put immediately after import matplotlib!''' import matplotlib.pyplot as plt def process(line)...
gpl-2.0
frank-tancf/scikit-learn
examples/ensemble/plot_gradient_boosting_regularization.py
355
2843
""" ================================ Gradient Boosting regularization ================================ Illustration of the effect of different regularization strategies for Gradient Boosting. The example is taken from Hastie et al 2009. The loss function used is binomial deviance. Regularization via shrinkage (``lear...
bsd-3-clause
AllenDowney/ThinkStats2
code/scatter.py
69
4281
"""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 """ from __future__ import print_function import sys import numpy as np import math import brfss import thinkplot import ...
gpl-3.0
Tong-Chen/scikit-learn
sklearn/ensemble/__init__.py
44
1228
""" The :mod:`sklearn.ensemble` module includes ensemble-based methods for classification and regression. """ from .base import BaseEnsemble from .forest import RandomForestClassifier from .forest import RandomForestRegressor from .forest import RandomTreesEmbedding from .forest import ExtraTreesClassifier from .fores...
bsd-3-clause
ischurov/qqmbr
qqmbr/qqhtml.py
1
57419
# (c) Ilya V. Schurov, 2016 # Available under MIT license (see LICENSE file in the root folder) from indentml.parser import QqTag from yattag import Doc import re import inspect import hashlib import os import urllib.parse from mako.template import Template from fuzzywuzzy import process from html import escape as htm...
mit
davidovitch/freeyaw-ojf-wt-tests
ojfdb_dict.py
1
97176
# -*- coding: utf-8 -*- """ Created on Wed Oct 17 17:37:00 2012 Make a database of all the test and their results @author: dave """ #import sys import os import pickle #import logging #import copy import string import shutil import numpy as np import matplotlib as mpl import pandas as pd import ojfresult import pl...
gpl-3.0
flightgong/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
249
2211
#!/usr/bin/env python """ ============================================= Joint feature selection with multi-task Lasso ============================================= The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected features to be the same across tasks. This example simulates...
bsd-3-clause
chugunovyar/factoryForBuild
env/lib/python2.7/site-packages/scipy/signal/windows.py
20
54134
"""The suite of window functions.""" from __future__ import division, print_function, absolute_import import warnings import numpy as np from scipy import fftpack, linalg, special from scipy._lib.six import string_types __all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall', 'blackmanhar...
gpl-3.0
juanchopanza/NeuroM
neurom/tests/test_viewer.py
2
3519
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project # All rights reserved. # # This file is part of NeuroM <https://github.com/BlueBrain/NeuroM> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are ...
bsd-3-clause
jereze/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
98
20870
from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.cross_validation import train_test_split from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing impor...
bsd-3-clause
nealchenzhang/Py4Invst
Market_Analysis/Futures_Market/AMH.py
1
5223
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ############################################################################### # # Created on Mon Mar 20 17:00:38 2017 # @author: NealChenZhang # This program is personal trading platform designed when employed in # Aihui Asset Management as a quantitative analyst. # # ...
mit
shl198/Pipeline
RibosomeProfilePipeline/04_RNA_process.py
2
4620
import os,sys sys.path.append('/home/shangzhong/Codes/Pipeline') from Modules.f04_htseq import htseq_count_py from natsort import natsorted from multiprocessing import Process import subprocess from Modules.f05_IDConvert import geneSymbol2EntrezID import pandas as pd from f02_RiboDataModule import * import shutil #====...
mit
rahul-c1/scikit-learn
sklearn/utils/tests/test_murmurhash.py
261
2836
# Author: Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import numpy as np from sklearn.externals.six import b, u from sklearn.utils.murmurhash import murmurhash3_32 from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from nose.tools import assert_equa...
bsd-3-clause
tacwon/DPL
wi_act_histogram.py
1
1778
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 4 07:29:40 2017 @author: tacwon """ import numpy as np import matplotlib.pyplot as plt from MultiLayerNet import DPLMultiLayerNet def sigmoid(x): return 1 / (1 + np.exp(-x)) def ReLU(x): return np.maximum(0, x) def tanh(x): return ...
mit
jungla/ICOM-fluidity-toolbox
Detectors/offline_advection/plot_diffusivity_Okubo_Cb_fast.py
1
3989
#!~/python import matplotlib as mpl mpl.use('ps') import matplotlib.pyplot as plt import myfun import numpy as np import os, csv import advect_functions import lagrangian_stats # read offline print 'reading offline' label = 'm_25_1b_particles' filename2D = './csv/RD_2D_'+label+'.csv' filename3D = './csv/RD_3D_'+labe...
gpl-2.0
cl4rke/scikit-learn
examples/linear_model/plot_lasso_coordinate_descent_path.py
254
2639
""" ===================== Lasso and Elastic Net ===================== Lasso and elastic net (L1 and L2 penalisation) implemented using a coordinate descent. The coefficients can be forced to be positive. """ print(__doc__) # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import num...
bsd-3-clause
droundy/deft
papers/thesis-scheirer/final/cotangent.py
1
10941
import scipy as sp from scipy.optimize import fsolve import pylab as plt import matplotlib import SW import numpy as np ############################################################################################### # Author: Ryan Scheirer # # Emai...
gpl-2.0
mrbeam/grbl
doc/script/fit_nonlinear_spindle.py
3
18023
""" --------------------- The MIT License (MIT) Copyright (c) 2017-2018 Sungeun K. Jeon for Gnea Research LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including withou...
gpl-3.0
diana-hep/carl
tests/ratios/test_classifier.py
1
2546
# 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 numpy.testing import assert_array_almost_equal from carl.distributions import Normal from carl.ratios import ClassifierRatio from carl.learning ...
bsd-3-clause
simvisage/oricreate
docs/conf.py
1
8690
# -*- coding: utf-8 -*- # # oricreate documentation build configuration file, created by # sphinx-quickstart on Mon Feb 27 11:03:20 2012. # # 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. # # A...
gpl-3.0
kashif/scikit-learn
examples/text/document_clustering.py
9
8357
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
bsd-3-clause
zaxtax/scikit-learn
sklearn/utils/deprecation.py
77
2417
import warnings __all__ = ["deprecated", ] class deprecated(object): """Decorator to mark a function or class as deprecated. Issue a warning when the function is called/the class is instantiated and adds a warning to the docstring. The optional extra argument will be appended to the deprecation mes...
bsd-3-clause
Rossonero/bmlswp
ch04/build_lda.py
22
2443
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License from __future__ import print_function try: import nltk.corpus except ImportError: print("nltk n...
mit
BursonLab/Silica-Coding-Project
Misc Parts/Silicon and Oxygen from Centers using Delaunay.py
1
17703
import math import numpy import matplotlib.pyplot as plt # - * - coding: utf - 8 - * - """ Created on Wed May 31 15:27:40 2017 @author: Kristen """ # - * - coding: utf - 8 - * - """ Created on Tue May 30 09:40:34 2017 @author: Kristen """ def distance(position1, position2): """ Finds the...
apache-2.0
sckott/pytaxize
pytaxize/itis/itis.py
1
35780
import sys import time import requests import warnings from enum import Enum from pytaxize.refactor import Refactor try: import pandas as pd except ImportError: warnings.warn("Pandas library not installed, dataframes disabled") pd = None itis_base = "http://www.itis.gov/ITISWebService/jsonservice/" def a...
mit
Chuban/moose
python/peacock/tests/postprocessor_tab/test_LineSettingsWidget.py
6
3957
#!/usr/bin/env python import sys from PyQt5 import QtCore, QtWidgets from peacock.PostprocessorViewer.plugins.LineSettingsWidget import main from peacock.utils import Testing class TestLineSettingsWidget(Testing.PeacockImageTestCase): """ Test class for the LineSettingsWidget. """ #: QApplication: Th...
lgpl-2.1
fredhusser/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
143
22295
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/pandas/io/tests/parser/test_read_fwf.py
7
13483
# -*- coding: utf-8 -*- """ Tests the 'read_fwf' function in parsers.py. This test suite is independent of the others because the engine is set to 'python-fwf' internally. """ from datetime import datetime import nose import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import DataFra...
mit
harisbal/pandas
pandas/tests/indexes/multi/test_duplicates.py
2
9505
# -*- coding: utf-8 -*- from itertools import product import numpy as np import pytest import pandas.util.testing as tm from pandas import DatetimeIndex, MultiIndex from pandas._libs import hashtable from pandas.compat import range, u @pytest.mark.parametrize('names', [None, ['first', 'second']]) def test_unique(n...
bsd-3-clause
jorge2703/scikit-learn
sklearn/cluster/tests/test_k_means.py
132
25860
"""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
cfriedt/gnuradio
gr-dtv/examples/atsc_ctrlport_monitor.py
21
6089
#!/usr/bin/env python # # Copyright 2015 Free Software Foundation # # 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, or (at your option) # any later version. # # This program is...
gpl-3.0
billy-inn/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
240
6055
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises, assert_greater, ...
bsd-3-clause
lucidfrontier45/scikit-learn
sklearn/tests/test_common.py
1
30811
""" General tests for all estimators in sklearn. """ # Authors: Andreas Mueller <amueller@ais.uni-bonn.de> # Gael Varoquaux gael.varoquaux@normalesup.org # License: BSD Style. import os import warnings import sys import traceback import inspect import numpy as np from scipy import sparse from sklearn.utils....
bsd-3-clause
EvanzzzZ/mxnet
example/rcnn/rcnn/pycocotools/coco.py
17
18296
__author__ = 'tylin' __version__ = '2.0' # 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 visualizing the annotations in COCO. # Pleas...
apache-2.0
DiCarloLab-Delft/PycQED_py3
pycqed/simulations/ramsey_simulations_v2.py
1
15596
from importlib import reload from pycqed.measurement import measurement_control as mc import adaptive from pycqed.instrument_drivers.meta_instrument.LutMans import flux_lutman_vcz as flm from pycqed.instrument_drivers.virtual_instruments import sim_control_CZ_v2 as scCZ_v2 from pycqed.simulations import cz_superopera...
mit
lancezlin/ml_template_py
lib/python2.7/site-packages/sklearn/datasets/samples_generator.py
7
56557
""" Generate samples of synthetic data sets. """ # Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel, # G. Louppe, J. Nothman # License: BSD 3 clause import numbers import array import numpy as np from scipy import linalg import scipy.sparse as sp from ..preprocessing import MultiLabelBin...
mit
gfyoung/pandas
pandas/tests/io/pytables/test_time_series.py
1
1931
import datetime import numpy as np import pytest from pandas import DataFrame, Series, _testing as tm from pandas.tests.io.pytables.common import ensure_clean_store pytestmark = pytest.mark.single def test_store_datetime_fractional_secs(setup_path): with ensure_clean_store(setup_path) as store: dt = d...
bsd-3-clause
gnauhnoj/coco
PythonAPI/pycocotools/coco.py
4
14801
__author__ = 'tylin' __version__ = '1.0.1' # 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 visualizing the annotations in COCO. # Ple...
bsd-2-clause
jamessergeant/pylearn2
pylearn2/cross_validation/tests/test_cross_validation.py
49
6767
""" Tests for cross-validation module. """ import os import tempfile from pylearn2.config import yaml_parse from pylearn2.testing.skip import skip_if_no_sklearn def test_train_cv(): """Test TrainCV class.""" skip_if_no_sklearn() handle, layer0_filename = tempfile.mkstemp() handle, layer1_filename = t...
bsd-3-clause
dongjoon-hyun/spark
python/pyspark/pandas/data_type_ops/udt_ops.py
14
1092
# # 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
jamesnorth/libsim
libsim.py
2
8119
# -*- coding: utf-8 -*- ### libsim - My Simulation Library ### ============================== ### ### Copyright © 2009, James North ### ### Permission is hereby granted, free of charge, to any person ### obtaining a copy of this software and associated documentation ### files (the "Software"), to deal in the Software...
mit
blbarker/spark-tk
integration-tests/tests/test_frame_pandas.py
12
1882
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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 require...
apache-2.0
jreback/pandas
asv_bench/benchmarks/io/csv.py
1
12945
from io import BytesIO, StringIO import random import string import numpy as np from pandas import Categorical, DataFrame, date_range, read_csv, to_datetime from ..pandas_vb_common import BaseIO, tm class ToCSV(BaseIO): fname = "__test__.csv" params = ["wide", "long", "mixed"] param_names = ["kind"] ...
bsd-3-clause
soravux/skymangler
test_AE.py
1
22909
""" This tutorial introduces denoising auto-encoders (dA) using Theano. Denoising autoencoders are the building blocks for SdA. They are based on auto-encoders as the ones used in Bengio et al. 2007. An autoencoder takes an input x and first maps it to a hidden representation y = f_{\theta}(x) = s(Wx+b), paramete...
lgpl-3.0
fmv1992/data_utilities
data_utilities/tests/test_pandas_utilities.py
1
9769
"""Test pandas_utilities from this module.""" import itertools import random import unittest import numpy as np import pandas as pd from data_utilities import pandas_utilities as pu from data_utilities.tests.test_support import ( TestDataUtilitiesTestCase, TestMetaClass) def setUpModule(): """Set up TestDa...
gpl-3.0
cwu2011/scikit-learn
sklearn/feature_extraction/tests/test_text.py
75
34122
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.fe...
bsd-3-clause
kevinyu98/spark
python/pyspark/sql/functions.py
4
135164
# # 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
yk-tanigawa/QLoop-dev
old/src/plt_res.py
1
5265
import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd from scipy import io import math import argparse import os.path sns.set_style("ticks") sns.set_context("paper", font_scale=2.0) def read_res(file): names = ('axis', 'gamma', 'residu...
mit
rknLA/sms-tools
lectures/09-Sound-description/plots-code/knn.py
25
1718
import numpy as np import matplotlib.pyplot as plt from matplotlib.lines import Line2D import os, sys from numpy import random from scipy.stats import mode def eucDist(vec1, vec2): return np.sqrt(np.sum(np.power(np.array(vec1) - np.array(vec2), 2))) n = 30 qn = 8 K = 3 class1 = np.transpose(np.array([np.random.norm...
agpl-3.0
mpa46/PiNN_Caffe2
dc_iv_api.py
1
15457
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
jmcq89/megaman
examples/megaman_tutorial.py
4
14494
## Example: Synethetic Data ''' In this tutorial we're going to use a synthetic data set in particular one that lies on a 2 dimensional manifold in 3 dimensional space that can be embedded isometrically into 2 dimensions -- an S curve. ''' import numpy as np from sklearn import datasets N = 1000 X, color = datasets.sam...
bsd-2-clause
deepakantony/sms-tools
lectures/05-Sinusoidal-model/plots-code/sineModel-anal-synth.py
24
1483
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, triang, blackmanharris import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import sineModel as SM import utilFunctions as UF (fs, x) = UF.wavread(os.p...
agpl-3.0
CompPhysics/ComputationalPhysics2
doc/src/MCsummary/src/qdoteminim.py
2
5916
# 2-electron VMC code for 2dim quantum dot with importance sampling # Using gaussian rng for new positions and Metropolis- Hastings # Added energy minimization # Common imports from math import exp, sqrt from random import random, seed, normalvariate import numpy as np import matplotlib.pyplot as plt from mpl_toolkits...
cc0-1.0
shenzebang/scikit-learn
sklearn/cluster/bicluster.py
211
19443
"""Spectral biclustering algorithms. Authors : Kemal Eren License: BSD 3 clause """ from abc import ABCMeta, abstractmethod import numpy as np from scipy.sparse import dia_matrix from scipy.sparse import issparse from . import KMeans, MiniBatchKMeans from ..base import BaseEstimator, BiclusterMixin from ..external...
bsd-3-clause
mwengren/sensorml2iso
sensorml2iso/sensorml2iso.py
1
35374
import os import errno import io import sys from datetime import datetime, timedelta from dateutil import parser import pytz from six import iteritems try: from urllib.parse import unquote, unquote_plus, urlencode, urlparse # Python 3 except ImportError: from urllib import unquote, unquote_plus, urlencode #...
mit
deepakantony/sms-tools
workspace/A4/submitA4.py
1
10889
### The only things you'll have to edit (unless you're porting this script over to a different language) ### are at the bottom of this file. import urllib import urllib2 import email import email.message import email.encoders import sys import pickle import json import base64 import numpy as np import subprocess impor...
agpl-3.0
foxtrotmike/pairpred
analyzeTAC.py
1
4918
# -*- coding: utf-8 -*- """ Created on Thu Jun 27 22:44:32 2013 Plots the binding associated changes in torsion angles after clustering analysis for a number of proteins @author: root """ import numpy as np import myPickle from scipy.cluster.vq import * import matplotlib import matplotlib.pyplot as plt #from scipy.spat...
gpl-3.0
leesavide/pythonista-docs
Documentation/matplotlib/mpl_examples/api/scatter_piecharts.py
6
1194
""" This example makes custom 'pie charts' as the markers for a scatter plotqu Thanks to Manuel Metz for the example """ import math import numpy as np import matplotlib.pyplot as plt # first define the ratios r1 = 0.2 # 20% r2 = r1 + 0.4 # 40% # define some sizes of the scatter marker sizes = [60,80,120] # ca...
apache-2.0
larsoner/mne-python
examples/stats/plot_linear_regression_raw.py
18
2385
""" ======================================== Regression on continuous data (rER[P/F]) ======================================== This demonstrates how rER[P/F]s - regressing the continuous data - is a generalisation of traditional averaging. If all preprocessing steps are the same, no overlap between epochs exists, and ...
bsd-3-clause
Garrett-R/scikit-learn
sklearn/cross_decomposition/cca_.py
18
3129
from .pls_ import _PLS __all__ = ['CCA'] class CCA(_PLS): """CCA Canonical Correlation Analysis. CCA inherits from PLS with mode="B" and deflation_mode="canonical". Parameters ---------- n_components : int, (default 2). number of components to keep. scale : boolean, (default True) ...
bsd-3-clause
nathanielvarona/airflow
docs/conf.py
1
22928
# flake8: noqa # Disable Flake8 because of all the sphinx imports # # 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 un...
apache-2.0
sanketloke/scikit-learn
sklearn/exceptions.py
35
4329
""" The :mod:`sklearn.exceptions` module includes all custom warnings and error classes used across scikit-learn. """ __all__ = ['NotFittedError', 'ChangedBehaviorWarning', 'ConvergenceWarning', 'DataConversionWarning', 'DataDimensionalityWarning', 'EfficiencyWarn...
bsd-3-clause
penguinscontrol/Spinal-Cord-Modeling
Python/run_main.py
1
1581
debugging = 1 import os from neuron import h if debugging: from neuron import gui else: h.load_file('noload.hoc') from mpi4py import MPI from matplotlib import pyplot from neuronpy.graphics import spikeplot import helper_functions as hf import Ia_network as Ia_net os.chdir('E:\\Google Drive\\Github\\Spinal-C...
gpl-2.0
annahs/atmos_research
WHI_2012_incand_calib.py
1
2195
import sys import os import datetime import pickle import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.colors as colors from pprint import pprint import sqlite3 import calendar from datetime import datetime from datetime import timedelta import math import numpy.polynomial.po...
mit
YerevaNN/mimic3-benchmarks
mimic3models/phenotyping/logistic/main.py
1
5894
from __future__ import absolute_import from __future__ import print_function from sklearn.preprocessing import Imputer, StandardScaler from sklearn.linear_model import LogisticRegression from mimic3benchmark.readers import PhenotypingReader from mimic3models import common_utils from mimic3models import metrics from mi...
mit
astocko/statsmodels
statsmodels/tools/print_version.py
23
7951
#!/usr/bin/env python from __future__ import print_function from statsmodels.compat.python import reduce import sys from os.path import dirname def safe_version(module, attr='__version__'): if not isinstance(attr, list): attr = [attr] try: return reduce(getattr, [module] + attr) except Att...
bsd-3-clause
hsaputra/tensorflow
tensorflow/examples/learn/iris_custom_decay_dnn.py
43
3572
# 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 appl...
apache-2.0
Winand/pandas
pandas/plotting/_compat.py
11
1602
# being a bit too dynamic # pylint: disable=E1101 from __future__ import division from distutils.version import LooseVersion def _mpl_le_1_2_1(): try: import matplotlib as mpl return (str(mpl.__version__) <= LooseVersion('1.2.1') and str(mpl.__version__)[0] != '0') except Impo...
bsd-3-clause
Srisai85/scikit-learn
examples/mixture/plot_gmm_pdf.py
284
1528
""" ============================================= Density Estimation for a mixture of Gaussians ============================================= Plot the density estimation of a mixture of two Gaussians. Data is generated from two Gaussians with different centers and covariance matrices. """ import numpy as np import ma...
bsd-3-clause
bbfamily/abu
abupy/UtilBu/ABuDateUtil.py
1
10596
# -*- encoding:utf-8 -*- """ 时间日期工具模块 """ from __future__ import print_function from __future__ import absolute_import from __future__ import division import datetime import time from datetime import datetime as dt from ..CoreBu.ABuFixes import six # noinspection PyUnresolvedReferences from ..CoreBu.ABuFixes imp...
gpl-3.0
BrentVanwildemeersch/ML_StockPrediction
Flask Test/flasktest.py
1
6999
from flask import Flask, request from flask import render_template from datetime import datetime,timedelta import pandas_datareader.data as web from sklearn import linear_model from sklearn.cross_validation import train_test_split import tensorflow as tf from keras.models import Sequential from keras.layers import Acti...
apache-2.0
yashchandak/GNN
Sample_Run/Dynamic_Bi/Eval_Calculate_Performance.py
3
4587
from sklearn.metrics import coverage_error from sklearn.metrics import label_ranking_loss from sklearn.metrics import label_ranking_average_precision_score from sklearn.metrics import hamming_loss from sklearn import metrics from collections import Counter import math import numpy as np def patk(predictions, labels):...
mit
tmerrick1/spack
var/spack/repos/builtin/packages/r-viridis/package.py
5
1803
############################################################################## # Copyright (c) 2013-2018, 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
jat255/hyperspy
hyperspy/drawing/_widgets/range.py
4
22490
# -*- coding: utf-8 -*- # Copyright 2007-2020 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
gpl-3.0
mr3bn/DAT210x
Module5/assignment8.py
1
4856
import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') # Look Pretty def drawLine(model, X_test, y_test, title): # This convenience method will take care of plotting your # test observations, comparing them to the regression line, # an...
mit
AminMahpour/pyHeat
pyHeat2.py
1
5772
#!/usr/bin/env python3 import operator import pyBigWig import sys import matplotlib.pyplot as pp import numpy as np bed1 = "" bw1 = "" bw2 = "" bw3 = "" bw4 = "" class BigwigObj: def __init__(self, url): myurl = url self.bw = pyBigWig.open(myurl) def get_scores(self, pos): return s...
gpl-2.0
jkarnows/scikit-learn
examples/neighbors/plot_nearest_centroid.py
264
1804
""" =============================== Nearest Centroid Classification =============================== Sample usage of Nearest Centroid classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap f...
bsd-3-clause
seanli9jan/tensorflow
tensorflow/contrib/learn/python/learn/estimators/kmeans.py
27
11083
# 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
tmhm/scikit-learn
examples/neighbors/plot_classification.py
287
1790
""" ================================ Nearest Neighbors Classification ================================ Sample usage of Nearest Neighbors classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColorm...
bsd-3-clause
JrtPec/opengrid
opengrid/library/forecastwrapper.py
1
19719
# -*- coding: utf-8 -*- __author__ = 'Jan Pecinovsky' import datetime as dt import forecastio from forecastio.models import Forecast from geopy import Location, Point, GoogleV3 import numpy as np import pandas as pd import pytz from cached_property import cached_property from tqdm import tqdm import os import pickle ...
apache-2.0
guillaumedavidphd/simple-data-science-challenges
Challenge1/counting_vitae.py
1
3459
"""This script converts my LaTeX resume into a text file then reads it and count the number of characters for each character. Finally, the result is plotted as a histogram. """ import pandas as pd import re import matplotlib.pyplot as plt import matplotlib from subprocess import call import string matplotlib.style.us...
gpl-3.0
Djabbz/scikit-learn
examples/gaussian_process/plot_gpr_noisy.py
104
3778
""" ============================================================= Gaussian process regression (GPR) with noise-level estimation ============================================================= This example illustrates that GPR with a sum-kernel including a WhiteKernel can estimate the noise level of data. An illustration...
bsd-3-clause
espenhgn/nest-simulator
pynest/examples/brunel_alpha_nest.py
2
13724
# -*- coding: utf-8 -*- # # brunel_alpha_nest.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 Licen...
gpl-2.0
EPFL-LCSB/pytfa
doc/conf.py
1
6034
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # pytfa documentation build configuration file, created by # sphinx-quickstart on Sat Jul 1 12:44:20 2017. # # 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 # auto...
apache-2.0
kcavagnolo/astroML
book_figures/chapter3/fig_beta_distribution.py
3
2433
""" Example of a Beta distribution ------------------------------ Figure 3.17. This shows an example of a beta distribution with various parameters. We'll generate the distribution using:: dist = scipy.stats.beta(...) Where ... should be filled in with the desired distribution parameters Once we have defined the...
bsd-2-clause
rcrowder/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_emf.py
69
22336
""" Enhanced Metafile backend. See http://pyemf.sourceforge.net for the EMF driver library. """ from __future__ import division try: import pyemf except ImportError: raise ImportError('You must first install pyemf from http://pyemf.sf.net') import os,sys,math,re from matplotlib import verbose, __version__,...
agpl-3.0
mfjb/scikit-learn
benchmarks/bench_plot_svd.py
325
2899
"""Benchmarks of Singular Value Decomposition (Exact and Approximate) The data is mostly low rank but is a fat infinite tail. """ import gc from time import time import numpy as np from collections import defaultdict from scipy.linalg import svd from sklearn.utils.extmath import randomized_svd from sklearn.datasets.s...
bsd-3-clause
ky822/scikit-learn
examples/svm/plot_svm_anova.py
250
2000
""" ================================================= SVM-Anova: SVM with univariate feature selection ================================================= This example shows how to perform univariate feature before running a SVC (support vector classifier) to improve the classification scores. """ print(__doc__) import...
bsd-3-clause
ashhher3/scikit-learn
examples/decomposition/plot_pca_iris.py
253
1801
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= PCA example with Iris Data-set ========================================================= Principal Component Analysis applied to the Iris dataset. See `here <http://en.wikipedia.org/wiki/Iris_flower_data_set>`_ fo...
bsd-3-clause
rahuldhote/scikit-learn
benchmarks/bench_lasso.py
297
3305
""" Benchmarks of Lasso vs LassoLars First, we fix a training set and increase the number of samples. Then we plot the computation time as function of the number of samples. In the second benchmark, we increase the number of dimensions of the training set. Then we plot the computation time as function of the number o...
bsd-3-clause
alexsavio/scikit-learn
examples/mixture/plot_gmm_covariances.py
89
4724
""" =============== GMM covariances =============== Demonstration of several covariances types for Gaussian mixture models. See :ref:`gmm` for more information on the estimator. Although GMM are often used for clustering, we can compare the obtained clusters with the actual classes from the dataset. We initialize th...
bsd-3-clause
deepesch/scikit-learn
examples/missing_values.py
233
3056
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause