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 |
|---|---|---|---|---|---|
jzt5132/scikit-learn | sklearn/neighbors/graph.py | 208 | 7031 | """Nearest Neighbors graph functions"""
# Author: Jake Vanderplas <vanderplas@astro.washington.edu>
#
# License: BSD 3 clause (C) INRIA, University of Amsterdam
import warnings
from .base import KNeighborsMixin, RadiusNeighborsMixin
from .unsupervised import NearestNeighbors
def _check_params(X, metric, p, metric_... | bsd-3-clause |
Barmaley-exe/scikit-learn | sklearn/svm/setup.py | 321 | 3157 | import os
from os.path import join
import numpy
from sklearn._build_utils import get_blas_info
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('svm', parent_package, top_path)
config.add_subpackage('tests')
# Section L... | bsd-3-clause |
eboreapps/Scikit-Learn-Playground | ScikitlearnPlayground/MNISTClassificationSVM.py | 1 | 2398 | """
================================
Recognizing hand-written digits
================================
An example showing how the scikit-learn can be used to recognize images of
hand-written digits.
This example is commented in the
:ref:`tutorial section of the user manual <introduction>`.
"""
print(__doc__)
# Autho... | apache-2.0 |
markstoehr/phoneclassification | local/CVizPartsUtterance.py | 1 | 3274 | from __future__ import division
import numpy as np
import argparse
import matplotlib.pyplot as plt
from scipy.io import wavfile
import template_speech_rec.get_train_data as gtrd
from template_speech_rec import configParserWrapper
from amitgroup.features import code_parts, spread_patches, spread_patches_new
from stride_... | gpl-3.0 |
justincassidy/scikit-learn | examples/cluster/plot_digits_agglomeration.py | 377 | 1694 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Feature agglomeration
=========================================================
These images how similar features are merged together using
feature agglomeration.
"""
print(__doc__)
# Code source: Gaël Varoquaux
#... | bsd-3-clause |
lbishal/scikit-learn | examples/ensemble/plot_random_forest_embedding.py | 286 | 3531 | """
=========================================================
Hashing feature transformation using Totally Random Trees
=========================================================
RandomTreesEmbedding provides a way to map data to a
very high-dimensional, sparse representation, which might
be beneficial for classificati... | bsd-3-clause |
ContextLab/quail | quail/decode_speech.py | 1 | 9422 | from __future__ import print_function
from builtins import str
from builtins import range
import os
import base64
import json
import csv
import pickle
import time
import warnings
import pandas as pd
# optional imports for speech decoding
try:
from google.cloud import speech
from google.cloud.speech import type... | mit |
mugizico/scikit-learn | sklearn/neighbors/classification.py | 106 | 13987 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl>
# Multi-output support by ... | bsd-3-clause |
binkybear/flounder | scripts/tracing/dma-api/trace.py | 96 | 12420 | """Main program and stuff"""
#from pprint import pprint
from sys import stdin
import os.path
import re
from argparse import ArgumentParser
import cPickle as pickle
from collections import namedtuple
from plotting import plotseries, disp_pic
import smmu
class TracelineParser(object):
"""Parse the needed informatio... | gpl-2.0 |
zzyfisher/tushare | tushare/util/store.py | 40 | 1124 | # -*- coding:utf-8 -*-
"""
Created on 2015/02/04
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
import pandas as pd
import tushare as ts
from pandas import compat
import os
class Store(object):
def __init__(self, data=None, name=None, path=None):
if isinstance(data, pd.DataFrame):
... | bsd-3-clause |
cjayb/mne-python | mne/externals/tqdm/_tqdm/gui.py | 14 | 11601 | """
GUI progressbar decorator for iterators.
Includes a default (x)range iterator printing to stderr.
Usage:
>>> from tqdm.gui import trange[, tqdm]
>>> for i in trange(10): #same as: for i in tqdm(xrange(10))
... ...
"""
# future division is important to divide integers and get as
# a result precise floatin... | bsd-3-clause |
googleinterns/hw-fuzzing | experiment_scripts/plots/exp005_plot_coverage.py | 1 | 24007 | #!/usr/bin/env python3
# Copyright 2020 Timothy Trippel
#
# 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 l... | apache-2.0 |
legacysurvey/pipeline | py/legacyanalysis/compare-to-ps1.py | 2 | 30435 | from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
import pylab as plt
import numpy as np
import os
import sys
from astrometry.util.fits import fits_table
from astrometry.libkd.spherematch import match_radec
from astrometry.util.plotutils import PlotSequence
from legacyanalysis.ps1cat impor... | gpl-2.0 |
idlead/scikit-learn | examples/tree/plot_tree_regression_multioutput.py | 22 | 1848 | """
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... | bsd-3-clause |
dusenberrymw/deep-histopath | deephistopath/detection.py | 1 | 12736 | """Detection - mitosis detection"""
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from PIL import Image
import tensorflow as tf
from sklearn.cluster import DBSCAN
from deephistopath.evaluation import list_files, get_file_id, get_locations_from_csv
from deephistopath.evaluation impor... | apache-2.0 |
eranchetz/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... | agpl-3.0 |
RRShieldsCutler/clusterpluck | clusterpluck/scripts/mpi_common.py | 1 | 6453 | #!/usr/bin/env Python
import argparse
import sys
import pandas as pd
import numpy as np
import warnings
from clusterpluck.scripts.cluster_dictionary import build_cluster_map
from clusterpluck.scripts.orfs_in_common import generate_index_list
from clusterpluck.scripts.orfs_in_common import pick_a_cluster
from functools... | mit |
deathnik/img_finder | gui/main_window.py | 1 | 3934 | import Tkinter as tk
import matplotlib as mpl
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg, os
from matplotlib.patches import Rectangle
import matplotlib.pyplot as plt
# custom toolbar
import tkFileDialog
import cv2
from main_module.main import ImageDB
class CustomToolbar... | gpl-3.0 |
noisebridge/PythonClass | instructors/need-rework/6_socrata_matplotlib_workshop/date-demo.py | 3 | 1667 | #!/usr/bin/env python
"""
Show how to make date plots in matplotlib using date tick locators and
formatters. See major_minor_demo1.py for more information on
controlling major and minor ticks
All matplotlib date plotting is done by converting date instances into
days since the 0001-01-01 UTC. The conversion, tick lo... | mit |
qbuat/tauperf | tauperf/plotting/mpl.py | 1 | 2382 | from root_numpy import fill_hist
from rootpy.plotting import Hist, Canvas, Efficiency
from rootpy.plotting import root2matplotlib as rmpl
from rootpy.plotting.style import set_style
from rootpy import asrootpy
import matplotlib.pyplot as plt
from ..variables import VARIABLES, get_label
from . import log; log = log[__n... | gpl-3.0 |
Udzu/pudzu | dataviz/nobelslit.py | 1 | 5009 | import seaborn as sns
from pudzu.charts import *
from pudzu.sandbox.bamboo import *
countries = pd.read_csv("datasets/countries.csv")[["country", "continent", "flag"]].split_columns('country', "|").explode('country').set_index('country')
df = pd.read_csv("datasets/nobels.csv")
df = df[df['category'] == "Litera... | mit |
bmmalone/pymisc-utils | pyllars/mygene_utils.py | 1 | 11233 | """
This module provides helper functions for querying the mygene.info
service via MyGene.py. Please consult the official documentation for
more details: http://docs.mygene.info/projects/mygene-py/en/latest/.
"""
import logging
logger = logging.getLogger(__name__)
import functools
import pandas as pd
import mygene
... | mit |
shenzebang/scikit-learn | sklearn/mixture/tests/test_gmm.py | 200 | 17427 | import unittest
import copy
import sys
from nose.tools import assert_true
import numpy as np
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_raises)
from scipy import stats
from sklearn import mixture
from sklearn.datasets.samples_generator import make_spd_ma... | bsd-3-clause |
3manuek/scikit-learn | doc/sphinxext/numpy_ext/docscrape_sphinx.py | 408 | 8061 | import re
import inspect
import textwrap
import pydoc
from .docscrape import NumpyDocString
from .docscrape import FunctionDoc
from .docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
self.use_plots... | bsd-3-clause |
twalthr/flink | flink-python/pyflink/table/serializers.py | 9 | 3095 | ################################################################################
# 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... | apache-2.0 |
jstoxrocky/statsmodels | statsmodels/tsa/arima_process.py | 26 | 30878 | '''ARMA process and estimation with scipy.signal.lfilter
2009-09-06: copied from try_signal.py
reparameterized same as signal.lfilter (positive coefficients)
Notes
-----
* pretty fast
* checked with Monte Carlo and cross comparison with statsmodels yule_walker
for AR numbers are close but not identical to yule... | bsd-3-clause |
francesco-mannella/dmp-esn | DMP/stulp/src/dynamicalsystems/demos/demoDynamicalSystems.py | 2 | 3421 | ## \file demoDynamicalSystems.py
## \author Freek Stulp
## \brief Visualizes results of demoDynamicalSystems.cpp
##
## \ingroup Demos
## \ingroup DynamicalSystems
import matplotlib.pyplot as plt
import numpy
import os, sys, subprocess
# Include scripts for plotting
lib_path = os.path.abspath('../plotting')
sys.path... | gpl-2.0 |
Gillu13/scipy | scipy/signal/signaltools.py | 1 | 96375 | # Author: Travis Oliphant
# 1999 -- 2002
from __future__ import division, print_function, absolute_import
import warnings
import threading
import sys
from . import sigtools
from ._upfirdn import _UpFIRDn, _output_len
from scipy._lib.six import callable
from scipy._lib._version import NumpyVersion
from scipy import f... | bsd-3-clause |
theoryno3/pylearn2 | pylearn2/scripts/datasets/step_through_small_norb.py | 49 | 3123 | #! /usr/bin/env python
"""
A script for sequentially stepping through SmallNORB, viewing each image and
its label.
Intended as a demonstration of how to iterate through NORB images,
and as a way of testing SmallNORB's StereoViewConverter.
If you just want an image viewer, consider
pylearn2/scripts/show_binocular_gra... | bsd-3-clause |
ChanderG/scikit-learn | sklearn/linear_model/least_angle.py | 57 | 49338 | """
Least Angle Regression algorithm. See the documentation on the
Generalized Linear Model for a complete discussion.
"""
from __future__ import print_function
# Author: Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux
#
# License: BSD 3 ... | bsd-3-clause |
peastman/msmbuilder | msmbuilder/lumping/pcca.py | 6 | 4084 | from __future__ import print_function, division, absolute_import
import numpy as np
from ..msm import MarkovStateModel
class PCCA(MarkovStateModel):
"""Perron Cluster Cluster Analysis (PCCA) for coarse-graining (lumping)
microstates into macrostates.
Parameters
----------
n_macrostates : int
... | lgpl-2.1 |
jordanopensource/data-science-bootcamp | MachineLearning/Session3/document_clustering.py | 230 | 8356 | """
=======================================
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 ... | mit |
agiovann/Constrained_NMF | sandbox/scripts_labeling/data_preprocess.py | 2 | 5976 | #!/usr/bin/env python
from __future__ import division
from __future__ import print_function
# example python script for loading neurofinder data
#
# for more info see:
#
# - http://neurofinder.codeneuro.org
# - https://github.com/codeneuro/neurofinder
#
# requires three python packages
#
# - numpy
# - scipy
# - matplo... | gpl-2.0 |
yavalvas/yav_com | build/matplotlib/doc/mpl_examples/pylab_examples/fonts_demo.py | 12 | 2765 | #!/usr/bin/env python
"""
Show how to set custom font properties.
For interactive users, you can also use kwargs to the text command,
which requires less typing. See examples/fonts_demo_kw.py
"""
from matplotlib.font_manager import FontProperties
from pylab import *
subplot(111, axisbg='w')
font0 = FontProperties()... | mit |
BhallaLab/moose-examples | paper-2015/Fig5_CellMultiscale/Fig5BCD.py | 2 | 11489 | ########################################################################
# This program is copyright (c) Upinder S. Bhalla, NCBS, 2015.
# It is licenced under the GPL 2.1 or higher.
# There is no warranty of any kind. You are welcome to make copies under
# the provisions of the GPL.
# This programme illustrates buildi... | gpl-2.0 |
NDKoehler/DataScienceBowl2017_7th_place | dsb3/steps/pred_cancer_per_candidate.py | 1 | 8192 | '''
Filters numerous HR-candidates using the score from a neural nodule-no_nodule-classifier trained on LUNA16.
'''
import os, sys
import numpy as np
import pandas as pd
import json
import cv2
from tqdm import tqdm
from collections import OrderedDict
from .. import pipeline as pipe
from .. import utils
from .. import t... | mit |
lazywei/scikit-learn | sklearn/linear_model/ridge.py | 89 | 39360 | """
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... | bsd-3-clause |
morgenst/PyAnalysisTools | PyAnalysisTools/PlottingUtils/EventComparisonPlotter.py | 1 | 18117 | from __future__ import print_function
from __future__ import division
from builtins import next
from builtins import str
from past.utils import old_div
from builtins import object
import collections
from copy import copy
import pandas as pd
import PyAnalysisTools.PlottingUtils.Formatting as FM
import PyAnalysisTools... | mit |
tsarouch/python_minutes | lib_math/information.py | 2 | 1765 | import math
import pandas as pd
def entropy(df, attribute):
"""
Calculates the entropy of a dataframe for the passed attribute.
:param df: DataFrame
:attribute: the attribute we want to calculate the entropy on
returns the entropy of the attribute
"""
_entropy = 0.0
freq = {}
N =... | gpl-2.0 |
tdegeus/GooseEYE | docs/examples/L.py | 1 | 2602 | r'''
Plot and/or check.
Usage:
script [options]
Options:
-s, --save Save output for later check.
-c, --check Check against earlier results.
-p, --plot Plot.
-h, --help Show this help.
'''
# <snippet>
import numpy as np
import GooseEYE
# generate image, extract 'volume-frac... | gpl-3.0 |
pystruct/pystruct | examples/plot_binary_svm.py | 1 | 3309 | """
==================
Binary SVM as SSVM
==================
Example of training binary SVM using n-slack QP, 1-slack QP, SGD and
SMO (libsvm). Our 1-slack QP does surprisingly well.
There are many parameters to tune and we can make 1-slack as good as the rest
for the price of higher runtime, we can also try to make t... | bsd-2-clause |
ben-hopps/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py | 70 | 4184 | """
Render to gtk from agg
"""
from __future__ import division
import os
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
show, draw_if_interactive,\
error_ms... | agpl-3.0 |
nick-thompson/dsp | dsp/wavetable/wavetable.py | 2 | 3892 | """
Module for generating band-limited sine, triangle, sawtooth, and square
wavetables.
Construction is done with additive synthesis, including partials just up to
Nyquist so as to avoid aliasing, with no accommodation for the Gibbs Phenomenon.
Note that the table size and the sample rate in this implementation are f... | mit |
RayMick/scikit-learn | sklearn/covariance/robust_covariance.py | 198 | 29735 | """
Robust location and covariance estimators.
Here are implemented estimators that are resistant to outliers.
"""
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import linalg
from scipy.stats import chi2
from . import empir... | bsd-3-clause |
ryfeus/lambda-packs | Tensorflow_OpenCV_Nightly/source/tensorflow/contrib/learn/python/learn/dataframe/dataframe.py | 85 | 4704 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | mit |
rvianello/rdkit | Contrib/pzc/p_con.py | 5 | 45825 | # coding=utf-8
# Copyright (c) 2014 Merck KGaA
from __future__ import print_function
import os, re, gzip, json, requests, sys, optparse, csv
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import SDWriter
from rdkit.Chem import Descriptors
from rdkit.ML.Descriptors import MoleculeDescriptors
from ... | bsd-3-clause |
jcrudy/sklearntools | sklearntools/test/test_line_search.py | 1 | 1389 | from sklearntools.line_search import golden_section_search, zoom, zoom_search
from nose.tools import assert_almost_equal
import numpy as np
def test_golden_section_search():
f = lambda x: (x-2) ** 2
alpha = golden_section_search(1e-12, 0, 10, f, 0., 1.)
assert_almost_equal(alpha, 2.)
alpha = golde... | bsd-3-clause |
AtsushiHashimoto/exp_idc | tools/make_distance_matrix.py | 1 | 2461 | #!/usr/bin/env python
# coding: utf-8
DESCRIPTION="convert feature list into distance matrix"
import numpy as np
import argparse
import sklearn.metrics as sm
import logging
import sys
from os.path import dirname
sys.path.append(dirname(__file__))
from my_target_counter import TargetCounter
logger = logging.getLogge... | bsd-2-clause |
jkarnows/scikit-learn | sklearn/decomposition/tests/test_pca.py | 199 | 10949 | import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_rai... | bsd-3-clause |
lucidfrontier45/PyVB | pyvb/old_ver/vbgmm.py | 1 | 7696 | #!/usr/bin/python
import numpy as np
from numpy.random import randn,dirichlet
from scipy.linalg import det, inv
from scipy.cluster import vq
from scipy.special import psi,gammaln
from core import *
from _core import _logsum,_logsum2d
try:
from _vbgmm import _evaluateHiddenState_C
ext_imported = True
except:
ext_... | bsd-3-clause |
McDermott-Group/LabRAD | LabRAD/Measurements/QPC/QPC_DC_measurements.py | 1 | 6184 | """
### BEGIN NODE INFO
[info]
name = ADR Controller GUI
version = 1.3.2-no-refresh
description = This is a simple labrad client that gives a GUI interface to ADRServer, which controls our ADRs
[startup]
cmdline = %PYTHON% %FILE%
timeout = 20
[shutdown]
message = 987654321
timeout = 20
### END NODE INFO
"""
import m... | gpl-2.0 |
etkirsch/scikit-learn | examples/linear_model/plot_lasso_model_selection.py | 311 | 5431 | """
===================================================
Lasso model selection: Cross-Validation / AIC / BIC
===================================================
Use the Akaike information criterion (AIC), the Bayes Information
criterion (BIC) and cross-validation to select an optimal value
of the regularization paramet... | bsd-3-clause |
nan86150/ImageFusion | lib/python2.7/site-packages/matplotlib/figure.py | 10 | 58719 | """
The figure module provides the top-level
:class:`~matplotlib.artist.Artist`, the :class:`Figure`, which
contains all the plot elements. The following classes are defined
:class:`SubplotParams`
control the default spacing of the subplots
:class:`Figure`
top level container for all plot elements
"""
from... | mit |
lfairchild/PmagPy | programs/foldtest_magic2.py | 2 | 7984 | #!/usr/bin/env python
import sys
import numpy
import matplotlib
if matplotlib.get_backend() != "TKAgg":
matplotlib.use("TKAgg")
import pylab
import pmagpy.pmag as pmag
import pmagpy.pmagplotlib as pmagplotlib
from pmag_env import set_env
def main():
"""
NAME
foldtest_magic.py
DESCRIPTION
... | bsd-3-clause |
bmazin/ARCONS-pipeline | examples/Pal2012-sdss/DisplayStack.py | 1 | 18141 | #!/bin/python
'''
Author: Paul Szypryt Date: July 1, 2013
'''
import numpy as np
from util.ObsFile import ObsFile
from util.FileName import FileName
from util.readDict import readDict
from util import utils
import tables
import matplotlib.pyplot as plt
import hotpix.hotPixels as hp
import os
from time import time
i... | gpl-2.0 |
mahak/spark | python/pyspark/sql/tests/test_pandas_udf_typehints.py | 22 | 9603 | #
# 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 |
frankinit/ThinkStats2 | code/density.py | 67 | 2934 | """This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import math
import random
import brfss
import first
import thinkstats2
import thinkp... | gpl-3.0 |
gotomypc/scikit-learn | sklearn/svm/tests/test_bounds.py | 280 | 2541 | import nose
from nose.tools import assert_equal, assert_true
from sklearn.utils.testing import clean_warning_registry
import warnings
import numpy as np
from scipy import sparse as sp
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from sklearn.linear_model.logistic import LogisticRegression... | bsd-3-clause |
mgeplf/NeuroM | neurom/view/view.py | 1 | 14727 | # 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 |
bwkeller/pytrol | examine.py | 1 | 3096 | #!/usr/bin/python
from optparse import OptionParser
from progressbar import ProgressBar, Percentage, Bar
import numpy as np
import pynbody as pyn
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
try:
from IPython import embed
except:
from IPython.Shell import IPShellEmbed
from sys import argv... | gpl-3.0 |
tomslee/airbnb-data-collection | export_spreadsheet.py | 1 | 13032 | #!/usr/bin/python
import psycopg2 as pg
import pandas as pd
import argparse
import datetime as dt
import logging
from airbnb_config import ABConfig
LOG_LEVEL = logging.INFO
# Set up logging
LOG_FORMAT = '%(levelname)-8s%(message)s'
logging.basicConfig(format=LOG_FORMAT, level=LOG_LEVEL)
DEFAULT_START_DATE = '2017-05-0... | mit |
botswana-harvard/bcpp-export | bcpp_export/old_export/dataframes/longitudinal_subjects.py | 1 | 6570 | import numpy as np
import pandas as pd
from bcpp_export.constants import (
NEG, POS, UNK, YES, IND, NAIVE, NO, DEFAULTER, ON_ART)
class LongitudinalSubjects:
def __init__(self, df, suffix=None):
self.suffix = '_y1'
df['tmp_final_hiv_status'] = df.apply(
lambda row: self.final_hi... | gpl-2.0 |
alistairlow/tensorflow | tensorflow/examples/tutorials/word2vec/word2vec_basic.py | 13 | 10426 | # Copyright 2015 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 |
ssorgatem/qiime | qiime/compare_trajectories.py | 15 | 3744 | from __future__ import division
__author__ = "Jose Antonio Navas Molina"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Jose Antonio Navas Molina", "Antonio Gonzalez Pena",
"Yoshiki Vazquez Baeza"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Jose Antonio Navas Mo... | gpl-2.0 |
Scapogo/zipline | tests/pipeline/test_classifier.py | 2 | 17221 | from functools import reduce
from operator import or_
import numpy as np
import pandas as pd
from zipline.lib.labelarray import LabelArray
from zipline.pipeline import Classifier
from zipline.testing import parameter_space
from zipline.testing.fixtures import ZiplineTestCase
from zipline.testing.predicates import ass... | apache-2.0 |
aetilley/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 |
WMD-group/MacroDensity | examples/InputControl.py | 1 | 6745 | #! /usr/bin/env python
import macrodensity as md
import math
import numpy as np
import matplotlib.pyplot as plt
import csv
from itertools import izip
#------------------------------------------------------------------
# Get the potential
# This section should not be altered
#----------------------------------------... | mit |
SanPen/GridCal | src/research/power_flow/fast_decoupled_research.py | 1 | 9279 | import numpy as np
from numpy import angle, conj, exp, r_, Inf
from numpy.linalg import norm
from scipy.sparse.linalg import splu
import time
np.set_printoptions(linewidth=320)
def FDPF(Vbus, Sbus, Ibus, Ybus, B1, B2, pq, pv, pqpv, tol=1e-9, max_it=100):
"""
Fast decoupled power flow
:param Vbus:
:par... | gpl-3.0 |
tlby/mxnet | example/gluon/dc_gan/dcgan.py | 6 | 13046 | # 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 u... | apache-2.0 |
piiswrong/dec | caffe/examples/web_demo/app.py | 3 | 7659 | import os
import time
import cPickle
import datetime
import logging
import flask
import werkzeug
import optparse
import tornado.wsgi
import tornado.httpserver
import numpy as np
import pandas as pd
from PIL import Image as PILImage
import cStringIO as StringIO
import urllib
import caffe
import exifutil
REPO_DIRNAME = ... | mit |
mencattini/ReMIx | Video/train.py | 1 | 2242 | """SVC training for 7 emotions."""
import glob
import random
import cv2
import numpy as np
import dlib
from sklearn.svm import SVC
from sklearn.externals import joblib
from featuregen import features_from_shape
# emotion list
EMOTIONS = ["anger",
"disgust",
"fear",
"happy",
... | apache-2.0 |
google/asymproj_edge_dnn | deep_edge_trainer.py | 1 | 14426 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 |
HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/matplotlib/backends/backend_gtkcairo.py | 21 | 2348 | """
GTK+ Matplotlib interface using cairo (not GDK) drawing operations.
Author: Steve Chaplin
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import gtk
if gtk.pygtk_version < (2,7,0):
import cairo.gtk
from matplotlib.backends import bac... | gpl-2.0 |
3manuek/scikit-learn | sklearn/datasets/samples_generator.py | 45 | 56433 | """
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 warnings
import array
import numpy as np
from scipy import linalg
import scipy.sparse as sp
from ..preprocessing impo... | bsd-3-clause |
lancezlin/ml_template_py | lib/python2.7/site-packages/sklearn/metrics/tests/test_pairwise.py | 42 | 27323 | import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | mit |
riteshkasat/scipy_2015_sklearn_tutorial | check_env.py | 9 | 2301 | from __future__ import print_function
try:
import curses
curses.setupterm()
assert curses.tigetnum("colors") > 2
OK = "\x1b[1;%dm[ OK ]\x1b[0m" % (30 + curses.COLOR_GREEN)
FAIL = "\x1b[1;%dm[FAIL]\x1b[0m" % (30 + curses.COLOR_RED)
except:
OK = '[ OK ]'
FAIL = '[FAIL]'
import sys
try:
i... | cc0-1.0 |
belltailjp/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 |
michalkurka/h2o-3 | h2o-py/tests/testdir_munging/pyunit_to_H2OFrame.py | 6 | 7213 | import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import numpy as np
import pandas as pd
def to_H2OFrame():
# TODO: negative testing
## 1. list
# a. single col
python_obj = [1, 2, 2.5, -100.9, 0]
the_frame = h2o.H2OFrame(python_obj)
pyunit_utils.check_dims_val... | apache-2.0 |
pv/scikit-learn | examples/gaussian_process/plot_gp_regression.py | 253 | 4054 | #!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
=========================================================
Gaussian Processes regression: basic introductory example
=========================================================
A simple one-dimensional regression exercise computed in two different ways:
1. A noise-free cas... | bsd-3-clause |
anntzer/scikit-learn | asv_benchmarks/benchmarks/datasets.py | 11 | 5351 | import numpy as np
import scipy.sparse as sp
from joblib import Memory
from pathlib import Path
from sklearn.decomposition import TruncatedSVD
from sklearn.datasets import (make_blobs, fetch_20newsgroups,
fetch_openml, load_digits, make_regression,
make_class... | bsd-3-clause |
bradkav/AntiparticleDM | analysis/PlotContours_row.py | 1 | 7381 | #!/usr/bin/python
"""
PlotContours_row.py
Plot contours of discrimination significance over a range of DM masses
BJK 22/06/2017
"""
import numpy as np
from numpy import pi
from scipy.integrate import quad
from scipy.interpolate import interp1d, interp2d
from scipy import ndimage
from matplotlib.ticker import Multipl... | mit |
falcaopetri/GraphTheoryAtUFSCar | RandomWalks/random_walk.py | 1 | 2010 | # -*- coding: utf-8 -*-
#!/usr/bin/env python3
# TODO: documentation
import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
import operator
from collections import OrderedDict
def destringizer(string):
print(string)
def read_graph(path):
return nx.read_gml(path)
def get_most_frequent(n, l... | mit |
kjung/scikit-learn | benchmarks/bench_isolation_forest.py | 40 | 3136 | """
==========================================
IsolationForest benchmark
==========================================
A test of IsolationForest on classical anomaly detection datasets.
"""
print(__doc__)
from time import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import IsolationFore... | bsd-3-clause |
stefanbuenten/nanodegree | p5/decision_tree/dt_author_id.py | 1 | 1155 | #!/usr/bin/python
"""
This is the code to accompany the Lesson 3 (decision tree) mini-project.
Use a Decision Tree to identify emails from the Enron corpus by author:
Sara has label 0
Chris has label 1
"""
# enable python 3 style printing
from __future__ import print_function
import sys
from ti... | mit |
pcgeller/weirdo | analysis.py | 2 | 11700 | ##!!!!!!!!!!!!!!!!!!!!!!!!!!!!This code should not be run from untrusted connections.!!!!!!!!!!!!
##!!!!!!!!!!!!!!!!!!!!!!!!!!!!It is vulnerable to SQL Injection attacks.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pylab... | mit |
Eric89GXL/scipy | scipy/signal/ltisys.py | 1 | 123826 | """
ltisys -- a collection of classes and functions for modeling linear
time invariant systems.
"""
from __future__ import division, print_function, absolute_import
#
# Author: Travis Oliphant 2001
#
# Feb 2010: Warren Weckesser
# Rewrote lsim2 and added impulse2.
# Apr 2011: Jeffrey Armstrong <jeff@approximatrix.co... | bsd-3-clause |
IssamLaradji/scikit-learn | examples/covariance/plot_covariance_estimation.py | 250 | 5070 | """
=======================================================================
Shrinkage covariance estimation: LedoitWolf vs OAS and max-likelihood
=======================================================================
When working with covariance estimation, the usual approach is to use
a maximum likelihood estimator,... | bsd-3-clause |
billy-inn/scikit-learn | examples/decomposition/plot_sparse_coding.py | 247 | 3846 | """
===========================================
Sparse coding with a precomputed dictionary
===========================================
Transform a signal as a sparse combination of Ricker wavelets. This example
visually compares different sparse coding methods using the
:class:`sklearn.decomposition.SparseCoder` esti... | bsd-3-clause |
fyffyt/scikit-learn | examples/plot_multioutput_face_completion.py | 330 | 3019 | """
==============================================
Face completion with a multi-output estimators
==============================================
This example shows the use of multi-output estimator to complete images.
The goal is to predict the lower half of a face given its upper half.
The first column of images sho... | bsd-3-clause |
altairpearl/scikit-learn | examples/ensemble/plot_adaboost_hastie_10_2.py | 355 | 3576 | """
=============================
Discrete versus Real AdaBoost
=============================
This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates
the difference in performance between the discrete SAMME [2] boosting
algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate... | bsd-3-clause |
cwu2011/scikit-learn | examples/linear_model/plot_sgd_separating_hyperplane.py | 260 | 1219 | """
=========================================
SGD: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a linear Support Vector Machines classifier
trained using SGD.
"""
print(__doc__)
import numpy as n... | bsd-3-clause |
meduz/scikit-learn | sklearn/svm/tests/test_sparse.py | 63 | 13366 | import numpy as np
from scipy import sparse
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
from sklearn import datasets, svm, linear_model, base
from sklearn.datasets import make_classification, load_digits, make_blobs
from sklearn.svm.tests import te... | bsd-3-clause |
mjudsp/Tsallis | sklearn/utils/tests/test_random.py | 85 | 7349 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.misc import comb as combinations
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import sample_without_replacement
from sklearn.utils.random import random_choice_csc
from sklearn.utils.testing import ... | bsd-3-clause |
ravindrapanda/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/io_test.py | 137 | 5063 | # 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 |
grlee77/scipy | scipy/signal/spectral.py | 1 | 73995 | """Tools for spectral analysis.
"""
import numpy as np
from scipy import fft as sp_fft
from . import signaltools
from .windows import get_window
from ._spectral import _lombscargle
from ._arraytools import const_ext, even_ext, odd_ext, zero_ext
import warnings
__all__ = ['periodogram', 'welch', 'lombscargle', 'csd',... | bsd-3-clause |
glouppe/scikit-learn | examples/decomposition/plot_kernel_pca.py | 353 | 2011 | """
==========
Kernel PCA
==========
This example shows that Kernel PCA is able to find a projection of the data
that makes data linearly separable.
"""
print(__doc__)
# Authors: Mathieu Blondel
# Andreas Mueller
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomp... | bsd-3-clause |
arokem/seaborn | doc/tools/generate_logos.py | 2 | 6982 | import numpy as np
import seaborn as sns
from matplotlib import patches
import matplotlib.pyplot as plt
from scipy.signal import gaussian
from scipy.spatial import distance
XY_CACHE = {}
STATIC_DIR = "_static"
plt.rcParams["savefig.dpi"] = 300
def poisson_disc_sample(array_radius, pad_radius, candidates=100, d=2, ... | bsd-3-clause |
bssrdf/sklearn-theano | sklearn_theano/feature_extraction/overfeat.py | 7 | 22567 | # Authors: Michael Eickenberg
# Kyle Kastner
# License: BSD 3 Clause
import os
import theano
# Required to avoid fuse errors... very strange
theano.config.floatX = 'float32'
import zipfile
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from .overfeat_class_labels import get_overfe... | bsd-3-clause |
ky822/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 |
blondegeek/pymatgen | pymatgen/analysis/eos.py | 3 | 19152 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module implements various equation of states.
Note: Most of the code were initially adapted from ASE and deltafactor by
@gmatteo but has since undergone major refactoring.
"""
from copy import deepc... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.