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 |
|---|---|---|---|---|---|
yarikoptic/pystatsmodels | statsmodels/tools/tools.py | 3 | 17226 | '''
Utility functions models code
'''
import numpy as np
import numpy.lib.recfunctions as nprf
import numpy.linalg as L
from scipy.interpolate import interp1d
from scipy.linalg import svdvals
from statsmodels.distributions import (ECDF, monotone_fn_inverter,
StepFunction)... | bsd-3-clause |
bundgus/python-playground | matplotlib-playground/examples/pylab_examples/tripcolor_demo.py | 1 | 5058 | """
Pseudocolor plots of unstructured triangular grids.
"""
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np
import math
# Creating a Triangulation without specifying the triangles results in the
# Delaunay triangulation of the points.
# First create the x and y coordinates of the point... | mit |
andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/matplotlib/path.py | 6 | 38092 | """
A module for dealing with the polylines used throughout matplotlib.
The primary class for polyline handling in matplotlib is :class:`Path`.
Almost all vector drawing makes use of Paths somewhere in the drawing
pipeline.
Whilst a :class:`Path` instance itself cannot be drawn, there exists
:class:`~matplotlib.artis... | apache-2.0 |
zihua/scikit-learn | sklearn/covariance/tests/test_covariance.py | 79 | 12193 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_alm... | bsd-3-clause |
daniorerio/trackpy | doc/sphinxext/ipython_directive.py | 37 | 37557 | # -*- 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 |
rohanp/scikit-learn | sklearn/neighbors/tests/test_approximate.py | 26 | 19053 | """
Testing for the approximate neighbor search using
Locality Sensitive Hashing Forest module
(sklearn.neighbors.LSHForest).
"""
# Author: Maheshakya Wijewardena, Joel Nothman
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
gmatteo/pymatgen | pymatgen/analysis/magnetism/tests/test_heisenberg.py | 5 | 2735 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import os
import unittest
import warnings
import pandas as pd
from pymatgen.core.structure import Structure
from pymatgen.analysis.magnetism.heisenberg import HeisenbergMapper
from pymatgen.util.testing impor... | mit |
NonVolatileComputing/arrow | python/pyarrow/compat.py | 1 | 3678 | # 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 |
ltalirz/asetk | scripts/cube-ex-plane-above-atoms.py | 2 | 2093 | #!/usr/bin/env python
import numpy as np
import argparse
from asetk.format.cube import Cube
# Define command line parser
parser = argparse.ArgumentParser(
description='Extracts (and plots) plane from cube file.')
parser.add_argument('--version', action='version', version='%(prog)s 15.12.2014')
parser.add_argument(... | mit |
hsiaoyi0504/scikit-learn | examples/svm/plot_svm_nonlinear.py | 268 | 1091 | """
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn imp... | bsd-3-clause |
bundgus/python-playground | matplotlib-playground/examples/pylab_examples/custom_cmap.py | 2 | 5759 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
"""
Example: suppose you want red to increase from 0 to 1 over the bottom
half, green to do the same over the middle half, and blue over the top
half. Then you would use:
cdict = {'red': ... | mit |
npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/learn/python/learn/dataframe/dataframe.py | 27 | 4836 | # 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 |
espenhgn/nest-simulator | pynest/examples/spatial/conncon_targets.py | 20 | 2449 | # -*- coding: utf-8 -*-
#
# conncon_targets.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License... | gpl-2.0 |
hainm/statsmodels | examples/python/tsa_dates.py | 29 | 1169 |
## Dates in timeseries models
from __future__ import print_function
import statsmodels.api as sm
import pandas as pd
# ## Getting started
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
dates = sm.tsa.datetools.dates_from_range('1700', length=len(da... | bsd-3-clause |
janelia-idf/elf | tests/adc_to_volume.py | 4 | 5112 | # -*- coding: utf-8 -*-
from __future__ import print_function, division
import matplotlib.pyplot as plot
import numpy
from numpy.polynomial.polynomial import polyfit,polyadd,Polynomial
import yaml
INCHES_PER_ML = 0.078
VOLTS_PER_ADC_UNIT = 0.0049
def load_numpy_data(path):
with open(path,'r') as fid:
hea... | bsd-3-clause |
selimnairb/2014-02-25-swctest | lessons/thw-scipy/pade2.py | 1 | 1278 | #The Hacker Within: Python Boot Camp 2010 - Session 07 - Using SciPy.
#Presented by Anthony Scopatz.
#
#SciPy Pade, glide before you fly!
#As you have seen, SciPy has some really neat functionality that comes stock.
#Oddly, some of the best stuff is in the 'miscelaneous' module.
import scipy.misc
import numpy as np
... | bsd-2-clause |
pypot/scikit-learn | examples/cluster/plot_ward_structured_vs_unstructured.py | 320 | 3369 | """
===========================================================
Hierarchical clustering: structured vs unstructured ward
===========================================================
Example builds a swiss roll dataset and runs
hierarchical clustering on their position.
For more information, see :ref:`hierarchical_clus... | bsd-3-clause |
preprocessed-connectomes-project/quality-assessment-protocol | qap/test_plotting.py | 1 | 4878 |
import pytest
import unittest
class TestPlotAll(unittest.TestCase):
def setUp(self):
import os
import pandas as pd
import pkg_resources as p
from qap.viz.plotting import plot_all
self.plot_all = plot_all
anat_spat_csv = \
p.resource_filename("qap", os... | bsd-3-clause |
jason-neal/equanimous-octo-tribble | octotribble/grid_chisquare.py | 1 | 3119 | #!/usr/bin/env python
# Grid Chi-square
# Module to perform Chi-square analysis for a grid of values.
from __future__ import division, print_function
import os
import matplotlib.pyplot as plt
import numpy as np
from joblib import Memory, Parallel, delayed
path = "/home/jneal/Phd/Codes/equanimous-octo-tribble/" # s... | mit |
WangWenjun559/Weiss | summary/sumy/sklearn/linear_model/omp.py | 1 | 30430 | """Orthogonal matching pursuit algorithms
"""
# Author: Vlad Niculae
#
# License: BSD 3 clause
import warnings
from distutils.version import LooseVersion
import numpy as np
from scipy import linalg
from scipy.linalg.lapack import get_lapack_funcs
from .base import LinearModel, _pre_fit
from ..base import RegressorM... | apache-2.0 |
timnon/pyschedule | examples/sports.py | 1 | 1139 | import sys
sys.path.append('../src')
from pyschedule import Scenario, solvers, plotters, alt
n_teams = 10
n_stadiums = n_teams
n_slots = n_teams-1
n_plays_at_home = 4
max_n_not_at_home_periods = 3
S = Scenario('sports_scheduline',horizon=n_slots)
Stadiums = S.Resources('Stadium',num=n_stadiums)
Teams = S.Resources('... | apache-2.0 |
arabenjamin/scikit-learn | sklearn/neighbors/approximate.py | 128 | 22351 | """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 |
mfjb/scikit-learn | sklearn/datasets/mldata.py | 309 | 7838 | """Automatically download MLdata datasets."""
# Copyright (c) 2011 Pietro Berkes
# License: BSD 3 clause
import os
from os.path import join, exists
import re
import numbers
try:
# Python 2
from urllib2 import HTTPError
from urllib2 import quote
from urllib2 import urlopen
except ImportError:
# Pyt... | bsd-3-clause |
lazywei/scikit-learn | sklearn/utils/tests/test_multiclass.py | 72 | 15350 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from itertools import product
from functools import partial
from sklearn.externals.six.moves import xrange
from sklearn.externals.six import iteritems
from scipy.sparse import issparse
from scipy.sparse import csc_matrix
from scipy.sparse im... | bsd-3-clause |
neurodata/synaptome-stats | Code2/Python/cubeStats.py | 1 | 8400 | #!/usr/bin/env python3
###
###
###
### Jesse Leigh Patsolic
### 2017 <jpatsol1@jhu.edu>
### S.D.G
#
import argparse
import math
from intern.remote.boss import BossRemote
from intern.resource.boss.resource import *
import configparser
#import grequests # for async requests, conflicts with requests somehow
import req... | apache-2.0 |
pchanial/healpy | doc/conf.py | 2 | 6912 | # -*- coding: utf-8 -*-
#
# healpy documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 21 13:06:27 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... | gpl-2.0 |
pierreg/tensorflow | tensorflow/examples/learn/iris.py | 25 | 1649 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 |
DonBeo/statsmodels | statsmodels/graphics/tsaplots.py | 9 | 9999 | """Correlation plot functions."""
import numpy as np
from statsmodels.graphics import utils
from statsmodels.tsa.stattools import acf, pacf
def plot_acf(x, ax=None, lags=None, alpha=.05, use_vlines=True, unbiased=False,
fft=False, **kwargs):
"""Plot the autocorrelation function
Plots lags on th... | bsd-3-clause |
odlgroup/odl | odl/contrib/solvers/spdhg/misc.py | 2 | 22808 | # Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Functions for folders and files."""
from... | mpl-2.0 |
weidnem/IntroPython2016 | students/crobison/session08/tweeter_connector.py | 4 | 2407 | #!/usr/bin/env python3
# Charles Robison
# Term project
import twitter
import json
import pandas as pd
import config
CONSUMER_KEY = config.CONSUMER_KEY
CONSUMER_SECRET = config.CONSUMER_SECRET
OAUTH_TOKEN = config.OAUTH_TOKEN
OAUTH_TOKEN_SECRET = config.OAUTH_TOKEN_SECRET
auth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUT... | unlicense |
sinhrks/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py | 25 | 2252 | """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 |
Udzu/pudzu | dataviz/euvotes.py | 1 | 2087 | from pudzu.charts import *
from pudzu.sandbox.bamboo import *
import seaborn as sns
# generate map
df = pd.read_csv("datasets/euvotes.csv").set_index('country')
palette = tmap(RGBA, sns.cubehelix_palette(11, start=0.2, rot=-0.75))
ranges = [20000000,10000000,5000000,2000000,1000000,500000,200000,100000,0]
def voteco... | mit |
pathomx/pathomx | setup.mac.py | 2 | 2877 | #!/usr/bin/env python
# coding=utf-8
import os, sys
from copy import copy
import collections
from setuptools import setup, find_packages
__version__ = open('VERSION','rU').read()
sys.path.insert(0,'pathomx')
# Defaults for py2app / cx_Freeze
build_py2app=dict(
argv_emulation=True,
includes=[
'PyQt5',... | gpl-3.0 |
GuessWhoSamFoo/pandas | pandas/tests/indexes/datetimes/test_misc.py | 2 | 13926 | import calendar
import locale
import unicodedata
import numpy as np
import pytest
import pandas as pd
from pandas import (
DatetimeIndex, Index, Timestamp, compat, date_range, datetime, offsets)
import pandas.util.testing as tm
class TestTimeSeries(object):
def test_pass_datetimeindex_to_index(self):
... | bsd-3-clause |
rkmaddox/expyfun | expyfun/_utils.py | 1 | 27314 | """Some utility functions"""
# Authors: Eric Larson <larsoner@uw.edu>
#
# License: BSD (3-clause)
import warnings
import subprocess
import importlib
import os
import os.path as op
import inspect
import sys
import tempfile
import ssl
from shutil import rmtree
import atexit
import json
from functools import partial
fro... | bsd-3-clause |
fergalbyrne/nupic | examples/audiostream/audiostream_tp.py | 32 | 9991 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 |
dssg/education-college-public | code/etl/uploaders/load_lookuptables.py | 1 | 1793 | from etl.pipeline.tableuploader import UploadTable
import pandas as pd
import config
def main():
###################
### Common Bits ###
###################
lookup_cols = {
'commonids': '''
''',
'partnerids': '''
''',
'data': 'name VARCHAR PRIMARY KEY'
}
def prep_lookup_cleandf(rawdf, lookupcol):
... | mit |
jreback/pandas | pandas/core/arrays/sparse/array.py | 1 | 49743 | """
SparseArray data structure
"""
from collections import abc
import numbers
import operator
from typing import Any, Callable, Sequence, Type, TypeVar, Union
import warnings
import numpy as np
from pandas._libs import lib
import pandas._libs.sparse as splib
from pandas._libs.sparse import BlockIndex, IntIndex, Spars... | bsd-3-clause |
Garrett-R/scikit-learn | examples/decomposition/plot_pca_vs_lda.py | 182 | 1743 | """
=======================================================
Comparison of LDA and PCA 2D projection of Iris dataset
=======================================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
a... | bsd-3-clause |
dbjohnson/flhackday | model.py | 1 | 1632 | import numpy as np
from sklearn import linear_model
from sklearn import decomposition
def dataframe_to_xy(df, xcols, ycol, xcategorical=[]):
x = df[xcols].values
y = df[ycol].values
for col in xcategorical:
# transform N categorical values for soil type into N - 1 binary variables so we can use th... | mit |
krez13/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 |
stkubr/zipline | tests/test_batchtransform.py | 2 | 9818 | #
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
KellyChan/Python | python/sklearn/examples/general/linear_and_quadratic_discriminant_analysis_with_confidence_ellipsoid.py | 3 | 5057 | #---------------------------------------------------------------#
# Project: Linear and Quadratic Discriminant Analysis with confidence ellipsoid
# Author: Kelly Chan
# Date: Apr 25 2014
#---------------------------------------------------------------#
print(__doc__)
import numpy as np
import pylab as pl
from scipy i... | mit |
jereze/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 128 | 4761 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
dhruv13J/scikit-learn | examples/ensemble/plot_adaboost_regression.py | 311 | 1529 | """
======================================
Decision Tree Regression with AdaBoost
======================================
A decision tree is boosted using the AdaBoost.R2 [1] algorithm on a 1D
sinusoidal dataset with a small amount of Gaussian noise.
299 boosts (300 decision trees) is compared with a single decision tr... | bsd-3-clause |
SuperDARNCanada/borealis | tools/testing_utils/filter_testing/frerking/decimator.py | 2 | 6529 | from scipy import signal
import numpy as np
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
from scipy.fftpack import fft,ifft,fftshift
import math
import random
import cmath
import test_signals
def plot_fft(samplesa, rate):
fft_samps=fft(samplesa)
T= 1.0 /float(rate)
num_samps=le... | gpl-3.0 |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/io/parser/test_network.py | 2 | 7608 | """
Tests parsers ability to read and parse non-local files
and hence require a network connection to be read.
"""
from io import BytesIO, StringIO
import logging
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import DataFrame
import pandas.util.testing as tm
from pandas.io.p... | apache-2.0 |
ahoyosid/scikit-learn | sklearn/utils/tests/test_multiclass.py | 14 | 15416 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from itertools import product
from functools import partial
from sklearn.externals.six.moves import xrange
from sklearn.externals.six import iteritems
from scipy.sparse import issparse
from scipy.sparse import csc_matrix
from scipy.sparse im... | bsd-3-clause |
alexis-jacq/Story_CoWriting | tools/log_analysis/withmeness.py | 1 | 1430 | import pandas as pd
import seaborn as sns
import numpy as np
import os
from scipy.stats import ttest_ind,ttest_rel
p = "LOG_P_CSV"
s = "LOG_S_CSV"
r = "LOG_R_CSV"
file_subject = "withmeness-11-stdout"
def counts(condition):
all_vals = []
sums = []
for i in range(60):
try:
name = cond... | isc |
carrillo/scikit-learn | sklearn/decomposition/nmf.py | 100 | 19059 | """ Non-negative matrix factorization
"""
# Author: Vlad Niculae
# Lars Buitinck <L.J.Buitinck@uva.nl>
# Author: Chih-Jen Lin, National Taiwan University (original projected gradient
# NMF implementation)
# Author: Anthony Di Franco (original Python and NumPy port)
# License: BSD 3 clause
from __future__ ... | bsd-3-clause |
chrisburr/scikit-learn | examples/semi_supervised/plot_label_propagation_digits_active_learning.py | 294 | 3417 | """
========================================
Label Propagation digits active learning
========================================
Demonstrates an active learning technique to learn handwritten digits
using label propagation.
We start by training a label propagation model with only 10 labeled points,
then we select the t... | bsd-3-clause |
phillynch7/sportsref | sportsref/decorators.py | 1 | 7103 | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import codecs
import copy
import datetime
import functools
import getpass
import hashlib
import os
import re
import time
import appdirs
from boltons import funcutils
import mementos
import pandas as pd
from py... | gpl-3.0 |
KenjiroAI/SynThai | hyper.py | 1 | 9003 | """
Hyperopt
"""
import gc
import os
import pickle
import sys
import warnings
from datetime import datetime
from multiprocessing import Process, Queue
from pprint import pprint
# Prevent Keras info message; "Using TensorFlow backend."
STDERR = sys.stderr
sys.stderr = open(os.devnull, "w")
from keras.models import loa... | mit |
COOLMASON/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 |
glouppe/scikit-learn | sklearn/utils/tests/test_validation.py | 56 | 18600 | """Tests for input validation functions"""
import warnings
from tempfile import NamedTemporaryFile
from itertools import product
import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true, assert_false, assert_equal
from sklearn.utils.... | bsd-3-clause |
bmazin/ARCONS-pipeline | examples/Pal2014_1SWASP_J0002/makeLightcurve.py | 1 | 5062 | import numpy as np
from sdssgaussfitter import gaussfit
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from util import utils
from util.readDict import readDict
from scipy import pi
from scipy.stats import nanmedian
from mpltools import style
#import figureHeader
import os
import sys
import glob
import tabl... | gpl-2.0 |
parekhmitchell/Machine-Learning | Machine Learning A-Z Template Folder/Part 4 - Clustering/Section 25 - Hierarchical Clustering/hc.py | 7 | 1771 | # Hierarchical Clustering
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Mall_Customers.csv')
X = dataset.iloc[:, [3, 4]].values
# y = dataset.iloc[:, 3].values
# Splitting the dataset into the Training set and Test set
... | mit |
Jimmy-Morzaria/scikit-learn | examples/ensemble/plot_adaboost_multiclass.py | 354 | 4124 | """
=====================================
Multi-class AdaBoosted Decision Trees
=====================================
This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can
improve prediction accuracy on a multi-class problem. The classification
dataset is constructed by taking a ten-dimensional ... | bsd-3-clause |
MediffRobotics/DeepRobotics | DeepLearnMaterials/tutorials/RL/example2/RL_brain.py | 1 | 1800 | """
This part of code is the Q learning brain, which is a brain of the agent.
All decisions are made in here.
View more on 莫烦Python: https://morvanzhou.github.io/tutorials/
"""
import numpy as np
import pandas as pd
class QTable:
def __init__(self, actions, learning_rate=0.01, reward_decay=0.9, e_greedy=0.9):
... | gpl-3.0 |
mfjb/scikit-learn | examples/text/document_classification_20newsgroups.py | 222 | 10500 | """
======================================================
Classification of text documents using sparse features
======================================================
This is an example showing how scikit-learn can be used to classify documents
by topics using a bag-of-words approach. This example uses a scipy.spars... | bsd-3-clause |
jreback/pandas | pandas/tests/indexes/datetimes/methods/test_to_period.py | 7 | 6557 | import warnings
import dateutil.tz
from dateutil.tz import tzlocal
import pytest
import pytz
from pandas._libs.tslibs.ccalendar import MONTHS
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas import (
DatetimeIndex,
Period,
PeriodIndex,
Timestamp,
date_range,
period_rang... | bsd-3-clause |
yanchen036/tensorflow | tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py | 39 | 20233 | # 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 |
SSG-DRD-IOT/commercial-iot-security-system | opencv/tutorials/imageProcessing/transform/fourier.py | 1 | 4853 | """
Fourier Transform
-Find Fourier Transform of images using OpenCV
-utilize FFT functions in Numpy
-FT applications
functions:
cv2.
dft()
idft()
FT used to analyze freq characteristics of filters
for images
2D Discrete Fourier Transform used to find frequency domain
FFT calculates DFT
sinusoidal signal... | mit |
chengsoonong/crowdastro-projects | ATLAS-CDFS/scripts/plot_examples.py | 1 | 6330 | """Plots examples of where classifiers are wrong.
Matthew Alger <matthew.alger@anu.edu.au>
Research School of Astronomy and Astrophysics
The Australian National University
2017
"""
import logging
import astropy.io.ascii
import astropy.io.fits
import astropy.visualization
import astropy.visualization.wcsaxes
import a... | mit |
wilsonkichoi/zipline | zipline/utils/paths.py | 1 | 5282 | """
Canonical path locations for zipline data.
Paths are rooted at $ZIPLINE_ROOT if that environment variable is set.
Otherwise default to expanduser(~/.zipline)
"""
from errno import EEXIST
import os
from os.path import exists, expanduser, join
import pandas as pd
def hidden(path):
"""Check if a path is hidden... | apache-2.0 |
vsanca/TSDC | HaarDetector/code/haar_hard.py | 1 | 2688 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 6 18:04:15 2017
@author: student
"""
import cv2
from matplotlib import pyplot as plt
# constants
IMAGE_SIZE = 500.0
MATCH_THRESHOLD = 20
MATCH_UPPER = 100
cv2.ocl.setUseOpenCL(False)
# load haar cascade and street image
stop_cascade = cv2.CascadeClassifier('cascade_... | gpl-3.0 |
aajtodd/zipline | tests/test_sources.py | 17 | 7041 | #
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/plotting/_style.py | 3 | 6454 | # being a bit too dynamic
# pylint: disable=E1101
from __future__ import division
import warnings
from contextlib import contextmanager
import re
import numpy as np
from pandas.core.dtypes.common import is_list_like
from pandas.compat import lrange, lmap
import pandas.compat as compat
from pandas.plotting._compat im... | apache-2.0 |
shennjia/weblte | test_xlsxwriter/test_prb.py | 1 | 1378 | __author__ = 'shenojia'
import pprint
import re
import sys
import unittest
import weakref
import numpy as np
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import matplotlib.pyplot as plt
sys.path.insert(0, '..')
from R12_36211.RE import RE
from R12_36211.RG import RG
from R12_36211.PRB impo... | mit |
sbussmann/kaggle-mnist | Code/convnet.py | 1 | 6217 |
# coding: utf-8
# In[19]:
from __future__ import absolute_import
from __future__ import print_function
#from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.c... | mit |
zaxtax/scikit-learn | setup.py | 19 | 11460 | #! /usr/bin/env python
#
# Copyright (C) 2007-2009 Cournapeau David <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# License: 3-clause BSD
import subprocess
descr = """A set of python modules for machine learning and data mining"""
import sys
import os
import shutil
from distut... | bsd-3-clause |
plstcharles/opengm | src/interfaces/python/examples/potts_gui.py | 14 | 1100 | import numpy
import opengm
import vigra
import matplotlib.pyplot as plt
import matplotlib.cm as cm
gradScale = 0.1
energyNotEqual = 0.2
sigma=0.2
resizeFactor=2
img=vigra.impex.readImage('lena.bmp')
shape=img.shape
imgLab=vigra.colors.transform_RGB2Lab(img)
shape=(shape[0]*resizeFactor,shape[1]*resizeFactor)
... | mit |
equialgo/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 |
chatcannon/scipy | scipy/signal/fir_filter_design.py | 40 | 20637 | """Functions for FIR filter design."""
from __future__ import division, print_function, absolute_import
from math import ceil, log
import numpy as np
from numpy.fft import irfft
from scipy.special import sinc
from . import sigtools
__all__ = ['kaiser_beta', 'kaiser_atten', 'kaiserord',
'firwin', 'firwin2',... | bsd-3-clause |
CivilNet/Gemfield | dockerfiles/py-faster-rcnn/files/gemfield/py-faster-rcnn/caffe-fast-rcnn/examples/web_demo/app.py | 1 | 7787 | import os
import time
import pickle
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
import cStringIO as StringIO
import urllib
import exifutil
import caffe
REPO_DIRNAME = os.path.absp... | gpl-3.0 |
nvoron23/statsmodels | statsmodels/genmod/_prediction.py | 27 | 9437 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 19 11:29:18 2014
Author: Josef Perktold
License: BSD-3
"""
import numpy as np
from scipy import stats
# this is similar to ContrastResults after t_test, partially copied and adjusted
class PredictionResults(object):
def __init__(self, predicted_mean, var_pred_mean... | bsd-3-clause |
pulinagrawal/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/font_manager.py | 69 | 42655 | """
A module for finding, managing, and using fonts across platforms.
This module provides a single :class:`FontManager` instance that can
be shared across backends and platforms. The :func:`findfont`
function returns the best TrueType (TTF) font file in the local or
system font path that matches the specified :class... | agpl-3.0 |
belltailjp/scikit-learn | examples/text/document_classification_20newsgroups.py | 222 | 10500 | """
======================================================
Classification of text documents using sparse features
======================================================
This is an example showing how scikit-learn can be used to classify documents
by topics using a bag-of-words approach. This example uses a scipy.spars... | bsd-3-clause |
lbishal/scikit-learn | sklearn/externals/joblib/parallel.py | 17 | 35626 | """
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
from __future__ import division
import os
import sys
import gc
import warnings
from math import sqrt
import functools
import time
import thr... | bsd-3-clause |
VT-vision-lab/VQA | PythonHelperTools/vqaDemo.py | 1 | 2434 | # coding: utf-8
from vqaTools.vqa import VQA
import random
import skimage.io as io
import matplotlib.pyplot as plt
import os
dataDir ='../../VQA'
versionType ='v2_' # this should be '' when using VQA v2.0 dataset
taskType ='OpenEnded' # 'OpenEnded' only for v2.0. 'OpenEnded' or 'MultipleChoice' for v1.0
dataType ... | bsd-2-clause |
wkfwkf/statsmodels | statsmodels/datasets/statecrime/data.py | 25 | 3128 | #! /usr/bin/env python
"""Statewide Crime Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """Public domain."""
TITLE = """Statewide Crime Data 2009"""
SOURCE = """
All data is for 2009 and was obtained from the American Statistical Abstracts except as indicated below.
"""
DESCRSHORT = """State ... | bsd-3-clause |
Adai0808/scikit-learn | sklearn/neighbors/nearest_centroid.py | 199 | 7249 | # -*- coding: utf-8 -*-
"""
Nearest Centroid Classification
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse as sp
from ..base import BaseEstimator, ClassifierMixin
from ..met... | bsd-3-clause |
hdmy/LagouSpider | dataMining/main.py | 1 | 8640 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 23 21:27:52 2017
@author: hd_mysky
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
# const
BASE_DIR = os.path.dirname(__file__) # 获取当前文件的父目录绝对路径
file_path =... | mit |
DonBeo/scikit-learn | sklearn/kernel_approximation.py | 18 | 17705 | """
The :mod:`sklearn.kernel_approximation` module implements several
approximate kernel feature maps base on Fourier transforms.
"""
# Author: Andreas Mueller <amueller@ais.uni-bonn.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import svd
from .base im... | bsd-3-clause |
selective-inference/selective-inference | doc/learning_examples/multi_target/lasso_example_multi_random.py | 3 | 2875 | import functools
import numpy as np
from scipy.stats import norm as ndist
import regreg.api as rr
from selection.tests.instance import gaussian_instance
from selection.learning.utils import full_model_inference, pivot_plot
from selection.learning.core import normal_sampler, keras_fit
def simulate(n=200, p=100, s=1... | bsd-3-clause |
kjung/scikit-learn | sklearn/cluster/tests/test_spectral.py | 262 | 7954 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
MediffRobotics/DeepRobotics | DeepLearnMaterials/tutorials/tensorflowTUT/tf11_build_network/full_code.py | 1 | 1955 | # View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code acco... | gpl-3.0 |
TomAugspurger/pandas | pandas/tests/arrays/masked/test_arrow_compat.py | 2 | 1505 | import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
arrays = [pd.array([1, 2, 3, None], dtype=dtype) for dtype in tm.ALL_EA_INT_DTYPES]
arrays += [pd.array([True, False, True, None], dtype="boolean")]
@pytest.fixture(params=arrays, ids=[a.dtype.name for a in arr... | bsd-3-clause |
nlhepler/idepi | setup.py | 3 | 2431 | #!/usr/bin/env python
from __future__ import division, print_function
import sys
from os.path import abspath, join, split
from setuptools import setup
from idepi import __version__ as _idepi_version
setup(name='idepi',
version=_idepi_version,
description='IDentify EPItope',
author='N Lance Hepler... | gpl-3.0 |
bwanglzu/Automatic_Question_Generation | aqg/utils/feature_construction.py | 1 | 29993 | import os
import sys
import nltk
import pandas as pd
import linguistic as ling
from nltk.corpus import stopwords
from nltk.tag import StanfordNERTagger
class FeatureConstruction:
def __init__(self):
os.environ['STANFORD_PARSER'] = os.environ.get(
'STANFORD_JARS')
os.environ['STANFORD_... | mit |
ATNF/askapsdp | Code/Components/Analysis/evaluation/current/scripts/plotEvalOld.py | 1 | 4493 | #!/usr/bin/env python
"""
"""
import askap.analysis.evaluation
from matplotlib import *
from numpy import *
import os
from askap.analysis.evaluation.readData import *
from askap.analysis.evaluation.readDataOLD import *
from askap.analysis.evaluation.distributionPlots import *
from optparse import OptionParser
import as... | gpl-2.0 |
anurag313/scikit-learn | examples/svm/plot_svm_anova.py | 250 | 2000 | """
=================================================
SVM-Anova: SVM with univariate feature selection
=================================================
This example shows how to perform univariate feature before running a SVC
(support vector classifier) to improve the classification scores.
"""
print(__doc__)
import... | bsd-3-clause |
kernc/scikit-learn | examples/cluster/plot_cluster_iris.py | 350 | 2593 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
K-means Clustering
=========================================================
The plots display firstly what a K-means algorithm would yield
using three clusters. It is then shown what the effect of a bad
initializa... | bsd-3-clause |
maheshakya/scikit-learn | sklearn/cluster/spectral.py | 5 | 17949 | # -*- coding: utf-8 -*-
"""Algorithms for spectral clustering"""
# Author: Gael Varoquaux gael.varoquaux@normalesup.org
# Brian Cheung
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import check_rand... | bsd-3-clause |
tayebzaidi/HonorsThesisTZ | ThesisCode/DES_Pipeline/classification/classify.py | 3 | 6983 | """A script to run wavelet decomposition on arbitrary objects"""
#!/usr/bin/env python
import os
import sys
import json
import featureExtraction
import numpy as np
import bandMap
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.model_selection import ... | gpl-3.0 |
boland1992/seissuite_iran | build/lib/seissuite/ant/psdepthmodel.py | 6 | 9233 | """
Module taking care of the forward modelling: theoretical dispersion
curve given a 1D crustal model of velocities and densities.
Uses the binaries of the Computer Programs in Seismology, with
must be installed in *COMPUTER_PROGRAMS_IN_SEISMOLOGY_DIR*
"""
import numpy as np
import matplotlib.pyplot as plt
import os
... | gpl-3.0 |
tomevans/limbdark | atlas.py | 1 | 7392 | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import os, sys, pdb
#import pidly
# Overview:
#
# TME 26 Aug 2016
# These limb darkening routines should be made into proper modular objects.
# They're already set up in a way that should make this fairly straightforward.
# This i... | gpl-2.0 |
terrycojones/dark-matter | dark/orfs.py | 3 | 2745 | import numpy as np
START_CODONS = set(['ATG'])
STOP_CODONS = set(['TAA', 'TAG', 'TGA'])
def findCodons(seq, codons):
"""
Find all instances of the codons in 'codons' in the given sequence.
seq: A Bio.Seq.Seq instance.
codons: A set of codon strings.
Return: a generator yielding matching codon o... | mit |
plissonf/scikit-learn | sklearn/feature_extraction/hashing.py | 183 | 6155 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: BSD 3 clause
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if... | bsd-3-clause |
tdhopper/scikit-learn | examples/classification/plot_lda.py | 70 | 2413 | """
====================================================================
Normal and Shrinkage Linear Discriminant Analysis for classification
====================================================================
Shows how shrinkage improves classification.
"""
from __future__ import division
import numpy as np
import... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.