repo_name stringlengths 6 67 | path stringlengths 5 185 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 1.02k 962k | license stringclasses 15
values |
|---|---|---|---|---|---|
boada/wmh | mkPlayers.py | 1 | 3484 | import pandas as pd
from glob import glob
from string import capwords
import numpy as np
def levenshtein(source, target):
if len(source) < len(target):
return levenshtein(target, source)
# So now we have len(source) >= len(target).
if len(target) == 0:
return len(source)
# We call tup... | mit |
theakholic/ThinkStats2 | code/survival.py | 65 | 17881 | """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, division
import numpy as np
import pandas
import nsfg
import thinkstats2
impor... | gpl-3.0 |
genialis/resolwe-bio | resolwe_bio/tools/plotcoverage_html.py | 1 | 4102 | #!/usr/bin/env python3
"""Plot amplicon coverage as HTML file with Bokeh."""
import argparse
import os
import pandas as pd
from bokeh import layouts
from bokeh.embed import components
from bokeh.models import (
BoxZoomTool,
HoverTool,
PanTool,
Range1d,
RedoTool,
ResetTool,
SaveTool,
Und... | apache-2.0 |
wlamond/scikit-learn | examples/applications/plot_stock_market.py | 76 | 8522 | """
=======================================
Visualizing the stock market structure
=======================================
This example employs several unsupervised learning techniques to extract
the stock market structure from variations in historical quotes.
The quantity that we use is the daily variation in quote ... | bsd-3-clause |
rexshihaoren/scikit-learn | examples/datasets/plot_random_dataset.py | 348 | 2254 | """
==============================================
Plot randomly generated classification dataset
==============================================
Plot several randomly generated 2D classification datasets.
This example illustrates the :func:`datasets.make_classification`
:func:`datasets.make_blobs` and :func:`datasets.... | bsd-3-clause |
wagnerpeer/gitexplorer | gitexplorer/visualizations/punchcard.py | 1 | 3117 | '''
Created on 28.08.2017
@author: Peer
'''
from collections import defaultdict
import datetime
from itertools import chain
import matplotlib.pyplot as plt
from gitexplorer.basics import GitExplorerBase
def draw_punchcard(infos,
xaxis_range=24,
yaxis_range=7,
... | mit |
TomAugspurger/pandas | pandas/tests/tools/test_to_numeric.py | 1 | 18993 | import decimal
import numpy as np
from numpy import iinfo
import pytest
import pandas as pd
from pandas import DataFrame, Index, Series, to_numeric
import pandas._testing as tm
@pytest.fixture(params=[None, "ignore", "raise", "coerce"])
def errors(request):
return request.param
@pytest.fixture(params=[True, F... | bsd-3-clause |
DLTK/DLTK | examples/applications/IXI_HH_DCGAN/train.py | 1 | 8472 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import argparse
import os
import pandas as pd
import tensorflow as tf
import numpy as np
from dltk.networks.gan.dcgan import dcgan_discriminator_... | apache-2.0 |
NunoEdgarGub1/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 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/sklearn/decomposition/tests/test_fastica.py | 70 | 7808 | """
Test the fastica algorithm.
"""
import itertools
import warnings
import numpy as np
from scipy import stats
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
... | mit |
rbberger/lammps | examples/SPIN/test_problems/validation_damped_exchange/plot_precession.py | 9 | 1111 | #!/usr/bin/env python3
import numpy as np, pylab, tkinter
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from decimal import *
import sys, string, os
argv = sys.argv
if len(argv) != 3:
print("Syntax: ./plot_precession.py res_lammps.dat res_llg.dat")
sys.exit()
lammps_file = sys.argv[1]
llg... | gpl-2.0 |
cbecker/LightGBM | python-package/lightgbm/sklearn.py | 1 | 32365 | # coding: utf-8
# pylint: disable = invalid-name, W0105, C0111, C0301
"""Scikit-Learn Wrapper interface for LightGBM."""
from __future__ import absolute_import
import numpy as np
from .basic import Dataset, LightGBMError
from .compat import (SKLEARN_INSTALLED, LGBMClassifierBase, LGBMDeprecated,
... | mit |
MikkelsCykel/LightweightCrypto | Project2/Code/S113408-DPA.py | 1 | 3720 |
# coding: utf-8
# Project Constants and imports:
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import math
mpl.rc("figure", facecolor="white")
input_data_path = 'inputs8.txt'
input_t_path = 'T8.txt'
nr_observations = np.arange(0, 55, 1)
nr_samples = np.a... | gpl-2.0 |
mjsauvinen/P4UL | pyNetCDF/reynoldsStressNetCdf.py | 1 | 6222 | #!/usr/bin/env python3
import sys
import numpy as np
import argparse
import matplotlib.pyplot as plt
from analysisTools import sensibleIds, groundOffset, quadrantAnalysis
from netcdfTools import read3dDataFromNetCDF, netcdfOutputDataset, \
createNetcdfVariable, netcdfWriteAndClose
from utilities import filesFromList,... | mit |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tests/io/parser/na_values.py | 6 | 10526 | # -*- coding: utf-8 -*-
"""
Tests that NA values are properly handled during
parsing for all of the parsers defined in parsers.py
"""
import numpy as np
from numpy import nan
import pandas.io.parsers as parsers
import pandas.util.testing as tm
from pandas import DataFrame, Index, MultiIndex
from pandas.compat impor... | mit |
droundy/deft | papers/thesis-scheirer/final/smooth_test_V5_plots.py | 1 | 9603 | from __future__ import division
from scipy.optimize import fsolve
from scipy.interpolate import interp1d
from scipy.signal import savgol_filter
import numpy as np
import matplotlib
import pylab as plt
import os
import sys
import RG
import SW
import time
#temp = plt.linspace(0.6,1.28,20)
#temp = np.concatenate((plt.li... | gpl-2.0 |
dsavoiu/kafe2 | examples/011_multifit/03_multifit2.py | 1 | 4626 | """Perform a simultaneous fit to two frequency distributions
(= histograms) with common parameters with kafe2.MultiFit()
This example illustrates another common use-case for multifits,
where the same signal is measured under varying conditions,
e.g. in different detector regions with different resolutions
... | gpl-3.0 |
annahs/atmos_research | WHI_long_term_size_distrs_fresh_emissions-includes_sampled_vol-sep_by_precip.py | 1 | 24872 | import matplotlib.pyplot as plt
import numpy as np
from matplotlib import dates
import os
import pickle
from datetime import datetime
from pprint import pprint
import sys
from datetime import timedelta
import calendar
import math
import copy
timezone = timedelta(hours = 0) #using zero here b/c most files were writte... | mit |
schreiberx/sweet | benchmarks_sphere/paper_jrn_nla_rexi_linear/sph_rexi_linear_paper_gaussian_ts_comparison_earth_scale_cheyenne_performance/postprocessing_output_eta_err_vs_simtime.py | 1 | 3193 | #! /usr/bin/env python3
import sys
import matplotlib.pyplot as plt
import re
from matplotlib.lines import Line2D
#
# First, use
# ./postprocessing.py > postprocessing_output.txt
# to generate the .txt file
#
fig, ax = plt.subplots(figsize=(10,7))
ax.set_xscale("log", nonposx='clip')
ax.set_yscale("log", nonposy=... | mit |
sdpython/cvxpy | examples/expr_trees/1D_convolution.py | 12 | 1453 | #!/usr/bin/env python
from cvxpy import *
import numpy as np
import random
from math import pi, sqrt, exp
def gauss(n=11,sigma=1):
r = range(-int(n/2),int(n/2)+1)
return [1 / (sigma * sqrt(2*pi)) * exp(-float(x)**2/(2*sigma**2)) for x in r]
np.random.seed(5)
random.seed(5)
DENSITY = 0.008
n = 1000
x = Varia... | gpl-3.0 |
MaxHalford/StSICMR-Inference | utests.py | 1 | 1108 | # Verifying the installation
try:
import matplotlib
except ImportError:
print('matplotlib is not installed')
try:
import pandas
except ImportError:
print('pandas is not installed')
try:
import numpy
except ImportError:
print('numpy is not installed')
# Verifying the model
try:
from lib impo... | mit |
ttouchstone/deap | examples/coev/coop_gen.py | 12 | 4886 | # 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 |
jgillis/casadi | experimental/joel/shallow/shallow.py | 1 | 5492 | #
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010 by Joel Andersson, Moritz Diehl, K.U.Leuven. All rights reserved.
#
# CasADi is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Pub... | lgpl-3.0 |
tawsifkhan/scikit-learn | examples/text/document_clustering.py | 230 | 8356 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
plowman/python-mcparseface | models/syntaxnet/tensorflow/tensorflow/examples/skflow/iris_val_based_early_stopping.py | 3 | 2275 | # 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 |
KasperPRasmussen/bokeh | sphinx/source/conf.py | 3 | 8350 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
#
# Bokeh documentation build configuration file, created by
# sphinx-quickstart on Sat Oct 12 23:43:03 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values ... | bsd-3-clause |
akartik80/8thSemProject | RandomForest.py | 1 | 1876 | import pandas as pd
import numpy as np
import re
import csv
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from sklearn.model_selection import cross_val_score
from sklea... | mit |
glennq/scikit-learn | sklearn/datasets/lfw.py | 4 | 19661 | """Loader for the Labeled Faces in the Wild (LFW) dataset
This dataset is a collection of JPEG pictures of famous people collected
over the internet, all details are available on the official website:
http://vis-www.cs.umass.edu/lfw/
Each picture is centered on a single face. The typical task is called
Face Veri... | bsd-3-clause |
matk86/pymatgen | pymatgen/io/abinit/tasks.py | 2 | 172712 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""This module provides functions and classes related to Task objects."""
from __future__ import division, print_function, unicode_literals, absolute_import
import os
import time
import datetime
import shutil
i... | mit |
roofit-dev/parallel-roofit-scripts | profiling/vincemark/analyze_d.py | 1 | 12033 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Patrick Bos
# @Date: 2016-11-16 16:23:55
# @Last Modified by: E. G. Patrick Bos
# @Last Modified time: 2017-06-29 15:46:35
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from pathlib import Path
import itertool... | apache-2.0 |
leggitta/mne-python | mne/viz/tests/test_evoked.py | 2 | 4306 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini <cnangini@gmail.com>
# Mainak Jas <mainak@neuro.hut.fi>
#... | bsd-3-clause |
ashhher3/scikit-learn | sklearn/datasets/tests/test_svmlight_format.py | 28 | 10792 | from bz2 import BZ2File
import gzip
from io import BytesIO
import numpy as np
import os
import shutil
from tempfile import NamedTemporaryFile
from sklearn.externals.six import b
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert... | bsd-3-clause |
fabiolapozyk/IncrementalFCM | Tesi/FCM/old-fcm.py | 2 | 4479 | '''
Created on 07/mag/2014
@author: Fabio
'''
'''
Created on 03/mar/2014
@author:Sonya
'''
import numpy
import matplotlib.pyplot as plt
from numpy.random.mtrand import np
import pylab as pl
import random
from sklearn import datasets
from sklearn.decomposition import PCA
########################... | cc0-1.0 |
NunoEdgarGub1/scikit-learn | examples/manifold/plot_manifold_sphere.py | 258 | 5101 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=============================================
Manifold Learning methods on a severed sphere
=============================================
An application of the different :ref:`manifold` techniques
on a spherical data-set. Here one can see the use of
dimensionality reducti... | bsd-3-clause |
dsullivan7/scikit-learn | sklearn/semi_supervised/tests/test_label_propagation.py | 307 | 1974 | """ test the label propagation module """
import nose
import numpy as np
from sklearn.semi_supervised import label_propagation
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
ESTIMATORS = [
(label_propagation.LabelPropagation, {'kernel': 'rbf'}),
(label_propa... | bsd-3-clause |
SPJ-AI/lesson | training_python/mlp_text.py | 1 | 3129 | # -*- coding: utf-8 -*-
#! /usr/bin/python
import MeCab # TokenizerとしてMeCabを使用
from sklearn.neural_network import MLPClassifier
mecab = MeCab.Tagger("-Ochasen") # MeCabのインスタンス化
f = open('text.tsv') # トレーニングファイルの読み込み
lines = f.readlines()
words = [] # 単語トークン表層一覧を保持するリスト
count = 0
dict = {} # テキスト:カテゴリのペアを保持する辞書
for li... | gpl-3.0 |
lawrencejones/neuro | Exercise_4/neuro/Plotters.py | 1 | 1860 | import matplotlib.pyplot as plt
import numpy as np
def plot_connectivity_matrix(CIJ):
"""
Plots a scatter matrix
"""
x, y = np.where(CIJ == 1)
plt.axis([0, len(CIJ), 0, len(CIJ[0])])
plt.scatter(x, y)
return plt
def plot_module_mean_firing_rate(layer, no_of_modules, resolution=None):
... | gpl-3.0 |
nhuntwalker/astroML | book_figures/chapter2/fig_sort_scaling.py | 3 | 2889 | """
Sort Algorithm Scaling
----------------------
Figure 2.2.
The scaling of the quicksort algorithm. Plotted for comparison are
lines showing O(N) and O(N log N) scaling. The quicksort algorithm falls along
the O(N log N) line, as expected.
"""
# Author: Jake VanderPlas
# License: BSD
# The figure produced by this ... | bsd-2-clause |
CDSFinance/zipline | user_scripts/dma.py | 1 | 1162 | from zipline.api import order_target, record, symbol, history, add_history
def initialize(context):
# Register 2 histories that track daily prices,
# one with a 100 window and one with a 300 day window
add_history(100, '1d', 'price')
add_history(300, '1d', 'price')
context.i = 0
def handle_data... | apache-2.0 |
zooniverse/aggregation | experimental/condor/condorIBCC_3.py | 2 | 5894 | #!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import matplotlib.pyplot as plt
import csv
import sys
import os
import pymongo
import matplotlib.cbook as cbook
import random
import datetime
import bisect
def run_ibcc(t):
with open(base_directory+"/Databases/condor_ibcc_"+t+".py","wb") as f:
... | apache-2.0 |
smdabdoub/phylotoast | bin/PCoA.py | 2 | 9658 | #!/usr/bin/env python
import argparse
from collections import OrderedDict
import itertools
import sys
from phylotoast import util, graph_util as gu
errors = []
try:
from palettable.colorbrewer.qualitative import Set3_12
except ImportError as ie:
errors.append("No module named palettable")
try:
import matplo... | mit |
Sterncat/opticspy | opticspy/mplot3d/proj3d.py | 9 | 7006 | #!/usr/bin/python
# 3dproj.py
#
"""
Various transforms used for by the 3D code
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from six.moves import zip
from matplotlib.collections import LineCollection
from matplotlib.patches import Circle
i... | mit |
plissonf/scikit-learn | examples/cluster/plot_lena_segmentation.py | 271 | 2444 | """
=========================================
Segmenting the picture of Lena in regions
=========================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to break this image into multiple
partly-homogeneous regions.
This procedure (spe... | bsd-3-clause |
fdns/TSDB-benchmarks | presenter/src/main.py | 1 | 5277 | import matplotlib.pyplot as plt
from loader import load
import logging
def graph_cpu_usage_average(data, label, testname, fig=None, index=0):
if fig is None:
fig = plt.figure()
data = data['stats']
plt.figure(fig.number)
plt.title('{}: Tiempo de CPU utilizado promedio Vs Tiempo'.format(testname... | mit |
aaronzink/tensorflow-visual-inspection | models/autoencoder/VariationalAutoencoderRunner.py | 12 | 1653 | import numpy as np
import sklearn.preprocessing as prep
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from autoencoder_models.VariationalAutoencoder import VariationalAutoencoder
mnist = input_data.read_data_sets('MNIST_data', one_hot = True)
def min_max_scale(X_train, X_test)... | apache-2.0 |
kbai/specfem3d | utils/EXTERNAL_CODES_coupled_with_SPECFEM3D/AxiSEM_for_SPECFEM3D/AxiSEM_modif_for_coupling_with_specfem/SOLVER/UTILS/hemispherical_model.py | 3 | 2107 | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
# Define layer boundaries (one more than layers)
layers = [1217.5, 1190., 1160., 1100.]
# Define angles of hemispherical boundaries with a linearly interpolated region in between
angles = [[45., 55.], [50., 60.], [55., 65.]]
vp_in = np.ones((len... | gpl-2.0 |
valexandersaulys/prudential_insurance_kaggle | venv/lib/python2.7/site-packages/sklearn/cluster/tests/test_hierarchical.py | 230 | 19795 | """
Several basic tests for hierarchical clustering procedures
"""
# Authors: Vincent Michel, 2010, Gael Varoquaux 2012,
# Matteo Visconti di Oleggio Castello 2014
# License: BSD 3 clause
from tempfile import mkdtemp
import shutil
from functools import partial
import numpy as np
from scipy import sparse
from... | gpl-2.0 |
LiaoPan/scikit-learn | examples/cluster/plot_color_quantization.py | 297 | 3443 | # -*- coding: utf-8 -*-
"""
==================================
Color Quantization using K-Means
==================================
Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace
(China), reducing the number of colors required to show the image from 96,615
unique colors to 64, while pre... | bsd-3-clause |
shangwuhencc/scikit-learn | sklearn/ensemble/tests/test_gradient_boosting.py | 11 | 39569 | """
Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting).
"""
import warnings
import numpy as np
from itertools import product
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import coo_matrix
from sklearn import datasets
from sklearn.base import clo... | bsd-3-clause |
yunfeilu/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 284 | 3265 | """
===========================================
FeatureHasher and DictVectorizer Comparison
===========================================
Compares FeatureHasher and DictVectorizer by using both to vectorize
text documents.
The example demonstrates syntax and speed only; it doesn't actually do
anything useful with the e... | bsd-3-clause |
amolkahat/pandas | asv_bench/benchmarks/indexing_engines.py | 5 | 2223 | import numpy as np
from pandas._libs import index as libindex
def _get_numeric_engines():
engine_names = [
('Int64Engine', np.int64), ('Int32Engine', np.int32),
('Int16Engine', np.int16), ('Int8Engine', np.int8),
('UInt64Engine', np.uint64), ('UInt32Engine', np.uint32),
('UInt16en... | bsd-3-clause |
mehdidc/py-earth | examples/plot_derivatives.py | 4 | 1177 | """
============================================
Plotting derivatives of simple sine function
============================================
A simple example plotting a fit of the sine function and
the derivatives computed by Earth.
"""
import numpy
import matplotlib.pyplot as plt
from pyearth import Earth
# Create so... | bsd-3-clause |
jefflyn/buddha | src/mlia/Ch10/kMeans.py | 3 | 6280 | '''
Created on Feb 16, 2011
k Means Clustering for Ch10 of Machine Learning in Action
@author: Peter Harrington
'''
from numpy import *
def loadDataSet(fileName): #general function to parse tab -delimited floats
dataMat = [] #assume last column is target value
fr = open(fileName)
for li... | artistic-2.0 |
bikong2/scikit-learn | examples/ensemble/plot_forest_importances.py | 241 | 1761 | """
=========================================
Feature importances with forests of trees
=========================================
This examples shows the use of forests of trees to evaluate the importance of
features on an artificial classification task. The red bars are the feature
importances of the forest, along wi... | bsd-3-clause |
pkruskal/scikit-learn | sklearn/semi_supervised/label_propagation.py | 128 | 15312 | # coding=utf8
"""
Label propagation in the context of this module refers to a set of
semisupervised classification algorithms. In the high level, these algorithms
work by forming a fully-connected graph between all points given and solving
for the steady-state distribution of labels at each point.
These algorithms per... | bsd-3-clause |
eg-zhang/scikit-learn | examples/tree/plot_tree_regression_multioutput.py | 206 | 1800 | """
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... | bsd-3-clause |
lucasb-eyer/pydensecrf | tests/issue26.py | 2 | 2130 |
# coding: utf-8
# In[1]:
# import sys
# sys.path.insert(0,'/home/dlr16/Applications/anaconda2/envs/PyDenseCRF/lib/python2.7/site-packages')
# In[2]:
import numpy as np
import matplotlib.pyplot as plt
# get_ipython().magic(u'matplotlib inline')
plt.rcParams['figure.figsize'] = (20, 20)
plt.rcParams['image.interpol... | mit |
sniemi/EuclidVisibleInstrument | fitting/splineFitting.py | 1 | 4247 | """
Example how to spline B-spline to fake data.
:requires: Python 2.5 or later (no 3.x compatible)
:requires: NumPy
:requires: SciPy
TESTED:
Python 2.5.1
NumPy: 1.4.0.dev7576
SciPy: 0.7.1
matplotlib 1.0.svn
HISTORY:
Created on November 26, 2009
:version: 0.1: test release (SMN)
:author: Sami-Matias Niemi
:contact... | bsd-2-clause |
timothyb0912/pylogit | tests/test_construct_estimator.py | 1 | 26497 | """
Tests for the construct_estimator.py file.
"""
import unittest
from collections import OrderedDict
from copy import deepcopy
import numpy as np
import numpy.testing as npt
import pandas as pd
from scipy.sparse import csr_matrix, eye
import pylogit.asym_logit as asym
import pylogit.conditional_logit as mnl
import ... | bsd-3-clause |
nomadcube/scikit-learn | sklearn/tree/tests/test_tree.py | 72 | 47440 | """
Testing for the tree module (sklearn.tree).
"""
import pickle
from functools import partial
from itertools import product
import platform
import numpy as np
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import coo_matrix
from sklearn.random_projection import sparse_rand... | bsd-3-clause |
trungnt13/scikit-learn | sklearn/cluster/birch.py | 207 | 22706 | # 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 |
tri-state-epscor/wcwave_adaptors | vwpy/isnobal.py | 2 | 50849 | """
Tools for working with IPW binary data and running the iSNOBAL model.
"""
#
# Copyright (c) 2014, Matthew Turner (maturner01.gmail.com)
#
# For the Tri-state EPSCoR Track II WC-WAVE Project
#
# Acknowledgements to Robert Lew for inspiration in the design of the IPW
# class (see https://github.com/rogerlew/RL_GIS_S... | bsd-2-clause |
grehx/spark-tk | regression-tests/sparktkregtests/testcases/frames/unflatten_test.py | 1 | 6554 | # 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 |
oemof/demandlib | demandlib/examples/power_demand_example.py | 1 | 3770 | # -*- coding: utf-8 -*-
"""
Creating power demand profiles using bdew profiles.
Installation requirements
-------------------------
This example requires at least version v0.1.4 of the oemof demandlib. Install
by:
pip install 'demandlib>=0.1.4,<0.2'
Optional:
pip install matplotlib
SPDX-FileCopyrightText: Bir... | mit |
zuku1985/scikit-learn | sklearn/model_selection/tests/test_split.py | 12 | 47658 | """Test the split module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix, csc_matrix, csr_matrix
from scipy import stats
from scipy.misc import comb
from itertools import combinations
from itertools import combinations_with_replacement
from sklearn.utils.testi... | bsd-3-clause |
huzq/scikit-learn | sklearn/tests/test_common.py | 3 | 7611 | """
General tests for all estimators in sklearn.
"""
# Authors: Andreas Mueller <amueller@ais.uni-bonn.de>
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
import os
import warnings
import sys
import re
import pkgutil
from inspect import isgenerator
from functools import partial
import... | bsd-3-clause |
PapaCharlie/SteamyReviews | app/models/game.py | 1 | 18549 | from __future__ import print_function, division
import csv
import base64
import json
import logging
import numpy as np
import os
import requests
import re
import sys
import time
from . import Review
from app import app
from app.dynamodb import db, utils
from app.utils import data_file, mallet_file
from bs4 import Bea... | mit |
MadManRises/Madgine | shared/bullet3-2.89/examples/pybullet/examples/projective_texture.py | 2 | 1415 | import pybullet as p
from time import sleep
import matplotlib.pyplot as plt
import numpy as np
physicsClient = p.connect(p.GUI)
p.setGravity(0, 0, 0)
bearStartPos1 = [-3.3, 0, 0]
bearStartOrientation1 = p.getQuaternionFromEuler([0, 0, 0])
bearId1 = p.loadURDF("plane.urdf", bearStartPos1, bearStartOrientation1)
bearSt... | mit |
lin-credible/scikit-learn | benchmarks/bench_sparsify.py | 323 | 3372 | """
Benchmark SGD prediction time with dense/sparse coefficients.
Invoke with
-----------
$ kernprof.py -l sparsity_benchmark.py
$ python -m line_profiler sparsity_benchmark.py.lprof
Typical output
--------------
input data sparsity: 0.050000
true coef sparsity: 0.000100
test data sparsity: 0.027400
model sparsity:... | bsd-3-clause |
aparna29/Implementation-of-Random-Exponential-Marking-REM-in-ns-3 | src/flow-monitor/examples/wifi-olsr-flowmon.py | 59 | 7427 | # -*- Mode: Python; -*-
# Copyright (c) 2009 INESC Porto
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
#... | gpl-2.0 |
pianomania/scikit-learn | sklearn/tests/test_dummy.py | 186 | 17778 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from sklearn.base import clone
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.testing import assert_almost_eq... | bsd-3-clause |
trachelr/mne-python | mne/decoding/ems.py | 16 | 4347 | # Author: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
from ..utils import logger, verbose
from ..fixes import Counter
from ..parallel import parallel_func
from .. import pick_types, pick_info
@verbose... | bsd-3-clause |
hdmetor/scikit-learn | sklearn/linear_model/tests/test_perceptron.py | 378 | 1815 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_raises
from sklearn.utils import check_random_state
from sklearn.datasets import load_iris
from sklearn.linear_model import Pe... | bsd-3-clause |
huongttlan/statsmodels | statsmodels/sandbox/pca.py | 33 | 7098 | #Copyright (c) 2008 Erik Tollerud (etolleru@uci.edu)
from statsmodels.compat.python import zip
import numpy as np
from math import pi
class Pca(object):
"""
A basic class for Principal Component Analysis (PCA).
p is the number of dimensions, while N is the number of data points
"""
_colors=('r','... | bsd-3-clause |
mjirik/teigen | teigen/tgmain.py | 1 | 44348 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © %YEAR% <>
#
# Distributed under terms of the %LICENSE% license.
import logging
logger = logging.getLogger(__name__)
import logging.handlers
import argparse
# import begin
import sys
import os
import os.path as op
import inspect
import num... | apache-2.0 |
madmouser1/aubio | python/demos/demo_waveform_plot.py | 10 | 2099 | #! /usr/bin/env python
import sys
from aubio import pvoc, source
from numpy import zeros, hstack
def get_waveform_plot(filename, samplerate = 0, block_size = 4096, ax = None, downsample = 2**4):
import matplotlib.pyplot as plt
if not ax:
fig = plt.figure()
ax = fig.add_subplot(111)
hop_s =... | gpl-3.0 |
elingg/tensorflow | tensorflow/contrib/learn/python/learn/tests/dataframe/dataframe_test.py | 18 | 3978 | # 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 |
nansencenter/nansat | nansat/tests/test_nansat.py | 1 | 34081 | # ------------------------------------------------------------------------------
# Name: test_nansat.py
# Purpose: Test the Nansat class
#
# Author: Morten Wergeland Hansen, Asuka Yamakawa, Anton Korosov
#
# Created: 18.06.2014
# Last modified:24.08.2017 14:00
# Copyright: (c) NERSC
# Licence... | gpl-3.0 |
dhyeon/ingredient2vec | src/Ingredient2Vec.py | 1 | 6814 | # import libraries
import gensim
import random
import pandas as pd
import numpy as np
from itertools import combinations
# import implemented python files
import Config
from utils import DataLoader, GensimModels, DataPlotter
class Ingredient2Vec:
def __init__(self):
print "\n\n...Ingredient2Vec initialized"
def ... | apache-2.0 |
uglyboxer/linear_neuron | net-p3/lib/python3.5/site-packages/sklearn/metrics/metrics.py | 233 | 1262 | import warnings
warnings.warn("sklearn.metrics.metrics is deprecated and will be removed in "
"0.18. Please import from sklearn.metrics",
DeprecationWarning)
from .ranking import auc
from .ranking import average_precision_score
from .ranking import label_ranking_average_precision_score
fro... | mit |
jakirkham/bokeh | sphinx/source/conf.py | 3 | 9540 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os.path import abspath, dirname, join
#
# Bokeh documentation build configuration file, created by
# sphinx-quickstart on Sat Oct 12 23:43:03 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not a... | bsd-3-clause |
calum-chamberlain/EQcorrscan | eqcorrscan/doc/conf.py | 2 | 7509 | # -*- coding: utf-8 -*-
#
# EQcorrscan documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 23 21:20:41 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... | gpl-3.0 |
chatcannon/scipy | scipy/special/add_newdocs.py | 4 | 133813 | # Docstrings for generated ufuncs
#
# The syntax is designed to look like the function add_newdoc is being
# called from numpy.lib, but in this file add_newdoc puts the
# docstrings in a dictionary. This dictionary is used in
# generate_ufuncs.py to generate the docstrings for the ufuncs in
# scipy.special at the C lev... | bsd-3-clause |
tridao/cvxpy | examples/relax_and_round.py | 12 | 6062 | # Relax and round example for talk.
from __future__ import division
from cvxpy import *
import numpy
# def bool_vars(prob):
# return [var for var in prob.variables() if var.boolean]
def cvx_relax(prob):
new_constr = []
for var in prob.variables():
if getattr(var, 'boolean', False):
new... | gpl-3.0 |
dsm054/pandas | pandas/tests/extension/base/getitem.py | 4 | 8062 | import numpy as np
import pytest
import pandas as pd
from .base import BaseExtensionTests
class BaseGetitemTests(BaseExtensionTests):
"""Tests for ExtensionArray.__getitem__."""
def test_iloc_series(self, data):
ser = pd.Series(data)
result = ser.iloc[:4]
expected = pd.Series(data[:... | bsd-3-clause |
terkkila/scikit-learn | examples/plot_multilabel.py | 87 | 4279 | # Authors: Vlad Niculae, Mathieu Blondel
# License: BSD 3 clause
"""
=========================
Multilabel classification
=========================
This example simulates a multi-label document classification problem. The
dataset is generated randomly based on the following process:
- pick the number of labels: n ... | bsd-3-clause |
nelango/ViralityAnalysis | model/lib/pandas/computation/pytables.py | 9 | 20208 | """ manage PyTables query interface via Expressions """
import ast
import time
import warnings
from functools import partial
from datetime import datetime, timedelta
import numpy as np
import pandas as pd
from pandas.compat import u, string_types, PY3, DeepChainMap
from pandas.core.base import StringMixin
import panda... | mit |
openego/eDisGo | edisgo/data/import_data.py | 1 | 89664 | from ..grid.components import Load, Generator, BranchTee, MVStation, Line, \
Transformer, LVStation, GeneratorFluctuating
from ..grid.grids import MVGrid, LVGrid
from ..grid.connect import connect_mv_generators, connect_lv_generators
from ..grid.tools import select_cable, position_switch_disconnectors
from ..tools.... | agpl-3.0 |
rs2/pandas | pandas/tests/io/parser/conftest.py | 1 | 2798 | import os
from typing import List, Optional
import pytest
from pandas import read_csv, read_table
class BaseParser:
engine: Optional[str] = None
low_memory = True
float_precision_choices: List[Optional[str]] = []
def update_kwargs(self, kwargs):
kwargs = kwargs.copy()
kwargs.update(... | bsd-3-clause |
fsxfreak/nlp-work | src/train_map.py | 1 | 6406 | import tensorflow as tf
import numpy as np
import pandas as pd
from gensim.models.keyedvectors import KeyedVectors
import time, math, random, string
print(random.__file__)
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
pri... | mit |
chreman/visualizations | trending/trending.py | 2 | 7867 | # main.py
import numpy as np
import pandas as pd
from bokeh.layouts import column, row
from bokeh.plotting import Figure, show
from bokeh.embed import standalone_html_page_for_models
from bokeh.models import ColumnDataSource, HoverTool, HBox, VBox
from bokeh.models.widgets import Slider, Select, TextInput, RadioGroup... | mit |
LFPy/LFPy | examples/bioRxiv281717/figure_6.py | 1 | 7293 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''plotting script for figure 6 in manuscript preprint on output of
example_parallel_network.py
Copyright (C) 2018 Computational Neuroscience Group, NMBU.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public Lic... | gpl-3.0 |
scikit-learn-contrib/forest-confidence-interval | forestci/version.py | 2 | 2065 | # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 0
_version_minor = 5
_version_micro = '' # use '' for first of series, number for 1 and above
_version_extra = 'dev'
# _version_extra = '' # Uncomment this for full releases
# Construct full version string from these.
_ver... | mit |
YinongLong/scikit-learn | sklearn/datasets/tests/test_svmlight_format.py | 53 | 13398 | from bz2 import BZ2File
import gzip
from io import BytesIO
import numpy as np
import scipy.sparse as sp
import os
import shutil
from tempfile import NamedTemporaryFile
from sklearn.externals.six import b
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.u... | bsd-3-clause |
andrey-alekov/backtesting_eventbased | model/portfolio.py | 1 | 1158 | import datetime
import numpy as np
import pandas as od
import Queue
from abc import ABCMeta, abstractmethod
from math import floor
from event import FillEvent, OrderEvent
class Limit(object):
def __init__(self, size):
self.size = size
def set_limit(self, newlimit):
if newlimit>0:
... | mit |
josenavas/QiiTa | qiita_db/test/test_processing_job.py | 1 | 45880 | # -----------------------------------------------------------------------------
# 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 |
gajduk/greedy-tsp | optimal_greedy_error.py | 1 | 1789 | import random
import matplotlib.pyplot as plt
from core import greedy,optimal
def reproduce_greedy_with_error():
size = [1000.0,1000.0]
start = [e/2 for e in size]
n_diffs = []
repeats = 1000
n = 10
filename = "correct_res_batch_2_"+str(n)+"_"+str(repeats)+".txt"
with open(filename,"w") as f:
... | mit |
alshedivat/tensorflow | tensorflow/examples/learn/text_classification_character_rnn.py | 38 | 4036 | # 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 |
kjung/scikit-learn | examples/applications/plot_stock_market.py | 76 | 8522 | """
=======================================
Visualizing the stock market structure
=======================================
This example employs several unsupervised learning techniques to extract
the stock market structure from variations in historical quotes.
The quantity that we use is the daily variation in quote ... | bsd-3-clause |
MartinSavc/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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.