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
tzolov/incubator-zeppelin
spark/interpreter/src/main/resources/python/zeppelin_pyspark.py
9
12880
# # 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
HBPNeurorobotics/nest-simulator
pynest/examples/intrinsic_currents_subthreshold.py
4
7182
# -*- coding: utf-8 -*- # # intrinsic_currents_subthreshold.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 ...
gpl-2.0
mdeff/ntds_2016
project/reports/fake_news/acquisition.py
2
4872
import configparser import dateutil import datetime import requests import pandas as pd class Feature(object): """ A feature represent a Facebook graph API field in addition to a customized name and a formatting function used to clean the collected data """ def __init__(self, fbquery, formatter=...
mit
lyrixderaven/AdventOfCode
6.advent.py
1
3295
from inputs import SIXTH instructions = SIXTH.instructions from pandas import DataFrame class the_grid: grid = None def __init__(self): self.grid = DataFrame(index=range(0,1000),columns=range(0,1000)) self.grid = self.grid.fillna(False) def parse_inst(self, inst): if 'turn on'...
gpl-2.0
bsipocz/statsmodels
statsmodels/datasets/committee/data.py
25
2583
"""First 100 days of the US House of Representatives 1995""" __docformat__ = 'restructuredtext' COPYRIGHT = """Used with express permission from the original author, who retains all rights.""" TITLE = __doc__ SOURCE = """ Jeff Gill's `Generalized Linear Models: A Unifited Approach` http://jgill.wustl.ed...
bsd-3-clause
jhsenjaliya/incubator-airflow
airflow/www/views.py
1
97277
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
apache-2.0
joshloyal/scikit-learn
sklearn/manifold/tests/test_locally_linear.py
85
5600
from itertools import product import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy import linalg from sklearn import neighbors, manifold from sklearn.manifold.locally_linear import barycenter_kneighbors_graph from sklearn.utils.testing import assert_less from sklearn....
bsd-3-clause
kapteyn-astro/kapteyn
doc/source/EXAMPLES/mu_skypolygons_zenith.py
1
5310
from kapteyn import maputils from matplotlib import pyplot as plt import numpy # This script shows that you can plot shapes that cross the pole. # A shape is plotted with respect to its center and the border points # are derived in a way that distance and angle are correct for a sphere. # This makes it impossible to h...
bsd-3-clause
alexandrebarachant/mne-python
mne/viz/utils.py
1
58985
"""Utility functions for plotting M/EEG data """ from __future__ import print_function # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # ...
bsd-3-clause
TomAugspurger/pandas
pandas/tests/series/indexing/test_delitem.py
5
1404
import pytest from pandas import Index, Series import pandas._testing as tm class TestSeriesDelItem: def test_delitem(self): # GH#5542 # should delete the item inplace s = Series(range(5)) del s[0] expected = Series(range(1, 5), index=range(1, 5)) tm.assert_series...
bsd-3-clause
KellyChan/Python
python/crawlers/crawler/catalogs/lowes/lowes_catalogs_fullurls.py
3
2037
# -*- coding: utf-8 -*- """ Project: eCatalog - Lowes - link: http://www.lowes.com/ Author: Kelly Chan Date: Sept 4 2014 Version: v1.0.0 """ import os import sys reload(sys) sys.setdefaultencoding( "utf-8" ) import re import time import urllib import urllib2 from bs4 import BeautifulSoup import pandas def getH...
mit
RomainBrault/scikit-learn
examples/linear_model/plot_sparse_logistic_regression_20newsgroups.py
56
4172
""" ===================================================== Multiclass sparse logisitic regression on newgroups20 ===================================================== Comparison of multinomial logistic L1 vs one-versus-rest L1 logistic regression to classify documents from the newgroups20 dataset. Multinomial logistic ...
bsd-3-clause
lbdreyer/cartopy
lib/cartopy/mpl/feature_artist.py
1
4889
# (C) British Crown Copyright 2011 - 2014, Met Office # # This file is part of cartopy. # # cartopy 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)...
lgpl-3.0
hammerlab/mhcflurry
mhcflurry/predict_scan_command.py
1
11652
''' Scan protein sequences using the MHCflurry presentation predictor. By default, sub-sequences (peptides) with affinity percentile ranks less than 2.0 are returned. You can also specify --results-all to return predictions for all peptides, or --results-best to return the top peptide for each sequence. Examples: Sc...
apache-2.0
ClinicalGraphics/scikit-image
skimage/feature/tests/test_util.py
35
2818
import numpy as np try: import matplotlib.pyplot as plt except ImportError: plt = None from numpy.testing import assert_equal, assert_raises from skimage.feature.util import (FeatureDetector, DescriptorExtractor, _prepare_grayscale_input_2D, _mask...
bsd-3-clause
antworteffekt/EDeN
eden/iterated_semisupervised_feature_selection.py
1
7729
import random import logging import numpy as np from sklearn.semi_supervised import LabelSpreading from sklearn.feature_selection import RFECV from sklearn.linear_model import SGDClassifier from sklearn.preprocessing import LabelEncoder logger = logging.getLogger(__name__) def semisupervised_target(target=None, ...
mit
altairpearl/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
102
2319
#!/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
jerjorg/BZI
BZI/read_and_write.py
1
149764
import os import matplotlib # matplotlib.use("Agg") import subprocess import numpy as np from numpy.linalg import inv, det import pandas as pd import pickle import itertools import xarray as xd from BZI.symmetry import make_rptvecs ####### ####### ======================================================================...
gpl-3.0
bavardage/statsmodels
statsmodels/discrete/discrete_margins.py
3
25405
#Splitting out maringal effects to see if they can be generalized import numpy as np from scipy.stats import norm from statsmodels.tools.decorators import cache_readonly, resettable_cache #### margeff helper functions #### #NOTE: todo marginal effects for group 2 # group 2 oprobit, ologit, gologit, mlogit, biprobit ...
bsd-3-clause
kinect110/RPSOM
src/RPSOM_GUI.py
1
27773
# -*- coding: utf-8 -*- import wx import wx.lib.scrolledpanel as scrolled from RPSOM import Model import os import sys import gc try: from RPSOM.transition_graph import output_graph import RPSOM.RPSOMforOpenGL except ImportError: pass import pandas import json MIN_COLUMNS = 0 MID_COLUMNS = 2 MAX_COLUMNS = 3 cl...
mit
mhdella/scikit-learn
examples/mixture/plot_gmm_classifier.py
250
3918
""" ================== GMM classification ================== Demonstration of Gaussian mixture models for classification. See :ref:`gmm` for more information on the estimator. Plots predicted labels on both training and held out test data using a variety of GMM classifiers on the iris dataset. Compares GMMs with sp...
bsd-3-clause
BiaDarkia/scikit-learn
sklearn/preprocessing/tests/test_function_transformer.py
17
5314
import numpy as np from scipy import sparse from sklearn.preprocessing import FunctionTransformer from sklearn.utils.testing import (assert_equal, assert_array_equal, assert_allclose_dense_sparse) from sklearn.utils.testing import assert_warns_message, assert_no_warnings def _make_...
bsd-3-clause
silky/sms-tools
lectures/07-Sinusoidal-plus-residual-model/plots-code/stochasticModelFrame.py
22
3298
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, hanning, triang, blackmanharris, resample import math import sys, os, time from scipy.fftpack import fft, ifft sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import utilFunction...
agpl-3.0
SiLab-Bonn/monopix_daq
monopix_daq/analysis/analyze_hits.py
1
12804
import os, sys, time import numpy as np import tables as tb import yaml import logging COL_SIZE = 36 ROW_SIZE = 129 class AnalyzeHits(): def __init__(self,fhit,fraw): self.fhit=fhit self.fraw=fraw self.res={} def run(self,n=10000000): with tb.open_file(self.fhit,"a") as f...
gpl-2.0
mayblue9/scikit-learn
sklearn/preprocessing/__init__.py
268
1319
""" The :mod:`sklearn.preprocessing` module includes scaling, centering, normalization, binarization and imputation methods. """ from ._function_transformer import FunctionTransformer from .data import Binarizer from .data import KernelCenterer from .data import MinMaxScaler from .data import MaxAbsScaler from .data ...
bsd-3-clause
SECOORA/GUTILS
gutils/__init__.py
1
7296
#!python # coding=utf-8 from __future__ import division # always return floats when dividing import os import math import errno import warnings import subprocess from collections import namedtuple import numpy as np import pandas as pd from six import StringIO from scipy.signal import boxcar, convolve import loggin...
mit
eryueniaobp/contest
Tianchi_power/power.py
1
8372
from __future__ import print_function import torch import torch.nn as nn from torch import autograd from torch.autograd import Variable import torch.optim as optim import numpy as np import datetime,time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import pandas as pd LAG = 1 INPUT_SIZE = 1 ...
apache-2.0
rajat1994/scikit-learn
sklearn/manifold/tests/test_isomap.py
226
3941
from itertools import product import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from sklearn import datasets from sklearn import manifold from sklearn import neighbors from sklearn import pipeline from sklearn import preprocessing from sklearn.utils.testing import assert_less ...
bsd-3-clause
jeremyclover/airflow
setup.py
3
2598
from setuptools import setup, find_packages import sys # Kept manually in sync with airflow.__version__ version = '1.5.1' celery = [ 'celery>=3.1.17', 'flower>=0.7.3' ] crypto = ['cryptography>=0.9.3'] doc = [ 'sphinx>=1.2.3', 'sphinx-argparse>=0.1.13', 'sphinx-rtd-theme>=0.1.6', 'Sphinx-PyPI...
apache-2.0
Jordan-Zhu/EdgeSegmentFitting
findendsjunction.py
1
2081
# ------------------------------------------------------------------------------- # Name: findendsjunction # Purpose: Finds junctions and endings in a line/edge image. # ------------------------------------------------------------------------------- import cv2 import numpy as np from matplotlib import pyplo...
agpl-3.0
RPGroup-PBoC/gist_pboc_2017
code/inclass/plotting_probabilities_repressor_in_class.py
1
1076
# Import our favorite modules import numpy as np import matplotlib.pyplot as plt # import seaborn # Define our parameters Nns = 5E6 # in units of number of binding sites R = np.logspace(0, 3, 500) de_r = -15 # in kT # Calculate the fold_change fold_change = 1 / (1 + (R / Nns) * np.exp(-de_r)) plt.figure() plt.plot(...
mit
cmorgan/trading-with-python
lib/qtpandas.py
2
6058
''' Easy integration of DataFrame into pyqt framework Copyright: Jev Kuznetsov Licence: BSD ''' from PyQt4.QtCore import (QAbstractTableModel,Qt,QVariant,QModelIndex,SIGNAL) from PyQt4.QtGui import (QApplication,QDialog,QVBoxLayout, QTableView, QWidget,QTableWidget, QHeaderView, QFo...
bsd-3-clause
frank-tancf/scikit-learn
sklearn/linear_model/tests/test_sag.py
33
28228
# Authors: Danny Sullivan <dbsullivan23@gmail.com> # Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # # Licence: BSD 3 clause import math import numpy as np import scipy.sparse as sp from sklearn.linear_model.sag import get_auto_step_size from sklearn.linear_model.sag_fast import _multinomial_grad_loss_all_sa...
bsd-3-clause
homologus/Pandoras-Toolbox-for-Bioinformatics
src/SPAdes/src/debruijn/path_extend/utils/find_single_threshold.py
2
3327
import sys import numpy as np import matplotlib import matplotlib.mlab as mlab import matplotlib.pyplot as plt if (len(sys.argv) != 2): print ("<all_weights>") exit(1) fin = open(sys.argv[1]); Pattern_good = "good " lst_good = [] Pattern_bad = "bad " lst_bad = [] good_size = 1 bad_size = 1 for line in fin: ...
gpl-3.0
haojunyu/numpy
numpy/core/tests/test_multiarray.py
16
222642
from __future__ import division, absolute_import, print_function import collections import tempfile import sys import shutil import warnings import operator import io import itertools import ctypes if sys.version_info[0] >= 3: import builtins else: import __builtin__ as builtins from decimal import Decimal i...
bsd-3-clause
rasbt/biopandas
biopandas/pdb/engines.py
1
8457
# BioPandas # Author: Sebastian Raschka <mail@sebastianraschka.com> # License: BSD 3 clause # Project Website: http://rasbt.github.io/biopandas/ # Code Repository: https://github.com/rasbt/biopandas import pandas as pd amino3to1dict = {'ASH': 'A', 'ALA': 'A', 'CYX': 'C', ...
bsd-3-clause
alvarofierroclavero/scikit-learn
sklearn/tests/test_multiclass.py
72
24581
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing ...
bsd-3-clause
mmottahedi/neuralnilm_prototype
scripts/e236.py
2
4858
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
fedebarabas/ringfinder
ringfinder/testdata_maker.py
1
6194
# -*- coding: utf-8 -*- """ Created on Sat Nov 26 14:37:26 2016 @author: Federico Barabas """ import os import numpy as np import matplotlib.pyplot as plt import tifffile as tiff import ringfinder.utils as utils import ringfinder.tools as tools def loadData(folder, ax, subimgPxSize, technique, mag=None): """ ...
gpl-3.0
zuoshifan/instimager
imager/fourier.py
1
23635
import abc import numpy as np import healpy as hp import h5py from cora.util import coord from caput import config from caput import mpiutil import telescope import cylinder import exotic_cylinder import visibility import rotate as rot import fouriertransform as ft import deconv class FourierTransformTelescope(te...
gpl-2.0
patrick-nicholson/spark
python/pyspark/sql/dataframe.py
7
69591
# # 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
pravsripad/mne-python
mne/preprocessing/ica.py
3
119114
# -*- coding: utf-8 -*- # # Authors: Denis A. Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Juergen Dammers <j.dammers@fz-juelich.de> # # License: BSD (3-clause) from inspect import isfunction from collections import namedtuple from copy import deepcopy from...
bsd-3-clause
trungnt13/scikit-learn
examples/svm/plot_svm_scale_c.py
223
5375
""" ============================================== 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
trankmichael/scikit-learn
examples/neighbors/plot_species_kde.py
282
4059
""" ================================================ Kernel Density Estimate of Species Distributions ================================================ This shows an example of a neighbors-based query (in particular a kernel density estimate) on geospatial data, using a Ball Tree built upon the Haversine distance metric...
bsd-3-clause
Reagankm/KnockKnock
venv/lib/python3.4/site-packages/mpl_toolkits/axes_grid1/axes_grid.py
7
31905
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import matplotlib.cbook as cbook import matplotlib.pyplot as plt import matplotlib.axes as maxes #import matplotlib.colorbar as mcolorbar from . import colorbar as mcolorbar import matplotlib as mp...
gpl-2.0
jseabold/scikit-learn
examples/applications/topics_extraction_with_nmf_lda.py
18
3891
""" ======================================================================================= Topic extraction with Non-negative Matrix Factorization and Latent Dirichlet Allocation ======================================================================================= This is an example of applying Non-negative Matrix ...
bsd-3-clause
plazas/wfirst-detectors-vnl
code/plot_fig3_beta_gamma_delta_mag20.py
1
25308
#!/usr/bin/python import numpy as np import os import sys import math import matplotlib matplotlib.use('Pdf') import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from matplotlib.backends.backend_pdf import PdfPages import matplotlib.font_manager as fm ## 6-1-15 ## Simple code to e...
mit
BorisJeremic/Real-ESSI-Examples
dynamic_test/HHT/alpha0.00/post.py
9
2369
#!/usr/bin/python #Standard python libs import sys import os # import datetime import numpy as np import h5py import matplotlib.pyplot as plt from math import * #Libs related to scipy and matplotlib from scipy import * from scipy.fftpack import fft from scipy.fftpack.helper import fftfreq sys.path.append("./" ) # tim...
cc0-1.0
ryfeus/lambda-packs
Tensorflow_LightGBM_Scipy_nightly/source/scipy/integrate/quadrature.py
20
28269
from __future__ import division, print_function, absolute_import import numpy as np import math import warnings # trapz is a public function for scipy.integrate, # even though it's actually a numpy function. from numpy import trapz from scipy.special import roots_legendre from scipy.special import gammaln from scipy....
mit
cbertinato/pandas
pandas/tests/resample/test_timedelta.py
3
4505
from datetime import timedelta import numpy as np import pandas as pd from pandas import DataFrame, Series from pandas.core.indexes.timedeltas import timedelta_range import pandas.util.testing as tm from pandas.util.testing import assert_frame_equal, assert_series_equal def test_asfreq_bug(): df = DataFrame(dat...
bsd-3-clause
IndraVikas/scikit-learn
examples/neighbors/plot_species_kde.py
282
4059
""" ================================================ Kernel Density Estimate of Species Distributions ================================================ This shows an example of a neighbors-based query (in particular a kernel density estimate) on geospatial data, using a Ball Tree built upon the Haversine distance metric...
bsd-3-clause
wildux/CDI
06_P_ScalarQ(2).py
2
1490
# -*- coding: utf-8 -*- from scipy import misc import numpy as np import matplotlib.pyplot as plt """ Joan Rodas """ #np.set_printoptions(threshold=np.inf) imagen = misc.ascent() #Leo la imagen (n,m)=imagen.shape #filas y columnas de la imagen """ Mostrar la imagen habiendo cuantizado los valores de los píxeles en...
gpl-3.0
endolith/scipy
scipy/spatial/_plotutils.py
12
7057
import numpy as np from scipy._lib.decorator import decorator as _decorator __all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d'] @_decorator def _held_figure(func, obj, ax=None, **kw): import matplotlib.pyplot as plt # type: ignore[import] if ax is None: fig = plt.figure() ...
bsd-3-clause
seg/2016-ml-contest
ar4/ar4_submission001.py
2
2318
# Alan Richardson (Ausar Geophysical) # 2017/01/09 # Simple first attempt using Ridge regression to predict missing PE values, and SVC for the facies import numpy as np import pandas as pd from sklearn import preprocessing, cross_validation, grid_search, linear_model, svm, metrics # Load + preprocessing train_data =...
apache-2.0
sniemi/SamPy
sandbox/src1/examples/font_table_ttf.py
1
1524
#!/usr/bin/env python """ matplotlib has support for freetype fonts. Here's a little example using the 'table' command to build a font table that shows the glyphs by character code. Usage python font_table_ttf.py somefile.ttf """ import sys, os from matplotlib.ft2font import FT2Font from pylab import figure, table, s...
bsd-2-clause
djgagne/scikit-learn
sklearn/utils/multiclass.py
83
12343
# 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 from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
microelly2/reconstruction
reconstruction/CV_opening.py
1
7039
# -*- coding: utf-8 -*- #------------------------------------------------- #-- reconstruction workbench #-- #-- microelly 2016 v 0.1 #-- #-- GNU Lesser General Public License (LGPL) #------------------------------------------------- __vers__="13.03.2016 0.0" __dir__='/home/thomas/.FreeCAD/Mod/reconstruction' import...
lgpl-3.0
voxlol/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
230
2649
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
cython-testbed/pandas
pandas/tests/frame/test_indexing.py
3
130466
# -*- coding: utf-8 -*- from __future__ import print_function from warnings import catch_warnings, simplefilter from datetime import datetime, date, timedelta, time from pandas.compat import map, zip, range, lrange, lzip, long from pandas import compat from numpy import nan from numpy.random import randn import py...
bsd-3-clause
LemonATsu/LemonATsu.github.io
markdown_generator/talks.py
199
4000
# coding: utf-8 # # Talks markdown generator for academicpages # # Takes a TSV of talks with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_i...
mit
saiwing-yeung/scikit-learn
examples/linear_model/plot_ridge_coeffs.py
157
2785
""" ============================================================== Plot Ridge coefficients as a function of the L2 regularization ============================================================== .. currentmodule:: sklearn.linear_model :class:`Ridge` Regression is the estimator used in this example. Each color in the le...
bsd-3-clause
JosmanPS/scikit-learn
examples/model_selection/grid_search_text_feature_extraction.py
253
4158
""" ========================================================== Sample pipeline for text feature extraction and evaluation ========================================================== The dataset used in this example is the 20 newsgroups dataset which will be automatically downloaded and then cached and reused for the do...
bsd-3-clause
samzhang111/scikit-learn
sklearn/metrics/tests/test_score_objects.py
138
14048
import pickle import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regexp from sklearn.utils.testing import assert_true from sklearn.utils.testing im...
bsd-3-clause
allenwoods/parasys
SumoEnv/simulation.py
1
11039
#! /usr/bin/env python # -*- coding: utf-8 -*- """ @file environ.py @author Allen Woods @date 2016-07-29 @version 16-7-29 下午2:51 ??? SUMO simulation environment """ import os import sys import time import socket from subprocess import Popen, PIPE import pandas as pd import numpy as np from time impor...
mit
frank-tancf/scikit-learn
examples/model_selection/plot_roc_crossval.py
37
3474
""" ============================================================= Receiver Operating Characteristic (ROC) with cross validation ============================================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality using cross-validation. ROC curv...
bsd-3-clause
vortex-ape/scikit-learn
examples/manifold/plot_mds.py
18
2730
""" ========================= Multi-dimensional scaling ========================= An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. """ # Author: Nelle Varoquaux <nelle.varoquaux@gmail....
bsd-3-clause
mne-tools/mne-tools.github.io
0.14/_downloads/plot_fdr_stats_evoked.py
24
2752
""" ======================================= FDR correction on T-test on sensor data ======================================= One tests if the evoked response significantly deviates from 0. Multiple comparison problem is addressed with False Discovery Rate (FDR) correction. """ # Authors: Alexandre Gramfort <alexandre....
bsd-3-clause
Jaspereclipse/kaggle-transfer-learning-on-stack-exchange-tags
src/data_factory.py
1
8857
#!/usr/bin/python # -*- coding: utf-8 -*- import pandas as pd import os.path as osp import numpy as np import re from bs4 import BeautifulSoup as bs from nltk.tokenize import word_tokenize, sent_tokenize from nltk import FreqDist import cPickle as pkl def combine(train_dict, test_dict): """Combine a list of csv fi...
apache-2.0
gbrammer/sgas-lens
sgas/reprocess_wfc3.py
1
23705
""" Scripts to reprocess WFC3 exposures with time-variable backgrounds or satellite trails. """ import os import glob import shutil import numpy as np import numpy.ma import matplotlib.pyplot as plt try: import astropy.io.fits as pyfits except: import pyfits import logging logger = logging.getLogger('re...
mit
pyql/PyQL
query.py
1
19203
from __future__ import print_function import pandas as pd import ply import lexer import yaccer import aggregators import itertools import regex import collections import unittest # modules for use inside of the query loop import math import re import random import string class CacheDict(collections.OrderedDict): ...
gpl-3.0
stefanopalmieri/CAMPN
breeder.py
1
4412
import matplotlib matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import matplotlib.pyplot as plt import Tkinter as Tk import networkx as nx import copy import numpy as np from genome import Genome # This Source Code Form is subject to the terms of the Mozilla Public # License...
mpl-2.0
Saxafras/Spacetime
tests/test_CAs.py
1
7131
from __future__ import division from unittest import TestCase import numpy as np from matplotlib import pyplot as plt from itertools import product from spacetime.CA_Simulators.CAs import * from spacetime.Local_Measures.Transducers import * class CATestCase(TestCase): ''' Tests for CAs.py ''' def tes...
bsd-3-clause
tomolaf/trading-with-python
cookbook/workingWithDatesAndTime.py
77
1551
# -*- coding: utf-8 -*- """ Created on Sun Oct 16 17:45:02 2011 @author: jev """ import time import datetime as dt from pandas import * from pandas.core import datetools # basic functions print 'Epoch start: %s' % time.asctime(time.gmtime(0)) print 'Seconds from epoch: %.2f' % time.time() t...
bsd-3-clause
ky822/scikit-learn
examples/svm/plot_svm_kernels.py
329
1971
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= SVM-Kernels ========================================================= Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially useful when the data-points are not linearly sep...
bsd-3-clause
iTech-/zds-defis
automated_text_generation/charabia/charabia.py
2
3181
from sys import argv import operator import random import numpy as np import matplotlib.pyplot as plt lang_dict = {} lang_str = ["fr", "de", "es", "pt", "eo", "it", "tr", "sv", "pl", "da", "is", "fi", "cs"] nb_lang = len(lang_str) def generate_char(): """ Generate a random character from a dist...
mit
sanuj/shogun
examples/undocumented/python_modular/graphical/multiclass_qda.py
26
3294
""" Shogun demo Fernando J. Iglesias Garcia """ import numpy as np import matplotlib as mpl import pylab import util from scipy import linalg from modshogun import QDA from modshogun import RealFeatures, MulticlassLabels # colormap cmap = mpl.colors.LinearSegmentedColormap('color_classes', {'red': [(0, 1, 1), ...
gpl-3.0
aabadie/scikit-learn
examples/tree/plot_tree_regression.py
95
1516
""" =================================================================== Decision Tree Regression =================================================================== A 1D regression with decision tree. The :ref:`decision trees <tree>` is used to fit a sine curve with addition noisy observation. As a result, it learns ...
bsd-3-clause
spookylukey/pandas-highcharts
pandas_highcharts/tests.py
1
4925
# -*- coding: utf-8 -*- from __future__ import absolute_import import datetime import json import pandas from unittest import TestCase from .core import serialize, json_encode df = pandas.DataFrame([ {'a': 1, 'b': 2, 'c': 3, 't': datetime.datetime(2015, 1, 1), 's': 's1'}, {'a': 2, 'b': 4, 'c': 6, 't': datet...
mit
WangWenjun559/Weiss
summary/sumy/sklearn/tests/test_calibration.py
213
12219
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_greater, assert_almost_equal, ...
apache-2.0
arahuja/scikit-learn
sklearn/feature_extraction/text.py
4
49485
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/pandas/io/tests/test_json_norm.py
15
7823
import nose from pandas import DataFrame import numpy as np import pandas.util.testing as tm from pandas.io.json import json_normalize, nested_to_record def _assert_equal_data(left, right): if not left.columns.equals(right.columns): left = left.reindex(columns=right.columns) tm.assert_frame_equal(l...
gpl-2.0
tum-camp/survival-support-vector-machine
survival/io/arffwrite.py
1
4483
# 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
alexeyum/scikit-learn
examples/bicluster/bicluster_newsgroups.py
142
7183
""" ================================================================ Biclustering documents with the Spectral Co-clustering algorithm ================================================================ This example demonstrates the Spectral Co-clustering algorithm on the twenty newsgroups dataset. The 'comp.os.ms-windows...
bsd-3-clause
ahardin015/programingworkshop
Python/pandas_and_parallel/single_meso_surface.py
8
2232
import pandas as pd import os import matplotlib.pyplot as plt import datetime as dt import numpy as np from scipy import interpolate from mpl_toolkits.basemap import Basemap, cm import mesonet_calculations ''' Quick code for using the existing scripts to create a single surface plot from mesonet data ''' # Note tha...
mit
Aasmi/scikit-learn
examples/plot_kernel_ridge_regression.py
230
6222
""" ============================================= Comparison of kernel ridge regression and SVR ============================================= Both kernel ridge regression (KRR) and SVR learn a non-linear function by employing the kernel trick, i.e., they learn a linear function in the space induced by the respective k...
bsd-3-clause
kjung/scikit-learn
sklearn/manifold/tests/test_t_sne.py
8
21789
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.neighbors import BallTree from sklearn.utils.testing import assert_less_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from skle...
bsd-3-clause
linearregression/airflow
setup.py
1
2046
from setuptools import setup, find_packages # Kept manually in sync with airflow.__version__ version = '1.3.0' doc = [ 'sphinx>=1.2.3', 'sphinx-argparse>=0.1.13', 'sphinx-rtd-theme>=0.1.6', 'Sphinx-PyPI-upload>=0.2.1' ] hive = [ 'hive-thrift-py>=0.0.1', 'pyhive>=0.1.3', 'pyhs2>=0.6.0', ] m...
apache-2.0
janmtl/pypsych
pypsych/data_sources/hrvstitcher.py
1
10502
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Includes the HRV stitcher data source class """ import pandas as pd import numpy as np from scipy.io import loadmat from scipy.interpolate import UnivariateSpline from data_source import DataSource from schema import Schema, Or, Optional def _val(x, pos, label_bin): ...
bsd-3-clause
WillArmentrout/galSims
plotting/PlotGalacticPlaneWiseSim.py
1
1831
import pylab as p import math from matplotlib.pyplot import Rectangle # Used to make dummy legend scol = str('#FF0000') # Sets color of simulated regions wcol = str('#5FB404') # Sets color of WISE regions # Open CSV File datafile = open('3DHiiRegions.csv', 'r') csvFile = [] for row in datafile: csvFile.append(row...
gpl-2.0
jackey-qiu/genx_pc_qiu
supportive_functions/backcor/background.py
1
13401
""" Methods to handle generic background determination Authors/Modifications: ---------------------- * Tom Trainor (tptrainor@alaska.edu) * The polynomial background model follows closley the XRF background code by Mark Rivers """ ####################################################################### import ty...
gpl-3.0
pandas-ml/pandas-ml
pandas_ml/skaccessors/test/test_neural_network.py
2
1115
#!/usr/bin/env python import pytest import sklearn.datasets as datasets import sklearn.neural_network as nn import pandas_ml as pdml import pandas_ml.util.testing as tm class TestNeuralNtwork(tm.TestCase): def test_objectmapper(self): df = pdml.ModelFrame([]) self.assertIs(df.neur...
bsd-3-clause
mbarylsk/goldbach-partition
goldbach-primes_gap.py
1
9752
# # Copyright (c) 2017, Marcin Barylski # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions...
gpl-3.0
EricSB/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/__init__.py
69
28184
""" This is an object-orient plotting library. A procedural interface is provided by the companion pylab module, which may be imported directly, e.g:: from pylab import * or using ipython:: ipython -pylab For the most part, direct use of the object-oriented library is encouraged when programming rather tha...
agpl-3.0
marionleborgne/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py
69
24593
# Todd Miller jmiller@stsci.edu from __future__ import division import os, sys, math import Tkinter as Tk, FileDialog import tkagg # Paint image to Tk photo blitter extension from backend_agg import FigureCanvasAgg import os.path import matplotlib from matplotlib.cbook import is_string_like from ...
agpl-3.0
sarahgrogan/scikit-learn
sklearn/metrics/__init__.py
214
3440
""" The :mod:`sklearn.metrics` module includes score functions, performance metrics and pairwise metrics and distance computations. """ from .ranking import auc from .ranking import average_precision_score from .ranking import coverage_error from .ranking import label_ranking_average_precision_score from .ranking imp...
bsd-3-clause
ElDeveloper/scikit-learn
sklearn/tests/test_calibration.py
62
12288
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_greater, assert_almost_equal, ...
bsd-3-clause
canavandl/bokeh
bokeh/charts/builder/donut_builder.py
31
8206
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Donut class which lets you build your Donut charts just passing the arguments to the Chart class and calling the proper functions. It also add a new chained stacked method. """ #---------------------...
bsd-3-clause
Horta/limix
limix/io/hdf5.py
1
6093
from __future__ import unicode_literals as _ # TODO: refactor this entire file. There are too many things here def read_limix(filepath): r"""Read the HDF5 limix file format. Parameters ---------- filepath : str File path. Returns ------- dict Phenotype and genotype. ...
apache-2.0
LtGlahn/parsedau
parsedau.py
1
10415
# -*- coding: utf-8 -*- """ Created on Tue Dec 27 08:33:26 2016 @author: jajens """ import copy import pandas as pd import numpy as np import matplotlib.pyplot as plt class daufil(): """Class for holding info from a single DAU file""" def __init__(self, filename): self.rawdata = se...
mit
PrashntS/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_01_language_train_model.py
254
2005
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause