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
MartinDelzant/scikit-learn
sklearn/datasets/lfw.py
141
19372
"""Loader for the Labeled Faces in the Wild (LFW) dataset This dataset is a collection of JPEG pictures of famous people collected over the internet, all details are available on the official website: http://vis-www.cs.umass.edu/lfw/ Each picture is centered on a single face. The typical task is called Face Veri...
bsd-3-clause
crichardson17/starburst_atlas
Low_resolution_sims/DustFree_LowRes/Geneva_noRot_cont/Geneva_noRot_cont_age4/peaks_reader.py
33
2761
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # ---------------------------------------------------...
gpl-2.0
mprelee/data-incubator-capstone
src/tinker.py
1
1701
# Look at words # Matt Prelee import pandas as pd import numpy as np import matplotlib #matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sns import pickle import nltk import re from sklearn import base from sklearn.linear_model import LinearRegression, Lasso, ElasticNet from sklearn.feature_extr...
gpl-2.0
vivekmishra1991/scikit-learn
sklearn/linear_model/stochastic_gradient.py
65
50308
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np import scipy.sparse as sp from abc import ABCMeta, abstractmethod from ...
bsd-3-clause
jpautom/scikit-learn
sklearn/__check_build/__init__.py
345
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
kambysese/mne-python
tutorials/misc/plot_report.py
3
13606
""" .. _tut-report: Getting started with ``mne.Report`` =================================== This tutorial covers making interactive HTML summaries with :class:`mne.Report`. As usual we'll start by importing the modules we need and loading some :ref:`example data <sample-dataset>`: """ import os import matplotlib.py...
bsd-3-clause
dikien/Machine-Learning-Newspaper
nytimes/step4_BernoulliNB.py
1
2163
# -*- coding: UTF-8 -*- from time import time from step3_feature_engineering import preprocess_2 from sklearn.naive_bayes import BernoulliNB from nltk.stem.snowball import SnowballStemmer import numpy as np features, labels, vectorizer, selector, le = preprocess_2("pkl/article_2_people.pkl", "pkl/lable_2_people.pkl")...
bsd-3-clause
GaZ3ll3/scikit-image
doc/examples/plot_blob.py
18
2796
""" ============== Blob Detection ============== Blobs are bright on dark or dark on bright regions in an image. In this example, blobs are detected using 3 algorithms. The image used in this case is the Hubble eXtreme Deep Field. Each bright dot in the image is a star or a galaxy. Laplacian of Gaussian (LoG) -------...
bsd-3-clause
vortex-exoplanet/VIP
vip_hci/var/shapes.py
2
27456
#! /usr/bin/env python """ Module with various functions to create shapes, annuli and segments. """ __author__ = 'Carlos Alberto Gomez Gonzalez' __all__ = ['dist', 'dist_matrix', 'frame_center', 'get_square', 'get_circle', 'get_ellipse', 'get_annulus_s...
mit
mugizico/scikit-learn
sklearn/tests/test_kernel_approximation.py
244
7588
import numpy as np from scipy.sparse import csr_matrix from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true from sklearn.utils.testing import assert_not_equal from sklearn.utils.testing import assert_array_almost_equal, assert_raises from sklearn.utils.testing import assert_less_equal from ...
bsd-3-clause
GedRap/voyager
backtesting/Portfolio.py
2
5132
import pandas as pd import numpy as np import math import copy import QSTK.qstkutil.qsdateutil as du import datetime as dt import QSTK.qstkutil.DataAccess as da import QSTK.qstkutil.tsutil as tsu from pandas import * #Holds portfolio related data such as cash available and assets held #Performs calculations related t...
mit
yousrabk/mne-python
examples/forward/plot_make_forward.py
20
2669
""" ====================================================== Create a forward operator and display sensitivity maps ====================================================== Sensitivity maps can be produced from forward operators that indicate how well different sensor types will be able to detect neural currents from diff...
bsd-3-clause
jreback/pandas
pandas/tests/io/parser/test_c_parser_only.py
1
23042
""" Tests that apply specifically to the CParser. Unless specifically stated as a CParser-specific issue, the goal is to eventually move as many of these tests out of this module as soon as the Python parser can accept further arguments when parsing. """ from io import BytesIO, StringIO, TextIOWrapper import mmap impo...
bsd-3-clause
nickgentoo/scikit-learn-graph
scripts/Keras_calculate_cv_allkernels.py
1
7678
# -*- coding: utf-8 -*- """ Created on Fri Mar 13 13:02:41 2015 Copyright 2015 Nicolo' Navarin This file is part of scikit-learn-graph. scikit-learn-graph 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 ...
gpl-3.0
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/sklearn/feature_selection/tests/test_feature_select.py
10
26399
""" 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 numpy.testing import run_module_suite from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from...
mit
plotly/plotly.py
packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py
2
1336
from __future__ import absolute_import import pytest from plotly import optional_imports from plotly.tests.utils import compare_dict, strip_dict_params from plotly.tests.test_optional.optional_utils import run_fig from plotly.tests.test_optional.test_matplotlylib.data.axis_scales import * matplotlylib = optional_imp...
mit
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/matplotlib/blocking_input.py
10
11766
""" This provides several classes used for blocking interaction with figure windows: :class:`BlockingInput` creates a callable object to retrieve events in a blocking way for interactive sessions :class:`BlockingKeyMouseInput` creates a callable object to retrieve key or mouse clicks in a blocking way...
gpl-3.0
linebp/pandas
pandas/tests/sparse/test_combine_concat.py
15
13923
# pylint: disable-msg=E1101,W0612 import numpy as np import pandas as pd import pandas.util.testing as tm class TestSparseSeriesConcat(object): def test_concat(self): val1 = np.array([1, 2, np.nan, np.nan, 0, np.nan]) val2 = np.array([3, np.nan, 4, 0, 0]) for kind in ['integer', 'block'...
bsd-3-clause
sgranitz/nw
predict400/week9.py
2
1496
## Week 9: Probability Density Functions # Consider the probability density function f(x) = (3/26)x2 on [1, 3]. # On the same interval, consider the functions g(x) = (3/26)x3 and # h(x) = (x – 30/13)(3/26)x3, which when integrated over the interval [1, 3] # represent the mean and variance, respectively. Using Python...
mit
krez13/scikit-learn
sklearn/neighbors/approximate.py
30
22370
"""Approximate nearest neighbor search""" # Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # Joel Nothman <joel.nothman@gmail.com> import numpy as np import warnings from scipy import sparse from .base import KNeighborsMixin, RadiusNeighborsMixin from ..base import BaseEstimator from ..utils.va...
bsd-3-clause
davidwhogg/Avast
code/triangle_basis.py
1
10392
""" This file is part of the Avast project. Copyright 2016 Megan Bedell (Chicago) and David W. Hogg (NYU). """ import glob import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, FormatStrFormatter from scipy.optimize import minimize from scipy.linalg import svd from scipy.io.i...
mit
larsoner/mne-python
mne/tests/test_label.py
8
41281
from itertools import product import glob import os import os.path as op import pickle import shutil import numpy as np from scipy import sparse from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_equal) import pytest from mne.datasets import testing from mne ...
bsd-3-clause
Divergent914/kddcup2015
modeling.py
1
8187
#! /usr/local/bin/python3 # -*- utf-8 -*- """ Generate model with respect to dataset. """ import logging import sys import util import dataset logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(asctime)s %(name)s %(levelname)s\t%(message)s') logger = logging.getLogger('modeli...
gpl-2.0
martinggww/lucasenlights
MachineLearning/DataScience/SparkKMeans.py
3
1894
from pyspark.mllib.clustering import KMeans from numpy import array, random from math import sqrt from pyspark import SparkConf, SparkContext from sklearn.preprocessing import scale K = 5 # Boilerplate Spark stuff: conf = SparkConf().setMaster("local").setAppName("SparkKMeans") sc = SparkContext(conf = conf...
cc0-1.0
chanceraine/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/texmanager.py
69
16818
""" This module supports embedded TeX expressions in matplotlib via dvipng and dvips for the raster and postscript backends. The tex and dvipng/dvips information is cached in ~/.matplotlib/tex.cache for reuse between sessions Requirements: * latex * \*Agg backends: dvipng * PS backend: latex w/ psfrag, dvips, and Gh...
agpl-3.0
namvo88/Thesis-Quadrotor-Code
sw/airborne/test/math/compare_utm_enu.py
77
2714
#!/usr/bin/env python from __future__ import division, print_function, absolute_import import sys import os PPRZ_SRC = os.getenv("PAPARAZZI_SRC", "../../../..") sys.path.append(PPRZ_SRC + "/sw/lib/python") from pprz_math.geodetic import * from pprz_math.algebra import DoubleRMat, DoubleEulers, DoubleVect3 from math ...
gpl-2.0
dhhjx880713/GPy
GPy/plotting/plotly_dep/plot_definitions.py
4
16743
#=============================================================================== # Copyright (c) 2015, Max Zwiessele # 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...
bsd-3-clause
anugrah-saxena/pycroscopy
pycroscopy/io/translators/beps_data_generator.py
1
26908
""" Utility functions for the Fake BEPS generator """ import os import numpy as np from PIL import Image from sklearn.utils import gen_batches from skimage.measure import block_reduce # Pycroscopy imports from ..io_hdf5 import ioHDF5 from ..hdf_utils import calc_chunks, getH5DsetRefs, link_as_main, get_attr, buildRedu...
mit
zhoulingjun/zipline
tests/modelling/test_modelling_algo.py
9
7105
""" Tests for Algorithms running the full FFC stack. """ from unittest import TestCase from os.path import ( dirname, join, realpath, ) from numpy import ( array, full_like, nan, ) from numpy.testing import assert_almost_equal from pandas import ( concat, DataFrame, DatetimeIndex, ...
apache-2.0
ZenDevelopmentSystems/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
244
1593
import numpy as np import scipy.sparse as sp from nose.tools import assert_raises, assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.linear_model import SGD...
bsd-3-clause
zaxtax/scikit-learn
examples/linear_model/plot_logistic_l1_l2_sparsity.py
384
2601
""" ============================================== L1 Penalty and Sparsity in Logistic Regression ============================================== Comparison of the sparsity (percentage of zero coefficients) of solutions when L1 and L2 penalty are used for different values of C. We can see that large values of C give mo...
bsd-3-clause
datacommonsorg/tools
stat_var_renaming/stat_var_renaming.py
1
27748
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
apache-2.0
haisland0909/Denoising-Dirty-Documents
script/classify.py
1
4675
''' Created on 2015/08/28 @author: haisland0909 ''' from sklearn.pipeline import FeatureUnion from sklearn.grid_search import GridSearchCV from sklearn import cross_validation from sklearn import preprocessing from sklearn.metrics import mean_absolute_error import sklearn.linear_model import sklearn.ensemble import im...
apache-2.0
h2educ/scikit-learn
examples/neighbors/plot_regression.py
349
1402
""" ============================ Nearest Neighbors regression ============================ Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpolation of the target using both barycenter and constant weights. """ print(__doc__) # Author: Alexandre Gramfort <alexandre.gramfort@...
bsd-3-clause
maweigert/biobeam
tests/test_core/test_dn_mode.py
1
1287
""" mweigert@mpi-cbg.de """ from __future__ import absolute_import from __future__ import print_function import numpy as np from biobeam import Bpm3d from six.moves import zip import matplotlib.pyplot as plt def test_plane(): dx = .02 lam = .5 Nx = 128 Ny = 256 Nz = 400 dn0 = .1 dn = d...
bsd-3-clause
alexsavio/scikit-learn
sklearn/decomposition/__init__.py
76
1490
""" 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, non_negative_factorization from .pca import PCA, Ra...
bsd-3-clause
JapuDCret/RocketMap-Do
pogom/geofence.py
14
5762
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import timeit import logging from .utils import get_args log = logging.getLogger(__name__) args = get_args() # Trying to import matplotlib, which is not compatible with all hardware. # Matlplotlib is faster for big calculations. try: from matplotlib.path imp...
agpl-3.0
lweasel/piquant
test/test_tpms.py
1
7975
import numpy as np import numpy.testing as npt import pandas as pd import piquant.tpms as t REAL_TPMS_VALS = [0.05, 0.02, 15, 2, 10, 30, 11] CALC_TPMS_VALS = [0.03, 20, 3, 0.01, 5, 20, 10] GROUPS = [0, 1, 0, 1, 0, 1, 1] GROUP_TEST_COL = "group_test" NOT_PRESENT_CUTOFF = 0.1 def _get_test_tpms(): tpms = pd.DataF...
mit
cadowd/proppy
plane_estimate.py
1
4272
# -*- coding: utf-8 -*- """ Created on Wed Aug 10 12:04:48 2016 Flying wing drag polar estimator for low Re model scales @author: c.dowd """ import numpy as np import consumption_functions import matplotlib.pyplot as plt def getSpans(U_stall, plane, atmosphere): """ Returns the drag of a given pl...
gpl-3.0
rahuldhote/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
234
12267
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/examples/api/radar_chart.py
3
6539
import numpy as np import matplotlib.pyplot as plt from matplotlib.projections.polar import PolarAxes from matplotlib.projections import register_projection def radar_factory(num_vars, frame='circle'): """Create a radar chart with `num_vars` axes.""" # calculate evenly-spaced axis angles theta = 2*np...
gpl-2.0
gigglesninja/senior-design
MissionPlanner/Lib/site-packages/scipy/signal/fir_filter_design.py
53
18572
"""Functions for FIR filter design.""" from math import ceil, log import numpy as np from numpy.fft import irfft from scipy.special import sinc import sigtools # Some notes on function parameters: # # `cutoff` and `width` are given as a numbers between 0 and 1. These # are relative frequencies, expressed as a fracti...
gpl-2.0
anthrotype/freetype-py
examples/glyph-outline.py
3
1282
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # FreeType high-level python API - Copyright 2011-2015 Nicolas P. Rougier # Distributed under the terms of the new BSD license. # # ----------------------------------------------------------...
bsd-3-clause
kylerbrown/scikit-learn
examples/applications/plot_outlier_detection_housing.py
243
5577
""" ==================================== Outlier detection on a real data set ==================================== This example illustrates the need for robust covariance estimation on a real data set. It is useful both for outlier detection and for a better understanding of the data structure. We selected two sets o...
bsd-3-clause
catalyst-cooperative/pudl
src/pudl/analysis/service_territory.py
1
19410
""" Compile historical utility and balancing area territories. Use the mapping of utilities to counties, and balancing areas to utilities, available within the EIA 861, in conjunction with the US Census geometries for counties, to infer the historical spatial extent of utility and balancing area territories. Output th...
mit
weaponsjtu/Kaggle_xBle
gen_ensemble.py
1
19995
### # ensemble.py # author: Weipeng Zhang # # # 1. check each weight by hyperopt # 2. apply the weight to train/test ### from sklearn.metrics import mean_squared_error as MSE from sklearn.linear_model import LinearRegression, LogisticRegression, Ridge import cPickle as pickle import numpy as np import pandas as pd im...
gpl-2.0
wzbozon/statsmodels
statsmodels/examples/ex_kernel_semilinear_dgp.py
33
4969
# -*- coding: utf-8 -*- """ Created on Sun Jan 06 09:50:54 2013 Author: Josef Perktold """ from __future__ import print_function if __name__ == '__main__': import numpy as np import matplotlib.pyplot as plt #from statsmodels.nonparametric.api import KernelReg import statsmodels.sandbox.nonparametr...
bsd-3-clause
avistous/QSTK
qstkstrat/strategies.py
2
9521
''' (c) 2011, 2012 Georgia Tech Research Corporation This source code is released under the New BSD license. Please see http://wiki.quantsoftware.org/index.php?title=QSTK_License for license details. Created on Sep 27, 2011 @author: John Cornwell @contact: JohnWCornwellV@gmail.com @summary: Various simple trading st...
bsd-3-clause
storpipfugl/airflow
airflow/hooks/presto_hook.py
37
2626
from builtins import str from pyhive import presto from pyhive.exc import DatabaseError from airflow.hooks.dbapi_hook import DbApiHook import logging logging.getLogger("pyhive").setLevel(logging.INFO) class PrestoException(Exception): pass class PrestoHook(DbApiHook): """ Interact with Presto through ...
apache-2.0
poldrack/myconnectome
myconnectome/taskfmri/encoding_model.py
2
3311
""" do encoding model across sessions """ import os,glob,sys,ctypes import nibabel.gifti.giftiio import numpy import sklearn.linear_model from myconnectome.utils.array_to_gifti import array_to_gifti_32k basedir = os.environ['MYCONNECTOME_DIR'] datadir='/corral-repl/utexas/poldracklab/data/selftracking' def get_codes...
mit
stulp/dmpbbo
demos_cpp/dynamicalsystems/demoExponentialSystemWrapper.py
1
2205
# This file is part of DmpBbo, a set of libraries and programs for the # black-box optimization of dynamical movement primitives. # Copyright (C) 2014 Freek Stulp, ENSTA-ParisTech # # DmpBbo is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as publis...
lgpl-2.1
araichev/make_gtfs
tests/test_main.py
1
6169
import pandas as pd import gtfs_kit as gk import shapely.geometry as sg import geopandas as gpd from .context import make_gtfs, DATA_DIR from make_gtfs import * # Load test ProtoFeed pfeed = read_protofeed(DATA_DIR / "auckland") def test_get_duration(): ts1 = "01:01:01" ts2 = "01:05:01" get = get_durat...
mit
eclee25/flu-SDI-exploratory-age
scripts/Znorm_OR_relative.py
1
9452
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 4/9/14 ###Function: calculate average z-ORs where the early warning and classification periods are defined as relative dates ## early warning period begins on the week after Thanksgiving and the two su...
mit
ChinaQuants/pyfolio
setup.py
1
2520
#!/usr/bin/env python from setuptools import setup import versioneer DISTNAME = 'pyfolio' DESCRIPTION = "pyfolio is a Python library for performance and risk analysis of financial portfolios" LONG_DESCRIPTION = """pyfolio is a Python library for performance and risk analysis of financial portfolios developed by `Qua...
apache-2.0
bmazin/ARCONS-pipeline
examples/Pal2012-sdss/curve_average.py
1
2036
import numpy as np import matplotlib.pyplot as plt from util import utils t08 = np.load('/home/pszypryt/sdss_data/20121208/Blue-Fit.npz') t10 = np.load('/home/pszypryt/sdss_data/20121210/Blue10-Fit.npz') t11 = np.load('/home/pszypryt/sdss_data/20121211/seq5Blue-Fit.npz') params08 = t08['params'] params10 = t10['param...
gpl-2.0
Caranarq/01_Dmine
07_Movilidad/P0706/P0706.py
1
3153
# -*- coding: utf-8 -*- """ Started on tue, feb 21st, 2018 @author: carlos.arana """ # Librerias utilizadas import pandas as pd import sys module_path = r'D:\PCCS\01_Dmine\Scripts' if module_path not in sys.path: sys.path.append(module_path) from VarInt.VarInt import VarInt from classes.Meta import Meta from Com...
gpl-3.0
terkkila/scikit-learn
examples/exercises/plot_cv_digits.py
232
1206
""" ============================================= Cross-validation on Digits Dataset Exercise ============================================= A tutorial exercise using Cross-validation with an SVM on the Digits dataset. This exercise is used in the :ref:`cv_generators_tut` part of the :ref:`model_selection_tut` section...
bsd-3-clause
CDNoyes/EDL-Py
EntryGuidance/Simulation.py
1
40755
import sys from os import path # sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) sys.path.append("./") sys.path.append("../") from Utils.RK4 import RK4 from Utils import DA as da import pandas as pd import numpy as np from scipy.integrate import odeint, trapz from scipy import linalg from sci...
gpl-3.0
smartscheduling/scikit-learn-categorical-tree
sklearn/tests/test_pipeline.py
10
14095
""" Test the pipeline module. """ import numpy as np from scipy import sparse from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_raises, assert_raises_regex from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn.utils.testing import ...
bsd-3-clause
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/pandas/tests/series/test_alter_axes.py
3
6584
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import pytest from datetime import datetime import numpy as np import pandas as pd from pandas import Index, Series from pandas.core.index import MultiIndex, RangeIndex from pandas.compat import lrange, range, zip from pandas.util.testing import assert_series_equal,...
mit
DataReplyUK/datareplyuk
eu_tweet_classifier/train_model.py
1
20044
# General IMPORTS --------------------------------------------------------------------------------------------------# import os import re import sys import pickle import pandas import random import itertools import collections import matplotlib.pyplot as plt # NLTK IMPORTS --------------------------------------------...
apache-2.0
bsipocz/seaborn
doc/conf.py
25
9149
# -*- coding: utf-8 -*- # # seaborn documentation build configuration file, created by # sphinx-quickstart on Mon Jul 29 23:25:46 2013. # # 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. # # All...
bsd-3-clause
dh4gan/oberon
plot/plot_positions.py
1
1034
''' Created on 7/3/14 @author: dh4gan Show the positions of the bodies in the system ''' from sys import argv from matplotlib import pyplot as plt import io_oberon.io_nbody # Data file can be read from the command line or from argument if len(argv)==1: input_file = raw_input("Enter the datafil...
gpl-3.0
nixingyang/Kaggle-Competitions
Customer Analytics/ensemble.py
3
1660
import file_operations import glob import numpy as np import os import pandas as pd import solution import time OLD_SUBMISSION_FOLDER_PATH = solution.SUBMISSION_FOLDER_PATH NEW_SUBMISSION_FOLDER_PATH = "./" def perform_ensembling(low_threshold, high_threshold): print("Reading the submission files from disk ...")...
mit
INCF/BIDS2ISATab
bids2isatab/main.py
1
25918
#!/usr/bin/env python # # import modules used here -- sys is a very standard one from __future__ import print_function import argparse import logging from collections import OrderedDict from glob import glob import os from os.path import exists, join as opj, split as psplit import sys import nibabel import json impo...
apache-2.0
DigitalSlideArchive/HistomicsTK
setup.py
1
3031
#! /usr/bin/env python import os import sys from setuptools import find_packages try: from skbuild import setup except ImportError: sys.stderr.write("""scikit-build is required to build from source or run tox. Please run: python -m pip install scikit-build """) # from setuptools import setup sys.ex...
apache-2.0
wathen/PhD
MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/MHDgenerator/MHDmatrixSetup.py
3
5074
import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc from dolfin import * # from MatrixOperations import * import numpy as np #import matplotlib.pylab as plt from scipy.sparse import coo_matrix, csr_matrix, spdiags, bmat import os, inspect from HiptmairSetup import BoundaryEdge import matpl...
mit
rupakc/Kaggle-Compendium
Pokemon/pokedock.py
1
1692
# -*- coding: utf-8 -*- """ Created on Sat Dec 24 14:04:20 2016 @author: Rupak Chakraborty """ import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import BaggingClassifier from sklearn.ensemble import GradientBoostingClassifier from sklearn.ensemble import AdaBoostClassifier...
mit
wzbozon/scikit-learn
sklearn/tree/tests/test_export.py
130
9950
""" Testing for export functions of decision trees (sklearn.tree.export). """ from re import finditer from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.ensemble import GradientBoostingClassifier from sklearn...
bsd-3-clause
ishanic/scikit-learn
sklearn/utils/fixes.py
133
12882
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # ...
bsd-3-clause
vberaudi/utwt
sudoku.py
1
1116
import pandas as pd import pandas as pd from docplex.cp.model import * GRNG = range(9) problem_data = pd.read_csv("sudoku.csv", sep=";") problem = [] for t in problem_data.itertuples(index=False): problem.append([i for i in t]) mdl = CpoModel(name="Sudoku") grid = [[integer_var(min=1, max=9, name="C" + str(l) + ...
apache-2.0
google-code-export/nmrglue
doc/_build/html/examples/el/sample_applications/apod_viewer_1win.py
10
9854
#!/usr/bin/env python """ An example of using wxPython to build a GUI application using nmrglue This application displays the NMRPipe apodization windows """ import numpy as np import nmrglue as ng import matplotlib # uncomment the following to use wx rather than wxagg #matplotlib.use('WX') #from matplotlib.backends...
bsd-3-clause
TheCoSMoCompany/biopredyn
Prototype/python/biopredyn/biopredynCL.py
1
3886
#!/usr/bin/env python # coding=utf-8 ## @package biopredyn ## Copyright: [2012-2019] Cosmo Tech, All Rights Reserved ## License: BSD 3-Clause import sys import getopt import textwrap import libsbml import libsedml import libnuml from biopredyn import model, workflow, result, resources import matplotlib.pyplot as plt ...
bsd-3-clause
BrianGasberg/filterpy
filterpy/kalman/tests/test_mmae.py
1
5136
# -*- coding: utf-8 -*- """Copyright 2015 Roger R Labbe Jr. FilterPy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is licensed under an MIT license. See the readme.MD file for mo...
mit
lucarebuffi/OASYS1
oasys/widgets/error_profile/ow_abstract_dabam_height_profile.py
1
53621
import os, sys import time import numpy import threading from PyQt5.QtCore import QRect, Qt from PyQt5.QtWidgets import QApplication, QMessageBox, QScrollArea, QTableWidget, QTableWidgetItem, QHeaderView, QAbstractItemView, QWidget, QLabel, QSizePolicy from PyQt5.QtGui import QTextCursor,QFont, QPalette, QColor, QPain...
gpl-3.0
yavuzovski/playground
machine learning/Udacity/ud120-projects/outliers/enron_outliers.py
1
1299
#!/usr/bin/python import pickle import sys import matplotlib.pyplot sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit import numpy as np ### read in data dictionary, convert to numpy array data_dict = pickle.load( open("../final_project/final_project_dataset.pkl", "r") ) featur...
gpl-3.0
OXPHOS/shogun
applications/tapkee/swissroll_embedding.py
12
2600
import numpy numpy.random.seed(40) tt = numpy.genfromtxt('../../data/toy/swissroll_color.dat',unpack=True).T X = numpy.genfromtxt('../../data/toy/swissroll.dat',unpack=True).T N = X.shape[1] converters = [] from shogun import LocallyLinearEmbedding lle = LocallyLinearEmbedding() lle.set_k(9) converters.append((lle, "L...
gpl-3.0
btabibian/scikit-learn
sklearn/cluster/tests/test_affinity_propagation.py
341
2620
""" Testing for Clustering methods """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.cluster.affinity_propagation_ import AffinityPropagation from sklearn.cluster.affinity_propagatio...
bsd-3-clause
NunoEdgarGub1/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/_cm.py
70
375423
""" Color data and pre-defined cmap objects. This is a helper for cm.py, originally part of that file. Separating the data (this file) from cm.py makes both easier to deal with. Objects visible in cm.py are the individual cmap objects ('autumn', etc.) and a dictionary, 'datad', including all of these objects. """ im...
gpl-3.0
gfyoung/pandas
pandas/tests/scalar/timestamp/test_arithmetic.py
4
9023
from datetime import datetime, timedelta import numpy as np import pytest from pandas._libs.tslibs import ( OutOfBoundsDatetime, Timedelta, Timestamp, offsets, to_offset, ) import pandas._testing as tm class TestTimestampArithmetic: def test_overflow_offset(self): # no overflow expe...
bsd-3-clause
wvconnors/pysleeg
eegclassy.py
1
1976
# -*- coding: utf-8 -*- """ 2/8/17, Will Connors eegclassy.py - A program to take EDF polysomnography data and phase annotations, format, and create a classifier """ import numpy as np #import pandas #import io #import tensorflow as tf #import matplotlib as plot class Eeg: '''a class''' def __init__(sel...
gpl-3.0
benjaminy/ManyHands
Client/Source/Crypto/beau/test/plotter.py
1
3473
import matplotlib.pyplot as plt import json ns = [] random_times = [] best_times = [] worst_times = [] timesr = [] min_i = 2 max_i = 27 n_base = 1.3 f = open('./results_with_crypto/nano_array_sorting','r') input_arr = f.read() nano_array_sorting = json.loads(input_arr) f.close() f = open('./results_with_crypt...
mit
saiwing-yeung/scikit-learn
examples/model_selection/grid_search_digits.py
8
2760
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.model_selection.GridS...
bsd-3-clause
jreback/pandas
pandas/tests/extension/test_period.py
2
4619
import numpy as np import pytest from pandas._libs import iNaT from pandas.core.dtypes.dtypes import PeriodDtype import pandas as pd from pandas.core.arrays import PeriodArray from pandas.tests.extension import base @pytest.fixture def dtype(): return PeriodDtype(freq="D") @pytest.fixture def data(dtype): ...
bsd-3-clause
hitszxp/scikit-learn
examples/svm/plot_svm_scale_c.py
26
5353
""" ============================================== Scaling the regularization parameter for SVCs ============================================== The following example illustrates the effect of scaling the regularization parameter when using :ref:`svm` for :ref:`classification <svm_classification>`. For SVC classificati...
bsd-3-clause
andaag/scikit-learn
sklearn/ensemble/tests/test_voting_classifier.py
140
6926
"""Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import RandomForestCl...
bsd-3-clause
vanceeasleaf/aces
aces/runners/shengbte.py
1
28228
# -*- coding: utf-8 -*- # @Author: YangZhou # @Date: 2017-06-13 00:44:48 # @Last Modified by: YangZhou # @Last Modified time: 2017-06-23 18:53:35 import aces.config as config from ase import io from aces.graph import plot, series import numpy as np from aces.runners.phonopy import runner as Runner import pandas as...
gpl-2.0
vicky2135/lucious
oscar/lib/python2.7/site-packages/IPython/sphinxext/ipython_directive.py
6
42602
# -*- coding: utf-8 -*- """ Sphinx directive to support embedded IPython code. This directive allows pasting of entire interactive IPython sessions, prompts and all, and their code will actually get re-executed at doc build time, with all prompts renumbered sequentially. It also allows you to input code as a pure pyth...
bsd-3-clause
JanNash/sms-tools
software/transformations_interface/sineTransformations_function.py
25
5018
# function call to the transformation functions of relevance for the sineModel import numpy as np import matplotlib.pyplot as plt from scipy.signal import get_window import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/')) sys.path.append(os.path.join(os.path.dirname(os.p...
agpl-3.0
subodhchhabra/pandashells
pandashells/test/p_regplot_test.py
10
1072
#! /usr/bin/env python from mock import patch from unittest import TestCase import numpy as np import pandas as pd from pandashells.bin.p_regplot import main, make_label class MakeLabelTests(TestCase): def test_make_label_html(self): label = make_label(coeffs=[1, 2, 3], savefig=['test.html']) sel...
bsd-2-clause
gorakhargosh/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
xuzetan/gemini
gemini/tool_burden_tests.py
5
9907
import math from collections import Counter, defaultdict import numpy as np from scipy.stats import binom, norm from pandas import DataFrame import sys import random from itertools import islice from scipy.misc import comb import GeminiQuery def burden_by_gene(args): """ calculates per sample the total gene...
mit
crackmech/fly-walk
functions.py
1
2324
import matplotlib.pyplot as plt #from skimage.io import imread from keras import backend as K import numpy as np def resize_crop_image(image,scale,cutoff_percent): image = cv2.resize(image,None,fx=scale, fy=scale, interpolation = cv2.INTER_AREA) cut_off_vals = [image.shape[0]*cutoff_percent/100, image.shape[1]*cutof...
mit
toobaz/pandas
pandas/plotting/_matplotlib/misc.py
2
12271
import random import matplotlib.lines as mlines import matplotlib.patches as patches import numpy as np from pandas.core.dtypes.missing import notna from pandas.io.formats.printing import pprint_thing from pandas.plotting._matplotlib.style import _get_standard_colors from pandas.plotting._matplotlib.tools import _se...
bsd-3-clause
nilgoyyou/dipy
doc/examples/restore_dti.py
4
7944
""" ===================================================== Using the RESTORE algorithm for robust tensor fitting ===================================================== The diffusion tensor model takes into account certain kinds of noise (thermal), but not other kinds, such as "physiological" noise. For example, if a sub...
bsd-3-clause
kaslusimoes/SummerSchool2016
simulation-multiple-variations.py
1
7037
#! /bin/env python2 # coding: utf-8 import numpy as np import networkx as nx import matplotlib.pyplot as plt import random as rd from pickle import dump class Data: def __init__(self): self.m_list1 = [] self.m_list2 = [] N = 100 M = 100 MAX = N + M + 1 MAX_EDGE = 380 MAX_DEG = 450 ITERATIONS = 50...
apache-2.0
zooniverse/aggregation
active_weather/old/paper_threshold.py
1
4407
__author__ = 'ggdhines' import cv2 import matplotlib.pyplot as plt from active_weather import ActiveWeather import numpy as np from os import popen import csv image = cv2.imread("/home/ggdhines/region.jpg",0) ret,th1 = cv2.threshold(image,180,255,cv2.THRESH_BINARY) # plt.imshow(th1) # plt.show() # cv2.imwrite("/home/...
apache-2.0
M-R-Houghton/euroscipy_2015
bokeh/bokeh/charts/builder/tests/test_horizon_builder.py
33
3440
""" This is the Bokeh charts testing interface. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with thi...
mit
shikhardb/scikit-learn
examples/calibration/plot_calibration_curve.py
225
5903
""" ============================== Probability Calibration curves ============================== When performing classification one often wants to predict not only the class label, but also the associated probability. This probability gives some kind of confidence on the prediction. This example demonstrates how to di...
bsd-3-clause
kevin-intel/scikit-learn
sklearn/neighbors/tests/test_ball_tree.py
10
2760
import itertools import numpy as np import pytest from numpy.testing import assert_array_almost_equal from sklearn.neighbors._ball_tree import BallTree from sklearn.neighbors import DistanceMetric from sklearn.utils import check_random_state from sklearn.utils.validation import check_array from sklearn.utils._testing ...
bsd-3-clause