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 |
|---|---|---|---|---|---|
meteorcloudy/tensorflow | tensorflow/contrib/eager/python/examples/rnn_colorbot/rnn_colorbot.py | 14 | 13765 | # Copyright 2017 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 |
nmayorov/scikit-learn | examples/covariance/plot_outlier_detection.py | 41 | 4216 | """
==========================================
Outlier detection with several methods.
==========================================
When the amount of contamination is known, this example illustrates three
different ways of performing :ref:`outlier_detection`:
- based on a robust estimator of covariance, which is assum... | bsd-3-clause |
msincenselee/vnpy | prod/jobs/refill_tdx_cb_stock_bars.py | 1 | 3556 | # flake8: noqa
"""
下载通达信可转债1分钟bar => vnpy项目目录/bar_data/
上海股票 => SSE子目录
深圳股票 => SZSE子目录
"""
import os
import sys
import csv
import json
from collections import OrderedDict
import pandas as pd
vnpy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
if vnpy_root not in sys.path:
sys.path.appe... | mit |
huangzy77/Machine-Learning-WorkBook | KNN/kNN.py | 1 | 2661 | # -*- coding:utf-8 -*-
from numpy import *
import operator
import matplotlib.pyplot as plt
#page17
def creatDataSet():
group=array([[1,1.1],[1,1],[0,0],[0,1]])
labels=['A','A','B','B']
return group,labels
#page19
def classify0(inX,dataSet,labels,k):
dataSetSize=dataSet.shape[0]
diffMat=tile(inX,(dataSetSize,1... | apache-2.0 |
treycausey/scikit-learn | sklearn/decomposition/nmf.py | 1 | 18894 | """ 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 |
Bulochkin/tensorflow_pack | tensorflow/contrib/learn/python/learn/grid_search_test.py | 137 | 2035 | # 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 |
depet/scikit-learn | sklearn/ensemble/tests/test_forest.py | 3 | 15278 | """
Testing for the forest module (sklearn.ensemble.forest).
"""
# Authors: Gilles Louppe, Brian Holt, Andreas Mueller
# License: BSD 3 clause
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_equal
from numpy.testing i... | bsd-3-clause |
caidongyun/BuildingMachineLearningSystemsWithPython | ch05/classify.py | 20 | 8239 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import time
start_time = time.time()
import numpy as np
from sklearn.metrics import classification_re... | mit |
mkomeichi/BuildingMLSystemsWithPython | ch08/corrneighbours.py | 23 | 1779 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
from __future__ import print_function
import numpy as np
from load_ml100k import get_train_test
from sc... | mit |
cagriulas/algorithm-analysis-17 | w4/sort_complexity_graphic.py | 2 | 3346 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import random
import time
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items)-1-i):
if items[j] > items[j+1]:
items[j], items[j+1] = items[j+1], items[j]
def selection_sort(items):
... | unlicense |
dsullivan7/scikit-learn | sklearn/cluster/birch.py | 18 | 22657 | # Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Joel Nothman <joel.nothman@gmail.com>
# License: BSD 3 clause
from __future__ import division
import warnings
import numpy as np
from scipy import sparse
from math import sqrt
fro... | bsd-3-clause |
uweschmitt/emzed | ms/align.py | 1 | 7081 | #encoding:utf-8
def rtAlign(tables, refTable = None, destination = None, nPeaks=-1,
numBreakpoints=5, maxRtDifference = 100, maxMzDifference = 0.3,
maxMzDifferencePairfinder = 0.5, forceAlign=False):
""" aligns feature tables in respect to retention times.
the algorithm produces ne... | gpl-3.0 |
ishanic/scikit-learn | sklearn/ensemble/tests/test_weight_boosting.py | 22 | 16769 | """Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal, assert_true
from sklearn.utils.testing import assert_raises... | bsd-3-clause |
seekshreyas/obidroid | clustering_v2.py | 1 | 1852 | #! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Clustering Version 2
=====================
After Feature Extraction, that returns a data of the format
[(filename, linenum, vote, sentence, feat1, feat2, ...)]
Improving the initial clustering mechanism (via R scripts) to
SciKit based clustering and producing plots
F... | mit |
johnveitch/cpnest | examples/diagnose_trajectory.py | 1 | 1089 | import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import sys, os
np.seterr(all='raise')
def log_likelihood(x):
return np.sum([-0.5*x[n]**2-0.5*np.log(2.0*np.pi) for n in range(x.shape[0])])
mode = sys.argv[1]
if mode == 'delete':
allfiles = os.listdir('.')
toremove = [a for a ... | mit |
dilawar/moose-core | python/moose/helper.py | 4 | 2432 | """helper.py:
Some helper functions which are compatible with both python2 and python3.
"""
__author__ = "Dilawar Singh"
__copyright__ = "Copyright 2017-, Dilawar Singh"
__version__ = "1.0.0"
__maintainer__ = "Dilawar Singh"
__email__ = "dilawars@ncbs.res.in"
__status__... | gpl-3.0 |
djsilenceboy/LearnTest | Python_Test/PySample1/com/djs/learn/chart/TestMatplotlibHistogram.py | 1 | 1054 | '''
Created on Jun 18, 2017
@author: dj
'''
from os import path
from matplotlib import pyplot as plot
import numpy as np
output_file_path = "../../../../Temp"
output_file = "SampleChart_Histogram.png"
plot.style.use("ggplot")
mu1, mu2, sigma = 100, 130, 15
x1 = mu1 + sigma * np.random.randn(10000)
x2 = mu2 + si... | apache-2.0 |
wchan/tensorflow | tensorflow/examples/skflow/iris_val_based_early_stopping.py | 2 | 2221 | # Copyright 2015-present The 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
endplay/omniplay | test/partitioning_model/src/eval_given_model.py | 1 | 3855 | #!/usr/bin/python
import matplotlib.pyplot as plt
import math
import numpy as np
import sys
import optparse
import os
import copy
from scipy import stats
import graph_utilities
HEADINGS = ["utime","uinsts"]
def get_stats(input_dir, data_file):
dift = []
utime = []
taint_in = []
taint_out = []
ui... | bsd-2-clause |
ilastikdev/ilastik | ilastik/applets/pixelClassification/pixelClassificationGui.py | 1 | 36506 | ###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | gpl-3.0 |
justincassidy/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py | 254 | 2253 | """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 |
CNS-OIST/STEPS_Example | publication_models/API_1/Chen_FNeuroinf__2017/purkinje_model/extra/activity_viewer.py | 1 | 12590 | from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from pylab import *
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui, QtOpenGL
import pyqtgraph.opengl as gl
import random
import sys
import os
import random
from numpy import outer
from matplotlib.backends imp... | gpl-2.0 |
louisLouL/pair_trading | capstone_env/lib/python3.6/site-packages/matplotlib/tests/test_patheffects.py | 2 | 5584 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import pytest
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
@image_comparison(baseline_images=['p... | mit |
UWSEDS-aut17/uwseds-group-city-fynders | cityfynders/tests/test_usmap.py | 1 | 1044 | import unittest
import pandas as pd
from cityfynders.plotly_usmap import usmap, newdf
class usmapget(unittest.TestCase):
"""
This is to test the two funcions usmap and newdf in ploltly_usmap.py
The frist test is a smoke test to see if the function can run
The second test is done by giving a particular... | mit |
b29308188/MMAI_final | src/tagger.py | 1 | 4002 | import cv2
import sys
sys.path.append(".")
import glob
import os
import pandas as pd
from operator import itemgetter
from utils import detect_faces
if __name__ == "__main__":
try:
#folder that contains untagged images
input_folder = sys.argv[1]
#folder that contains tagged images
... | gpl-2.0 |
unnikrishnankgs/va | venv/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py | 10 | 9036 | """
Render to qt from agg
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import ctypes
import sys
import traceback
from matplotlib.figure import Figure
from .backend_agg import FigureCanvasAgg
from .backend_qt5 import QtCore
from .backend_... | bsd-2-clause |
fedhere/pyMCZ | pyMCZ/mcz.py | 1 | 32495 | #!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import warnings
import numpy as np
import scipy.stats as stats
from scipy.special import gammaln
from scipy import optimize
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import csv as csv... | mit |
anaderi/lhcb_trigger_ml | hep_ml/ugradientboosting.py | 1 | 6131 | from __future__ import print_function, division, absolute_import
import copy
import numpy
import pandas
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.tree.tree import DecisionTreeRegressor, DTYPE
from sklearn.utils.random import check_random_state
from sklearn.utils.validation import column_or_... | mit |
ngoix/OCRF | sklearn/neighbors/tests/test_dist_metrics.py | 38 | 6118 | import itertools
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
import scipy
from scipy.spatial.distance import cdist
from sklearn.neighbors.dist_metrics import DistanceMetric
from nose import SkipTest
def dist_func(x1, x2, p):
return np.sum((x1 - x2) ** p) ** (1. / p)
de... | bsd-3-clause |
domanova/highres-cortex | python/highres_cortex/od_extractProfilesTest.py | 1 | 8744 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright CEA (2014).
# Copyright Université Paris XI (2014).
#
# Contributor: Olga Domanova <olga.domanova@cea.fr>.
#
# This file is part of highres-cortex, a collection of software designed
# to process high-resolution magnetic resonance images of the cerebral
# cort... | gpl-3.0 |
YinongLong/scikit-learn | sklearn/feature_extraction/image.py | 21 | 17610 | """
The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to
extract features from images.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel
# Vlad Niculae
# License: BSD 3 clause
fro... | bsd-3-clause |
bradysalz/Tone-Matrix | plot/plotting.py | 1 | 1868 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 23 16:09:59 2017
@author: brady
"""
import os
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
mpl.style.use('research')
#%% Schmitt Trigger
df = pd.read_csv('SchmittTrigger.txt', sep='\t| ', engine='python')
df.columns ... | mit |
pbulsink/profile_plotter | profile_plotter.py | 1 | 14958 | #!/usr/bin/env python
#Profile Plotter
#Programmer: Philip Bulsink
#Licence: BSD
#Plots reaction profiles using matplotlib by reading in energies from a file.
#See the readme.md file for more information
from profile_plotter_helpers import *
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
impo... | bsd-2-clause |
dhruv13J/scikit-learn | sklearn/utils/tests/test_shortest_path.py | 88 | 2828 | from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | bsd-3-clause |
mattgiguere/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 |
luo66/scikit-learn | examples/linear_model/lasso_dense_vs_sparse_data.py | 348 | 1862 | """
==============================
Lasso on dense and sparse data
==============================
We show that linear_model.Lasso provides the same results for dense and sparse
data and that in the case of sparse data the speed is improved.
"""
print(__doc__)
from time import time
from scipy import sparse
from scipy ... | bsd-3-clause |
yu239/Paddle | python/paddle/utils/plotcurve.py | 18 | 5166 | #!/usr/bin/python
# Copyright (c) 2016 PaddlePaddle 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 ... | apache-2.0 |
ManuSchmi88/landlab | landlab/components/flow_routing/examples/test_lake_mapper.py | 6 | 1422 | from landlab import RasterModelGrid
from landlab.plot.imshow import imshow_node_grid
from landlab.components.flow_routing import (FlowRouter,
DepressionFinderAndRouter)
from matplotlib.pyplot import figure, plot, show
import numpy as np
nx, ny = 50, 50
mg = RasterModelGrid(... | mit |
astrofrog/numpy | doc/sphinxext/plot_directive.py | 65 | 20399 | """
A special directive for generating a matplotlib plot.
.. warning::
This is a hacked version of plot_directive.py from Matplotlib.
It's very much subject to change!
Usage
-----
Can be used like this::
.. plot:: examples/example.py
.. plot::
import matplotlib.pyplot as plt
plt.plot... | bsd-3-clause |
loli/semisupervisedforests | sklearn/__check_build/__init__.py | 345 | 1671 | """ Module to give helpful messages to the user that did not
compile the scikit properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.""... | bsd-3-clause |
gfyoung/pandas | pandas/tests/indexes/test_frozen.py | 8 | 3069 | import re
import pytest
from pandas.core.indexes.frozen import FrozenList
class TestFrozenList:
unicode_container = FrozenList(["\u05d0", "\u05d1", "c"])
def setup_method(self, _):
self.lst = [1, 2, 3, 4, 5]
self.container = FrozenList(self.lst)
def check_mutable_error(self, *args, **... | bsd-3-clause |
zhouyao1994/incubator-superset | superset/utils/core.py | 1 | 40311 | # 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 |
vybstat/scikit-learn | examples/decomposition/plot_ica_vs_pca.py | 306 | 3329 | """
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... | bsd-3-clause |
skyleradams/tim-howard | Python/VisionDynamixelFused.py | 1 | 13254 | import os, platform
import dynamixel
import time
import options
import math
import serial
import numpy as np
import goalieFunctions
from matplotlib import pyplot as plt
from matplotlib.pylab import subplots,close
from mpl_toolkits.mplot3d import Axes3D
import sys,socket,struct,signal
''' Definitions and initialization... | mit |
rsivapr/scikit-learn | sklearn/decomposition/tests/test_truncated_svd.py | 8 | 2692 | """Test truncated SVD transformer."""
import numpy as np
import scipy.sparse as sp
from sklearn.decomposition import TruncatedSVD
from sklearn.utils import check_random_state
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_raises)
# Make an X tha... | bsd-3-clause |
synthicity/synthpop | synthpop/synthesizer.py | 2 | 5587 | import logging
import sys
from collections import namedtuple
import numpy as np
import pandas as pd
from scipy.stats import chisquare
from . import categorizer as cat
from . import draw
from .ipf.ipf import calculate_constraints
from .ipu.ipu import household_weights
logger = logging.getLogger("synthpop")
FitQuality... | bsd-3-clause |
aerokappa/SantaClaus | processOutput.py | 1 | 1258 | import numpy as np
import pandas as pd
from processInput import processInput
def processOutput( ):
fileName = 'gifts.csv'
giftList, giftListSummary = processInput( fileName )
packedBags = []
for i in np.arange(1000):
print i
currentBag = []
itemCount... | mit |
PatrickOReilly/scikit-learn | sklearn/tests/test_learning_curve.py | 59 | 10869 | # Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import sys
from sklearn.externals.six.moves import cStringIO as StringIO
import numpy as np
import warnings
from sklearn.base import BaseEstimator
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import ... | bsd-3-clause |
nushio3/UFCORIN | script/review-forecast-long.py | 1 | 3550 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import astropy.time as time
import datetime, os
import pickle
import subprocess
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
os.chdir(os.path.dirname(__file__))
def discrete_t(t):
epoch = datetime.datetime(2... | mit |
lampts/sklearn_pycon2015 | notebooks/fig_code/ML_flow_chart.py | 61 | 4970 | """
Tutorial Diagrams
-----------------
This script plots the flow-charts used in the scikit-learn tutorials.
"""
import numpy as np
import pylab as pl
from matplotlib.patches import Circle, Rectangle, Polygon, Arrow, FancyArrow
def create_base(box_bg = '#CCCCCC',
arrow1 = '#88CCFF',
... | bsd-3-clause |
huggingface/transformers | examples/flax/language-modeling/run_t5_mlm_flax.py | 1 | 34953 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team 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-... | apache-2.0 |
BlueBrain/NEST | pynest/examples/HillTononi/ht_current.py | 4 | 3357 | # -*- coding: utf-8 -*-
#
# ht_current.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, or
... | gpl-2.0 |
dilipbobby/DataScience | Numpy/matplots/subplots.py | 1 | 1034 | import numpy as np
from numpy import e, pi, sin, exp, cos
import matplotlib.pyplot as plt
def f(t):
return exp(-t) * cos(2*pi*t)
def fp(t):
return -2*pi * exp(-t) * sin(2*pi*t) - e**(-t)*cos(2*pi*t)
def g(t):
return sin(t) * cos(1/(t+0.1))
def g(t):
return sin(t) * cos(1/(t))
python_course_green = "#476... | apache-2.0 |
spectralDNS/shenfun | demo/neumann_poisson3D.py | 1 | 2432 | r"""
Solve Poisson equation in 3D with periodic bcs in two directions
and homogeneous Neumann in the third
\nabla^2 u = f,
Use Fourier basis for the periodic directions and Shen's Neumann basis for the
non-periodic direction.
The equation to solve is
(\nabla^2 u, v) = (f, v)
"""
import sys
import os
impor... | bsd-2-clause |
pkruskal/scikit-learn | examples/svm/plot_svm_regression.py | 249 | 1451 | """
===================================================================
Support Vector Regression (SVR) using linear and non-linear kernels
===================================================================
Toy example of 1D regression using linear, polynomial and RBF kernels.
"""
print(__doc__)
import numpy as np
... | bsd-3-clause |
narendrameena/featuerSelectionAssignment | crossValidation.py | 1 | 3370 | import numpy as np
from sklearn import cross_validation
from sklearn import svm
from sklearn.svm import LinearSVC
from sklearn.datasets import load_svmlight_file
from sklearn.pipeline import make_pipeline
from sklearn.feature_selection import SelectFromModel
from sklearn.feature_selection import RFE
from sklearn.cross_... | cc0-1.0 |
alexeyum/scikit-learn | examples/linear_model/plot_lasso_and_elasticnet.py | 73 | 2074 | """
========================================
Lasso and Elastic Net for Sparse Signals
========================================
Estimates Lasso and Elastic-Net regression models on a manually generated
sparse signal corrupted with an additive noise. Estimated coefficients are
compared with the ground-truth.
"""
print(... | bsd-3-clause |
MohammedWasim/scikit-learn | sklearn/neighbors/classification.py | 132 | 14388 | """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 |
lesteve/sphinx-gallery | tutorials/plot_parse.py | 1 | 2776 | # -*- coding: utf-8 -*-
"""
The Header Docstring
====================
When writting latex in a Python string keep in mind to escape the backslashes
or use a raw docstring
.. math:: \\sin (x)
Closing this string quotes on same line"""
##############################################################################
# ... | bsd-3-clause |
sho-87/cognitive-battery | tasks/ant.py | 1 | 14718 | import os
import sys
import time
import pandas as pd
import numpy as np
import pygame
from pygame.locals import *
from itertools import product
from utils import display
class ANT(object):
def __init__(self, screen, background, blocks=3):
# Get the pygame display window
self.screen = screen
... | mit |
christianurich/VIBe2UrbanSim | 3rdparty/opus/src/biocomplexity/opus_core/upc_sequence.py | 2 | 7791 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from scipy.ndimage import histogram
from numpy import reshape, arange, where
from opus_core.misc import DebugPrinter
from opus_core.resources import Resources
from opus_core.logger import logge... | gpl-2.0 |
teonlamont/mne-python | examples/realtime/ftclient_rt_compute_psd.py | 6 | 2550 | """
==============================================================
Compute real-time power spectrum density with FieldTrip client
==============================================================
Please refer to `ftclient_rt_average.py` for instructions on
how to get the FieldTrip connector working in MNE-Python.
This e... | bsd-3-clause |
ChinaQuants/bokeh | bokeh/_legacy_charts/tests/test_legacy_data_adapter.py | 6 | 3293 | """ This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | bsd-3-clause |
mayblue9/scikit-learn | examples/cluster/plot_digits_linkage.py | 369 | 2959 | """
=============================================================================
Various Agglomerative Clustering on a 2D embedding of digits
=============================================================================
An illustration of various linkage option for agglomerative clustering on
a 2D embedding of the di... | bsd-3-clause |
raymondxyang/tensorflow | tensorflow/contrib/timeseries/examples/predict.py | 69 | 5579 | # Copyright 2017 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 |
adamsteer/python-opencv-image-projection | rectify/warp_im_list.py | 1 | 14840 | # Reverse photography
##h3D-II sensor size
# 36 * 48 mm, 0.036 x 0.048m
## focal length
# 28mm, 0.028m
## multiplier
# 1.0
from skimage import io
import matplotlib.pyplot as plt
import numpy as np
import cv2
from scipy.spatial import distance
import shapefile as shp
def buildshape(corners, filename):
"""build ... | mit |
DGrady/pandas | pandas/tests/io/parser/comment.py | 27 | 3757 | # -*- coding: utf-8 -*-
"""
Tests that comments are properly handled during parsing
for all of the parsers defined in parsers.py
"""
import numpy as np
import pandas.util.testing as tm
from pandas import DataFrame
from pandas.compat import StringIO
class CommentTests(object):
def test_comment(self):
d... | bsd-3-clause |
harish-garg/Machine-Learning | udacity/regression/linear_reg_example02/regressionQuiz.py | 1 | 1945 | import numpy
import matplotlib.pyplot as plt
from ages_net_worths import ageNetWorthData
ages_train, ages_test, net_worths_train, net_worths_test = ageNetWorthData()
from sklearn.linear_model import LinearRegression
reg = LinearRegression()
reg.fit(ages_train, net_worths_train)
### get Katie's net worth (she's 2... | mit |
d-mittal/pystruct | examples/plot_directional_grid.py | 5 | 2038 | """
===========================================
Learning directed interactions on a 2d grid
===========================================
Simple pairwise model with arbitrary interactions on a 4-connected grid.
There are different pairwise potentials for the four directions.
All the examples are basically the same, thre... | bsd-2-clause |
dingocuster/scikit-learn | examples/exercises/plot_iris_exercise.py | 323 | 1602 | """
================================
SVM Exercise
================================
A tutorial exercise for using different SVM kernels.
This exercise is used in the :ref:`using_kernels_tut` part of the
:ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`.
"""
print(__doc__)
import numpy as np
i... | bsd-3-clause |
pprett/scikit-learn | sklearn/datasets/tests/test_20news.py | 75 | 3266 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
toolforger/sympy | sympy/external/importtools.py | 85 | 7294 | """Tools to assist importing optional external modules."""
from __future__ import print_function, division
import sys
# Override these in the module to change the default warning behavior.
# For example, you might set both to False before running the tests so that
# warnings are not printed to the console, or set bo... | bsd-3-clause |
Reagankm/KnockKnock | venv/lib/python3.4/site-packages/matplotlib/backends/backend_qt4agg.py | 11 | 3003 | """
Render to qt from agg
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import os # not used
import sys
import ctypes
import warnings
import matplotlib
from matplotlib.figure import Figure
from .backend_qt5agg import NavigationToolbar2QT... | gpl-2.0 |
dingocuster/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 |
nvoron23/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 221 | 2702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
wkfwkf/statsmodels | statsmodels/datasets/co2/data.py | 25 | 3045 | #! /usr/bin/env python
"""Mauna Loa Weekly Atmospheric CO2 Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = """Mauna Loa Weekly Atmospheric CO2 Data"""
SOURCE = """
Data obtained from http://cdiac.ornl.gov/trends/co2/sio-keel-flask/sio-keel-flaskmlo_c.html
Obt... | bsd-3-clause |
rolandwz/pymisc | strader/voters/initial.py | 1 | 6072 | # -*- coding: utf-8 -*-
import datetime, time, csv, os
import numpy as np
from utils.db import SqliteDB
from utils.rwlogging import log
from utils.rwlogging import strategyLogger as logs
from utils.rwlogging import balLogger as logb
from indicator import ma, macd, bolling, rsi, kdj
import matplotlib.pyplot as plt
peri... | mit |
NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/tests/frame/test_operators.py | 1 | 45060 | # -*- coding: utf-8 -*-
from __future__ import print_function
from collections import deque
from datetime import datetime
import operator
import pytest
from numpy import nan, random
import numpy as np
from pandas.compat import lrange, range
from pandas import compat
from pandas import (DataFrame, Series, MultiIndex... | apache-2.0 |
ashhher3/seaborn | seaborn/matrix.py | 8 | 41835 | """Functions to visualize matrices of data."""
import itertools
import colorsys
import matplotlib as mpl
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import pandas as pd
from scipy.spatial import distance
from scipy.cluster import ... | bsd-3-clause |
Unidata/MetPy | v0.8/_downloads/meteogram_metpy.py | 6 | 8767 | # Copyright (c) 2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Meteogram
=========
Plots time series data as a meteogram.
"""
import datetime as dt
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from metpy.ca... | bsd-3-clause |
Eric89GXL/scikit-learn | examples/randomized_search.py | 57 | 3208 | """
=========================================================================
Comparing randomized search and grid search for hyperparameter estimation
=========================================================================
Compare randomized search and grid search for optimizing hyperparameters of a
random forest.
... | bsd-3-clause |
clemkoa/scikit-learn | benchmarks/bench_20newsgroups.py | 377 | 3555 | from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... | bsd-3-clause |
researchstudio-sat/wonpreprocessing | python-processing/classification/multiclass_classifier.py | 1 | 4712 | __author__ = 'Federico'
# Multiclass Naive-Bayes classifier for categorization of WoN e-mail dataset
# It uses MultinomialNB classifier
from numpy import *
from tools.tensor_utils import read_input_tensor, SparseTensor
from sklearn import metrics
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline impo... | apache-2.0 |
colettace/wnd-charm | tests/pywndcharm_tests/test_PyImageMatrix.py | 2 | 7291 | """
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright (C) 2015 National Institutes of Health
This library is free software; you can redistribute it and/or
modify it under the ... | lgpl-2.1 |
manashmndl/scikit-learn | sklearn/svm/tests/test_svm.py | 116 | 31653 | """
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import numpy as np
import itertools
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.testing import assert_almost_equal
from scipy import sparse
from nose.tools im... | bsd-3-clause |
pierrebaque/EM | ZtoY.py | 2 | 7476 | import os
import Config
import numpy as np
import random
from PIL import Image
import cv2
import math
import matplotlib.pyplot as plt
from IO_funcs import *
def SampleZ(em_it):
#Extract bounding box coordinates
W,H = get_HW(Config.pom_file_path)
bboxes_cam_list = []
for cam in Config.cameras_list:
... | gpl-3.0 |
maniteja123/sympy | sympy/physics/quantum/circuitplot.py | 58 | 12941 | """Matplotlib based plotting of quantum circuits.
Todo:
* Optimize printing of large circuits.
* Get this to work with single gates.
* Do a better job checking the form of circuits to make sure it is a Mul of
Gates.
* Get multi-target gates plotting.
* Get initial and final states to plot.
* Get measurements to plo... | bsd-3-clause |
PrashntS/scikit-learn | sklearn/neighbors/tests/test_dist_metrics.py | 230 | 5234 | import itertools
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
import scipy
from scipy.spatial.distance import cdist
from sklearn.neighbors.dist_metrics import DistanceMetric
from nose import SkipTest
def dist_func(x1, x2, p):
return np.sum((x1 - x2) ** p) ** (1. / p)
de... | bsd-3-clause |
Windy-Ground/scikit-learn | sklearn/cluster/tests/test_bicluster.py | 226 | 9457 | """Testing for Spectral Biclustering methods"""
import numpy as np
from scipy.sparse import csr_matrix, issparse
from sklearn.grid_search import ParameterGrid
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from... | bsd-3-clause |
TinyOS-Camp/DDEA-DEV | Archive/[14_09_12] DDEA_example_code/bar_chart.py | 5 | 1282 | import numpy as np
import matplotlib.pyplot as plt
import pylab
def plot(data, labels, titles, colors, rotation=270, grid=False, savefig=None, savereport=None):
####################
# Generate plot #
####################
assert len(data) == len(labels) == len(titles)
M = len(data)
N = len(data[0])
ind... | gpl-2.0 |
demianw/dipy | doc/examples/reconst_dki.py | 3 | 11952 | """
=====================================================================
Reconstruction of the diffusion signal with the kurtosis tensor model
=====================================================================
The diffusion kurtosis model is an expansion of the diffusion tensor model
(see :ref:`example_reconst_dti... | bsd-3-clause |
meee1/ardupilot | Tools/LogAnalyzer/tests/TestOptFlow.py | 32 | 14968 | from LogAnalyzer import Test,TestResult
import DataflashLog
from math import sqrt
import numpy as np
import matplotlib.pyplot as plt
class TestFlow(Test):
'''test optical flow sensor scale factor calibration'''
#
# Use the following procedure to log the calibration data. is assumed that the optical flow ... | gpl-3.0 |
hivetech/dna | python/dna/time_utils.py | 1 | 1692 | # -*- coding: utf-8 -*-
# vim:fenc=utf-8
'''
:copyright (c) 2014 Hive Tech, SAS.
:license: Apache 2.0, see LICENSE for more details.
'''
import pandas as pd
import time
import datetime as dt
import pytz
import calendar
import locale
import dateutil.parser
# TODO Handle in-day dates, with hours and minutes
def n... | apache-2.0 |
vitaliykomarov/NEUCOGAR | nest/noradrenaline/nest-2.10.0/topology/examples/test_3d.py | 13 | 2543 | # -*- coding: utf-8 -*-
#
# test_3d.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, or
# (... | gpl-2.0 |
Didou09/tofu | tofu/tests/tests09_tutorials/tuto_plot_custom_emissivity.py | 1 | 2981 | """
Computing a camera image with custom emissivity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This tutorial defines an emissivity that varies in space and computes
the signal received by a camera using this emissivity.
"""
###############################################################################
# We star... | mit |
chenhh/PySPPortfolio | PySPPortfolio/pysp_portfolio/test/test_cvar.py | 1 | 39191 | # -*- coding: utf-8 -*-
"""
Authors: Hung-Hsin Chen <chenhh@par.cse.nsysu.edu.tw>
License: GPL v2
"""
from __future__ import division
from datetime import date
from time import time
import os
import numpy as np
import pandas as pd
import scipy.stats as spstats
from pyomo.environ import *
from PySPPortfolio.pysp_portfo... | gpl-3.0 |
alejob/mdanalysis | package/MDAnalysis/analysis/rms.py | 1 | 26549 | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under th... | gpl-2.0 |
andrewgross/json2parquet | setup.py | 1 | 1079 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from setuptools import setup, find_packages
with open('json2parquet/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
i... | mit |
abhishekkrthakur/scikit-learn | sklearn/utils/validation.py | 2 | 20807 | """Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from ..externals i... | bsd-3-clause |
anntzer/scipy | scipy/integrate/_bvp.py | 16 | 41051 | """Boundary value problem solver."""
from warnings import warn
import numpy as np
from numpy.linalg import pinv
from scipy.sparse import coo_matrix, csc_matrix
from scipy.sparse.linalg import splu
from scipy.optimize import OptimizeResult
EPS = np.finfo(float).eps
def estimate_fun_jac(fun, x, y, p, f0=None):
... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.