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 |
|---|---|---|---|---|---|
MockyJoke/numbers | ex8/code/colour_predict_hint.py | 1 | 3142 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from skimage.color import lab2rgb
import sys
OUTPUT_TEMPLATE = (
'Bayesian classifier: {bayes_rgb:.3g} {bayes_lab:.3g}\n'
'kNN classifier: {knn_rgb:.3g} {knn_lab:.3g}\n'
'SVM classifier: {svm_rgb:.3g} {svm_lab:.3g}\n'
)
# r... | mit |
appapantula/deeppy | examples/autoencoders_mnist.py | 14 | 2777 | #!/usr/bin/env python
"""
Autoencoder pretraining of neural networks
==========================================
"""
import numpy as np
import matplotlib.pyplot as plt
import deeppy as dp
# Fetch MNIST data
dataset = dp.dataset.MNIST()
x_train, y_train, x_test, y_test = dataset.data(flat=True, dp_dtypes=True)
# No... | mit |
cpcloud/odo | odo/backends/hdfstore.py | 9 | 3965 | from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
import datashape
from datashape import discover
from ..append import append
from ..convert import convert, ooc_types
from ..chunks import chunks
from ..resource import resource
from ..utils import filter_kwargs
@... | bsd-3-clause |
cmateu/galstreams | galstreams/footprint.py | 1 | 10176 | # Third-party
import astropy.coordinates as co
import astropy.units as u
import numpy as np
from spherical_geometry.polygon import SingleSphericalPolygon
from .config import config
from .random import get_uniform_spherical_angles
class StreamFootprint:
def __init__(self, name, poly, frame=None):
"""Repre... | bsd-3-clause |
nivm/learningchess | chess/checkmateclassifier/classifier.py | 1 | 10490 | import sys
import os
import numpy as np
from sklearn.svm import SVC
from sklearn.multiclass import OneVsRestClassifier
from sklearn import cross_validation
from sklearn.metrics import confusion_matrix
import pylab as plt
from sklearn.metrics import accuracy_score
import logging
import json
from collections import def... | apache-2.0 |
VladimirTyrin/urbansim | urbansim/utils/tests/test_sampling.py | 5 | 1718 | import numpy as np
import pandas as pd
import pytest
from urbansim.utils.sampling import sample_rows
@pytest.fixture(scope='function')
def random_df(request):
"""
Seed the numpy prng and return a data frame w/ predictable test inputs
so that the tests will have consistent results across builds.
"""
... | bsd-3-clause |
kanchenxi04/vnpy-app | vn.datayes/api.py | 11 | 43801 | #encoding: UTF-8
import os
import json
import time
import requests
import pymongo
import pandas as pd
from datetime import datetime, timedelta
from Queue import Queue, Empty
from threading import Thread, Timer
from pymongo import MongoClient
from requests.exceptions import ConnectionError
from errors import (VNPAST_C... | mit |
csferrie/python-qinfer | src/qinfer/tomography/plotting_tools.py | 3 | 10476 | #!/usr/bin/python
# -*- coding: utf-8 -*-
##
# plotting_tools.py: Functions for plotting tomographic data and estimates.
##
# © 2017, Chris Ferrie (csferrie@gmail.com) and
# Christopher Granade (cgranade@cgranade.com).
#
# Redistribution and use in source and binary forms, with or without
# modification, are pe... | agpl-3.0 |
rothnic/bokeh | examples/charts/file/bar.py | 37 | 2221 | from collections import OrderedDict
import numpy as np
import pandas as pd
from bokeh.charts import Bar, output_file, show, vplot, hplot
from bokeh.models import Range1d
from bokeh.sampledata.olympics2014 import data as original_data
width = 700
height = 500
legend_position = "top_right"
data = {d['abbr']: d['medal... | bsd-3-clause |
WarrenWeckesser/scikits-image | doc/examples/plot_matching.py | 21 | 5132 | """
============================
Robust matching using RANSAC
============================
In this simplified example we first generate two synthetic images as if they
were taken from different view points.
In the next step we find interest points in both images and find
correspondences based on a weighted sum of squ... | bsd-3-clause |
colinbrislawn/scikit-bio | skbio/stats/tests/test_power.py | 12 | 22512 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | bsd-3-clause |
liganega/Gongsu-DataSci | previous/notes2017/W12/GongSu24_Pandas_Introduction_1.py | 6 | 14416 |
# coding: utf-8
# # Pandas 소개
# 앞서 살펴 보았듯이 pandas 모듈은 확률과 통계에 최적화된 파이썬 모듈이다.
# 특히, 데이터프레임(DataFrame) 자료형 클래스는 데이터 분석을 위한 다양한 기능을 제공한다.
# 데이터프레임 자료형의 기본 특성은 다음과 같다.
#
# * 스프레드시트라고 불리는 엑셀 파일에 담긴 테이블을 모방하는 자료형이다.
# * 엑셀에서 제공하는 다양한 기능을 기본 함수(메소드)로 제공한다.
# * 인덱싱, 슬라이싱 기능은 넘파이 모듈의 2차원 어레이와 기본적으로 유사하게 작동한다.
# * SQL이 데이터베이... | gpl-3.0 |
DuCorey/bokeh | bokeh/sampledata/periodic_table.py | 15 | 1575 | '''
This module provides the periodic table as a data set. It exposes an attribute 'elements'
which is a pandas dataframe with the following fields
elements['atomic Number'] (units: g/cm^3)
elements['symbol']
elements['name']
elements['atomic mass'] (units: amu)
elements['CPK'] ... | bsd-3-clause |
heli522/scikit-learn | sklearn/externals/joblib/parallel.py | 86 | 35087 | """
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 |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/examples/misc/longshort.py | 6 | 1676 | """
Illustrate the rec array utility funcitons by loading prices from a
csv file, computing the daily returns, appending the results to the
record arrays, joining on date
"""
import urllib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
# grab the price data off yahoo
u1 = urllib.urlr... | mit |
kdebrab/pandas | pandas/tests/io/generate_legacy_storage_files.py | 3 | 13558 | #!/usr/bin/env python
"""
self-contained to write legacy storage (pickle/msgpack) files
To use this script. Create an environment where you want
generate pickles, say its for 0.18.1, with your pandas clone
in ~/pandas
. activate pandas_0.18.1
cd ~/
$ python pandas/pandas/tests/io/generate_legacy_storage_files.py \
... | bsd-3-clause |
Cloverleaf/uDaq | Ubuntu/uD_timer.py | 1 | 4868 | #This is used to query a JENCO 6230N pH meter
#The command to query this pH meter is "S00"
#The meter will respond with the a structured string of data
#uD3 is the ubuntu version of the uDaq script
#known issues:
#Sensors limit the sampling rate to 30 hZ
#The script slows down after ~1330 measurements. This occurs w... | mit |
kastnerkyle/ift6266h15 | conv_vae.py | 1 | 20906 | # Kyle Kastner
# License: MIT
"""
VAE in a single file.
Bringing in code from IndicoDataSolutions and Alec Radford (NewMu)
"""
import theano
import theano.tensor as T
from theano.compat.python2x import OrderedDict
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from optimizers import rmsprop, sgd_... | bsd-3-clause |
bnaul/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py | 19 | 3140 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess whether the opinion of the author is
positive or negative.
In this examples we will use a... | bsd-3-clause |
meren/oligotyping | Oligotyping/lib/b6lib.py | 2 | 12384 | # -*- coding: utf-8 -*-
# v.112211
# Copyright (C) 2011, Marine Biological Laboratory
#
# 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 2 of the License, or (at your option)
# an... | gpl-2.0 |
kagayakidan/scikit-learn | examples/tree/plot_iris.py | 271 | 2186 | """
================================================================
Plot the decision surface of a decision tree on the iris dataset
================================================================
Plot the decision surface of a decision tree trained on pairs
of features of the iris dataset.
See :ref:`decision tree ... | bsd-3-clause |
datacommonsorg/data | scripts/istat/geos/preprocess.py | 1 | 6055 | # Copyright 2020 Google LLC
#
# 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, ... | apache-2.0 |
ProfessorKazarinoff/staticsite | content/code/statistics/area_under_normal_curve.py | 1 | 1147 | ### Script calculates probability as area under a normal gaussian curve,
### given inputs of x1, x2, mu (mean), sigma(standard deviation) and computes
### the probabability using the integral function and the gaussian curve.
from math import sqrt,erf
## If plotting as well
#import matplotlib.pyplot as plt
#import numpy... | gpl-3.0 |
fmfn/UnbalancedDataset | examples/over-sampling/plot_comparison_over_sampling.py | 2 | 10842 | """
==============================
Compare over-sampling samplers
==============================
The following example attends to make a qualitative comparison between the
different over-sampling algorithms available in the imbalanced-learn package.
"""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# License... | mit |
tomlof/scikit-learn | examples/linear_model/plot_ols_ridge_variance.py | 387 | 2060 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... | bsd-3-clause |
bloyl/mne-python | examples/stats/cluster_stats_evoked.py | 18 | 3021 | """
=======================================================
Permutation F-test on sensor data with 1D cluster level
=======================================================
One tests if the evoked response is significantly different
between conditions. Multiple comparison problem is addressed
with cluster level permuta... | bsd-3-clause |
johnnygreco/hugs | hugs/synths/factory.py | 1 | 3973 | from __future__ import division, print_function
import numpy as np
import pandas as pd
from scipy.signal import fftconvolve
from scipy.special import gammaincinv
import lsst.afw.image
import lsst.geom
from .sersic import Sersic
from ..utils import pixscale, zpt, check_random_state
from ..utils import embed_slices
try... | mit |
xapharius/mrEnsemble | Engine/src/tests/ensemble/regression/bag_test.py | 2 | 1483 | '''
Created on Mar 22, 2015
@author: xapharius
'''
import unittest
import numpy as np
from simulation.sampler.bootstrap_sampler import BootstrapSampler
from factory.homogenous_factory import HomogenousFactory
from datahandler.numerical2.numerical_data_handler import NumericalDataHandler
from sklearn.linear_model impor... | mit |
samzhang111/scikit-learn | doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py | 256 | 2406 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | bsd-3-clause |
arjoly/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 |
mortonjt/scipy | scipy/stats/_binned_statistic.py | 5 | 16974 | from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy._lib.six import callable
def binned_statistic(x, values, statistic='mean',
bins=10, range=None):
"""
Compute a binned statistic for a set of data.
This is a generalization... | bsd-3-clause |
Scapogo/zipline | zipline/gens/brokers/ib_broker.py | 1 | 24210 | #
# 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
# distributed under ... | apache-2.0 |
jia200x/RIOT | tests/pkg_emlearn/generate_digit.py | 11 | 1304 | #!/usr/bin/env python3
"""Generate a binary file from a sample image of the MNIST dataset.
Pixel of the sample are stored as float32, images have size 8x8.
"""
import os
import argparse
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import datase... | lgpl-2.1 |
marmarko/ml101 | tensorflow/examples/skflow/digits.py | 9 | 2380 | # 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... | bsd-2-clause |
dr-nate/msmbuilder | msmbuilder/tests/test_lumping.py | 6 | 3480 | from __future__ import print_function
import numpy as np
from sklearn.pipeline import Pipeline
from msmbuilder.lumping import PCCA, PCCAPlus
from msmbuilder.msm import MarkovStateModel
random = np.random.RandomState(9)
def _metastable_system():
# Make a simple dataset with four states, where there are 2 obviou... | lgpl-2.1 |
huzq/scikit-learn | sklearn/impute/tests/test_knn.py | 15 | 17366 | import numpy as np
import pytest
from sklearn import config_context
from sklearn.impute import KNNImputer
from sklearn.metrics.pairwise import nan_euclidean_distances
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.neighbors import KNeighborsRegressor
from sklearn.utils._testing import assert_allc... | bsd-3-clause |
aewhatley/scikit-learn | sklearn/lda.py | 72 | 17751 | """
Linear Discriminant Analysis (LDA)
"""
# Authors: Clemens Brunner
# Martin Billinger
# Matthieu Perrot
# Mathieu Blondel
# License: BSD 3-Clause
from __future__ import print_function
import warnings
import numpy as np
from scipy import linalg
from .externals.six import string_types
f... | bsd-3-clause |
cjbrasher/LipidFinder | LipidFinder/update_params.py | 1 | 7629 | #!/usr/bin/env python
# Copyright (c) 2019 J. Alvarez-Jarreta and C.J. Brasher
#
# This file is part of the LipidFinder software tool and governed by the
# 'MIT License'. Please see the LICENSE file that should have been
# included as part of this software.
"""Transform the old parameters CSV file for PeakFilter and A... | mit |
ckuethe/gnuradio | gr-filter/examples/fir_filter_ccc.py | 47 | 4019 | #!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# ... | gpl-3.0 |
davebrent/aubio | python/demos/demo_onset_plot.py | 13 | 2433 | #! /usr/bin/env python
import sys
from aubio import onset, source
from numpy import array, hstack, zeros
win_s = 512 # fft size
hop_s = win_s / 2 # hop size
if len(sys.argv) < 2:
print "Usage: %s <filename> [samplerate]" % sys.argv[0]
sys.exit(1)
filename = sys.argv[1]
samplerate ... | gpl-3.0 |
gotomypc/scikit-learn | sklearn/decomposition/tests/test_dict_learning.py | 85 | 8565 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises... | bsd-3-clause |
suttond/MODOI | ase/calculators/jacapo/utils/bandstructure.py | 2 | 7135 | from __future__ import print_function
import os
import numpy as np
import matplotlib.pyplot as plt
from ase.calculators.jacapo import *
from ase.dft.dos import DOS
class BandStructure:
'''outline of class to facilitate band structure calculations
'''
def __init__(self,
atoms,
... | lgpl-3.0 |
FernanOrtega/DAT210x | Module6/assignment3.py | 1 | 2762 | import pandas as pd
from numpy import arange
## Question 1
# Step 1: Load data
X = pd.read_csv('Datasets/parkinsons.data')
# Step 2: splice state column and drop it out. Drop also the 'name' column
y = X['status']
X = X.drop(labels=['name', 'status'], axis=1)
# Step 3: Train&test splits
from sklearn.model_selection... | mit |
Lawrence-Liu/scikit-learn | sklearn/tests/test_multiclass.py | 136 | 23649 | 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 |
icexelloss/arrow | python/benchmarks/streaming.py | 3 | 2542 | # 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 |
gevero/deap | deap/gp.py | 9 | 46662 | # This file is part of DEAP.
#
# DEAP 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) any later version.
#
# DEAP is distributed ... | lgpl-3.0 |
stylianos-kampakis/scikit-learn | examples/plot_digits_pipe.py | 250 | 1809 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Pipelining: chaining a PCA and a logistic regression
=========================================================
The PCA does an unsupervised dimensionality reduction, while the logistic
regression does the predictio... | bsd-3-clause |
Lawrence-Liu/scikit-learn | sklearn/datasets/twenty_newsgroups.py | 126 | 13591 | """Caching loader for the 20 newsgroups text classification dataset
The description of the dataset is available on the official website at:
http://people.csail.mit.edu/jrennie/20Newsgroups/
Quoting the introduction:
The 20 Newsgroups data set is a collection of approximately 20,000
newsgroup documents,... | bsd-3-clause |
vermouthmjl/scikit-learn | sklearn/metrics/cluster/tests/test_supervised.py | 41 | 8901 | import numpy as np
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import homogeneity_score
from sklearn.metrics.cluster import completeness_score
from sklearn.metrics.cluster import v_measure_score
from sklearn.metrics.cluster import homogeneity_completeness_v_measure
from sklearn... | bsd-3-clause |
abimannans/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 |
JohnWinter/ThinkStats2 | code/timeseries.py | 66 | 18035 | """This file contains code for use with "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 pandas
import numpy as np
import statsmodels.formula.api as smf
import st... | gpl-3.0 |
pprett/scikit-learn | examples/hetero_feature_union.py | 81 | 6241 | """
=============================================
Feature Union with Heterogeneous Data Sources
=============================================
Datasets can often contain components of that require different feature
extraction and processing pipelines. This scenario might occur when:
1. Your dataset consists of hetero... | bsd-3-clause |
CurryBoy/ProtoML-Deprecated | protoml/viz/cv_plot.py | 1 | 1111 | from ..nodes.base_node import BaseNode
from ..signal import SignalFunctionType
import matplotlib.pyplot as plt
class CrossValidationVisualizationNode(BaseNode):
def __init__(self):
pass
def signal_types(self):
return [SignalFunctionType('visualize_cross_validation',
... | bsd-3-clause |
uclatommy/tweetfeels | tweetfeels/tweetdata.py | 1 | 9551 | import sqlite3
import os
import pandas as pd
import logging
from datetime import datetime, timedelta
class TweetBin(object):
"""
A container for a time-box of tweets. It includes information regarding the
upper and lower datetime boundaries for the bin.
:param df: The data associated with a bin.
... | bsd-3-clause |
quheng/scikit-learn | sklearn/tests/test_discriminant_analysis.py | 35 | 11709 | try:
# Python 2 compat
reload
except NameError:
# Regular Python 3+ import
from importlib import reload
import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.t... | bsd-3-clause |
sigma-random/numpy | numpy/doc/creation.py | 118 | 5507 | """
==============
Array Creation
==============
Introduction
============
There are 5 general mechanisms for creating arrays:
1) Conversion from other Python structures (e.g., lists, tuples)
2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros,
etc.)
3) Reading arrays from disk, either from... | bsd-3-clause |
eqcorrscan/EQcorrscan | eqcorrscan/utils/plotting.py | 1 | 94525 | """
Utility code for most of the plots used as part of the EQcorrscan package.
:copyright:
EQcorrscan developers.
:license:
GNU Lesser General Public License, Version 3
(https://www.gnu.org/copyleft/lesser.html)
"""
import numpy as np
import logging
import datetime as dt
import copy
import os
import matp... | gpl-3.0 |
xperroni/Dejavu | script/plot_shift.py | 1 | 3646 | #!/usr/bin/env python
from itertools import count, izip
from math import exp
from os.path import join as joinpath
from sys import float_info
from matplotlib import pyplot, cm
from numpy import array, arange
from numpy import min as amin
from numpy import max as amax
from numpy import sum as asum
from numpy import ar... | gpl-3.0 |
warmspringwinds/scikit-image | doc/examples/plot_watershed.py | 4 | 2335 | """
======================
Watershed segmentation
======================
The watershed is a classical algorithm used for **segmentation**, that
is, for separating different objects in an image.
Starting from user-defined markers, the watershed algorithm treats
pixels values as a local topography (elevation). The algo... | bsd-3-clause |
959YLX/ComputerNetworkProjectThree | ExperimentOne/executecommand.py | 1 | 5768 | #! /usr/local/bin/python3
import subprocess
import multiprocessing
import math
import json
import sys
import matplotlib.pyplot as plt
import numpy as np
def run(command, argv):
p = subprocess.Popen(([command] + argv), stdout=subprocess.PIPE, stderr=open('/dev/null', 'w'))
res = p.wait()
if res == 0 or res ... | gpl-3.0 |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/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 |
DGrady/pandas | pandas/core/ops.py | 2 | 54277 | """
Arithmetic operations for PandasObjects
This is not a public API.
"""
# necessary to enforce truediv in Python 2.X
from __future__ import division
import operator
import warnings
import numpy as np
import pandas as pd
import datetime
from pandas._libs import (lib, index as libindex,
tsli... | bsd-3-clause |
lambday/shogun | examples/undocumented/python/graphical/util.py | 10 | 2667 | """ Utilities for matplotlib examples """
import pylab
from numpy import ones, array, double, meshgrid, reshape, linspace, \
concatenate, ravel, pi, sinc
from numpy.random import randn, rand
from shogun import BinaryLabels, RegressionLabels, RealFeatures, SparseRealFeatures
QUITKEY='q'
NUM_EXAMPLES=100
DISTANCE=2
d... | bsd-3-clause |
dirkjot/pingpongcam | pirate/pirate_main.py | 1 | 10756 | # coding: utf-8
"""
Whiteboard-Pirate
Because pirates say AR a lot.
dirk p. janssen, fall 2017
"""
import cv2
import numpy as np
import matplotlib.pyplot as plt
import os
import time
def imshow(img):
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
def tightbluemask(image, clean=True):
"""
... | gpl-3.0 |
gtnx/pandas-highcharts | pandas_highcharts/tests.py | 1 | 5332 | # -*- 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 |
lewisc/spark-tk | regression-tests/sparktkregtests/testcases/models/arimax_test.py | 12 | 4674 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
willhess/aima-python | submissions/Johnson/myNN.py | 13 | 4766 | import traceback
from sklearn.neural_network import MLPClassifier
from submissions.Johnson import education
class DataFrame:
data = []
feature_names = []
target = []
target_names = []
moneyvsthings = DataFrame()
joint = {}
educations = education.get_all_states()
for each in educations:
try:
... | mit |
treycausey/scikit-learn | sklearn/neighbors/tests/test_kde.py | 11 | 4720 | import numpy as np
from sklearn.utils.testing import (assert_allclose, assert_raises,
assert_equal)
from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors
from sklearn.neighbors.ball_tree import kernel_norm
def compute_kernel_slow(Y, X, kernel, h):
d = np.sqrt(((Y... | bsd-3-clause |
ndingwall/scikit-learn | sklearn/utils/tests/test_random.py | 10 | 7360 | import numpy as np
import pytest
import scipy.sparse as sp
from scipy.special import comb
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import _random_choice_csc, sample_without_replacement
from sklearn.utils._random import _our_rand_r_py
##############################################... | bsd-3-clause |
Clyde-fare/scikit-learn | examples/mixture/plot_gmm_pdf.py | 284 | 1528 | """
=============================================
Density Estimation for a mixture of Gaussians
=============================================
Plot the density estimation of a mixture of two Gaussians. Data is
generated from two Gaussians with different centers and covariance
matrices.
"""
import numpy as np
import ma... | bsd-3-clause |
ZenDevelopmentSystems/scikit-learn | examples/classification/plot_digits_classification.py | 289 | 2397 | """
================================
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... | bsd-3-clause |
tejasnikumbh/AllSAT | lib/python2.7/site-packages/numpy/core/tests/test_multiarray.py | 23 | 175667 | from __future__ import division, absolute_import, print_function
import tempfile
import sys
import os
import shutil
import warnings
import operator
import io
if sys.version_info[0] >= 3:
import builtins
else:
import __builtin__ as builtins
from decimal import Decimal
import numpy as np
from nose import SkipT... | mit |
bhargav/scikit-learn | sklearn/preprocessing/tests/test_data.py | 6 | 59260 |
# Authors:
#
# Giorgio Patrini
#
# License: BSD 3 clause
import warnings
import numpy as np
import numpy.linalg as la
from scipy import sparse
from distutils.version import LooseVersion
from sklearn.externals.six import u
from sklearn.utils import gen_batches
from sklearn.utils.testing import assert_almost... | bsd-3-clause |
zhenv5/scikit-learn | benchmarks/bench_plot_neighbors.py | 287 | 6433 | """
Plot the scaling of the nearest neighbors algorithms with k, D, and N
"""
from time import time
import numpy as np
import pylab as pl
from matplotlib import ticker
from sklearn import neighbors, datasets
def get_data(N, D, dataset='dense'):
if dataset == 'dense':
np.random.seed(0)
return np.... | bsd-3-clause |
glouppe/scikit-learn | sklearn/neural_network/tests/test_rbm.py | 225 | 6278 | import sys
import re
import numpy as np
from scipy.sparse import csc_matrix, csr_matrix, lil_matrix
from sklearn.utils.testing import (assert_almost_equal, assert_array_equal,
assert_true)
from sklearn.datasets import load_digits
from sklearn.externals.six.moves import cStringIO as ... | bsd-3-clause |
dkasak/pacal | pacal/utils.py | 1 | 22224 | # PaCal - the probabilistic calculator
# Copyright (C) 2009 Szymon Jaroszewicz, Marcin Korzen
#
# 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, o... | gpl-3.0 |
PythonCharmers/bokeh | examples/plotting/file/unemployment.py | 46 | 1846 | from collections import OrderedDict
import numpy as np
from bokeh.plotting import ColumnDataSource, figure, show, output_file
from bokeh.models import HoverTool
from bokeh.sampledata.unemployment1948 import data
# Read in the data with pandas. Convert the year column to string
data['Year'] = [str(x) for x in data['Y... | bsd-3-clause |
huzq/scikit-learn | sklearn/neighbors/tests/test_dist_metrics.py | 5 | 6349 | import itertools
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
import pytest
from scipy.spatial.distance import cdist
from sklearn.neighbors import DistanceMetric
from sklearn.neighbors import BallTree
from sklearn.utils import check_random_state
from sklearn.utils._testing imp... | bsd-3-clause |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/dask/dataframe/tests/test_reshape.py | 2 | 9042 | import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
import dask.dataframe as dd
from dask.dataframe.utils import assert_eq, make_meta, PANDAS_VERSION
skip_if_no_get_dummies_sparse = pytest.mark.skipif(PANDAS_VERSION < '0.23.0',
rea... | gpl-3.0 |
Haunter17/MIR_SU17 | exp1/exp1g.py | 1 | 252251 | import numpy as np
import tensorflow as tf
import h5py
from sklearn.preprocessing import OneHotEncoder
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import time
startTime = time.time()
print('==> Experiment 1g')
def loadData(filepath):
print('==> Loading data from {}'.format(filepath))
f... | mit |
squirrelo/qiita | qiita_pet/handlers/study_handlers/tests/test_artifact.py | 1 | 7373 | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | bsd-3-clause |
gpersistence/tstop | scripts/simple_time_series_plotter.py | 1 | 1050 | #TSTOP
#
#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,
... | gpl-3.0 |
tomvansteijn/openradar | setup.py | 1 | 2099 | from setuptools import setup
version = '0.5.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Pillow',
'celery',
'celery[redis]',
'gdal',
'h5py>=2.3.1',
'matplotlib',
'numpy',
'pandas',
'psycopg2',
... | gpl-3.0 |
lekshmideepu/nest-simulator | pynest/nest/lib/hl_api_spatial.py | 11 | 45204 | # -*- coding: utf-8 -*-
#
# hl_api_spatial.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 |
buddyd16/Structural-Engineering | Code/snow_drift_by_polygons.py | 1 | 29825 | '''
BSD 3-Clause License
Copyright (c) 2019, Donald N. Bockoven III
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
l... | bsd-3-clause |
NDKoehler/DataScienceBowl2017_7th_place | dsb3_networks/classification/resnet2D_0.7res_100/config_2Dfinal.py | 1 | 3207 | from collections import defaultdict
from datetime import datetime
import json
import tensorflow as tf
import os, sys
import pandas as pd
#config dic
H = defaultdict(lambda: None)
#All possible config options:
H['optimizer'] = 'MomentumOptimizer'#'RMSPropOptimizer'
H['learning_rate'] = 0.001
H['momentum'] = 0.9 #0.9... | mit |
scimusmn/energy_tools | graph.py | 1 | 1696 | """Graph CSV energy data
Usage:
graph.py <input_file>
graph.py (-h | --help)
graph.py --version
Options:
-h --help Show this help.
--version Show version number.
"""
from docopt import docopt
import csv
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import dateutil
def ... | mit |
kashif/scikit-learn | sklearn/ensemble/tests/test_iforest.py | 19 | 6625 |
"""
Testing for Isolation Forest algorithm (sklearn.ensemble.iforest).
"""
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.... | bsd-3-clause |
fridewald/QEdark_1k | tools/bandsndos/bandsndos_Ge.py | 4 | 20068 | #
# Adrian Soto
# 22-12-2014
# Stony Brook University
#
################################################
# Plot band structure and DOS from the
# output of the bands.x program in the
# Quantum Espresso package.
#
# Features:
# 1) Allows for scissor correction (band shift)
# 2)
#
###################################... | gpl-2.0 |
grehx/spark-tk | regression-tests/sparktkregtests/testcases/scoretests/logistic_regression_test.py | 1 | 2428 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
fredhusser/scikit-learn | examples/manifold/plot_lle_digits.py | 181 | 8510 | """
=============================================================================
Manifold learning on handwritten digits: Locally Linear Embedding, Isomap...
=============================================================================
An illustration of various embeddings on the digits dataset.
The RandomTreesEmbed... | bsd-3-clause |
wangzw/tushare | tushare/stock/reference.py | 27 | 25190 | # -*- coding:utf-8 -*-
"""
投资参考数据接口
Created on 2015/03/21
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
from __future__ import division
from tushare.stock import cons as ct
from tushare.stock import ref_vars as rv
from tushare.util import dateu as dt
import pandas as pd
import time
i... | bsd-3-clause |
panmari/tensorflow | tensorflow/contrib/skflow/python/skflow/io/data_feeder.py | 1 | 15959 | """Implementations of different data feeders to provide data for TF trainer."""
# Copyright 2015-present Scikit Flow 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 Li... | apache-2.0 |
abali96/Shapely | docs/code/convex_hull.py | 6 | 1191 | from matplotlib import pyplot
from shapely.geometry import MultiPoint
from descartes.patch import PolygonPatch
from figures import SIZE
fig = pyplot.figure(1, figsize=SIZE, dpi=90)
fig.set_frameon(True)
# 1
ax = fig.add_subplot(121)
points2 = MultiPoint([(0, 0), (2, 2)])
for p in points2:
ax.plot(p.x, p.y, 'o'... | bsd-3-clause |
sinhrks/scikit-learn | sklearn/feature_extraction/tests/test_feature_hasher.py | 258 | 2861 | from __future__ import unicode_literals
import numpy as np
from sklearn.feature_extraction import FeatureHasher
from nose.tools import assert_raises, assert_true
from numpy.testing import assert_array_equal, assert_equal
def test_feature_hasher_dicts():
h = FeatureHasher(n_features=16)
assert_equal("dict",... | bsd-3-clause |
paninski-lab/yass | src/yass/pd_split.py | 1 | 20722 | import logging
import os
import numpy as np
import torch
from tqdm import tqdm
from sklearn.decomposition import PCA
from sklearn.mixture import GaussianMixture
from diptest import diptest as dp
import yass
from yass import read_config
from yass.reader import READER
from yass.residual.residual_gpu import RESIDUAL_GPU... | apache-2.0 |
gfyoung/pandas | pandas/tests/frame/methods/test_quantile.py | 1 | 18363 | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame, Series, Timestamp
import pandas._testing as tm
pytestmark = td.skip_array_manager_not_yet_implemented
class TestDataFrameQuantile:
@pytest.mark.parametrize(
"df,expected",
... | bsd-3-clause |
clemkoa/scikit-learn | examples/linear_model/plot_theilsen.py | 76 | 3848 | """
====================
Theil-Sen Regression
====================
Computes a Theil-Sen Regression on a synthetic dataset.
See :ref:`theil_sen_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers. It has a breakd... | bsd-3-clause |
skyie/codecomplete | src/python/visualize/xsl_tool.py | 1 | 1406 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from xlrd import open_workbook
class XslTool(object):
def __init__(self):
pass
@classmethod
def read(cls, filepath):
u"""
关于ASCII,unicode,UTF-8编码关系
htt... | apache-2.0 |
TheGrimmScientist/pyDAEDALUS | Automated_Design/dna_info.py | 1 | 26100 | import math
from copy import deepcopy
import mpmath
import numpy as np
from Automated_Design.constants import VERMILLION, REDPURPLE, WHITE, BLU, ORANG
from Automated_Design.util import intersect_lists
# parameters
d = 3.4 # angstroms, distance between two nucleotides
IHD = 20 # angstroms, inter-helical distance
r... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.