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
ellisonbg/altair
altair/utils/core.py
1
10929
""" Utility routines """ import re import warnings import collections from copy import deepcopy import sys import traceback import six import pandas as pd import numpy as np try: from pandas.api.types import infer_dtype except ImportError: # Pandas before 0.20.0 from pandas.lib import infer_dtype from .schem...
bsd-3-clause
IBT-FMI/SAMRI
samri/development.py
1
5858
# -*- coding: utf-8 -*- # Development work, e.g. for higher level functions. # These functions are not intended to work on any machine or pass the tests. # They are early drafts (e.g. of higher level workflows) intended to be shared among select collaborators or multiple machines of one collaborator. # Please don't ed...
gpl-3.0
nelango/ViralityAnalysis
model/lib/nltk/sentiment/util.py
3
30992
# coding: utf-8 # # Natural Language Toolkit: Sentiment Analyzer # # Copyright (C) 2001-2015 NLTK Project # Author: Pierpaolo Pantone <24alsecondo@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ Utility methods for Sentiment Analysis. """ from copy import deepcopy import codecs imp...
mit
ChinaQuants/bokeh
bokeh/tests/test_sources.py
26
3245
from __future__ import absolute_import import unittest from unittest import skipIf import warnings try: import pandas as pd is_pandas = True except ImportError as e: is_pandas = False from bokeh.models.sources import DataSource, ColumnDataSource, ServerDataSource class TestColumnDataSourcs(unittest.Test...
bsd-3-clause
paladin74/neural-network-animation
matplotlib/patches.py
10
142681
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import map, zip import math import matplotlib as mpl import numpy as np import matplotlib.cbook as cbook import matplotlib.artist as artist from matplotlib.a...
mit
glouppe/scikit-learn
examples/text/document_classification_20newsgroups.py
27
10521
""" ====================================================== Classification of text documents using sparse features ====================================================== This is an example showing how scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a scipy.spars...
bsd-3-clause
awni/tensorflow
tensorflow/examples/skflow/text_classification_builtin_rnn_model.py
1
2881
# 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
toobaz/pandas
pandas/tests/window/test_api.py
2
12926
from collections import OrderedDict import warnings from warnings import catch_warnings import numpy as np import pytest import pandas.util._test_decorators as td import pandas as pd from pandas import DataFrame, Index, Series, Timestamp, concat from pandas.core.base import SpecificationError from pandas.tests.windo...
bsd-3-clause
SylvainTakerkart/vobi_one
examples/scripts_vodev_0.4/script0_import_and_parameters_estimation.py
1
10389
# Author: Flavien Garcia <flavien.garcia@free.fr> # Sylvain Takerkart <Sylvain.Takerkart@univ-amu.fr> # License: BSD Style. """ Description ----------- This script processes the oidata functions on some selected blk files or on some raw file already imported. The process is decomposed in 4 or 6 steps : 1. Dat...
gpl-3.0
ShadowTemplate/ScriBa
test.py
1
5074
import re import glob import time from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import linear_kernel # http://stackoverflow.com/questions/12118720/python-tf-idf-cosine-to-find-document-similarity # http://scikit-learn.org/stable/modules/generated/sklearn.feature_extracti...
gpl-2.0
kirangonella/BuildingMachineLearningSystemsWithPython
ch10/large_classification.py
19
3271
# 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 mahotas as mh from glob import glob from sklearn import cr...
mit
smartscheduling/scikit-learn-categorical-tree
sklearn/tests/test_isotonic.py
16
11166
import numpy as np import pickle from sklearn.isotonic import (check_increasing, isotonic_regression, IsotonicRegression) from sklearn.utils.testing import (assert_raises, assert_array_equal, assert_true, assert_false, assert_equal, ...
bsd-3-clause
pchmieli/h2o-3
h2o-py/h2o/estimators/estimator_base.py
1
11755
from ..model.model_base import ModelBase from ..model.autoencoder import H2OAutoEncoderModel from ..model.binomial import H2OBinomialModel from ..model.clustering import H2OClusteringModel from ..model.dim_reduction import H2ODimReductionModel from ..model.multinomial import H2OMultinomialModel from ..model.regression ...
apache-2.0
ningchi/scikit-learn
sklearn/linear_model/tests/test_randomized_l1.py
214
4690
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.linear_model.randomized_l1 i...
bsd-3-clause
jkthompson/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/colors.py
69
31676
""" A module for converting numbers or color arguments to *RGB* or *RGBA* *RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the range 0-1. This module includes functions and classes for color specification conversions, and for mapping numbers to colors in a 1-D array of colors called a colormap. Color...
gpl-3.0
bthirion/scikit-learn
sklearn/neighbors/tests/test_kde.py
26
5518
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 from sklearn.pipeline import make_pipeline from sklearn.dataset...
bsd-3-clause
yuyu2172/image-labelling-tool
examples/ssd/demo.py
1
1243
import argparse import matplotlib.pyplot as plot import yaml import chainer from chainercv.datasets import voc_detection_label_names from chainercv.links import SSD300 from chainercv import utils from chainercv.visualizations import vis_bbox from original_detection_dataset import OriginalDetectionDataset def main(...
mit
Quantipy/quantipy
tests/test_merging.py
1
20330
import unittest import os.path import numpy as np import pandas as pd from pandas.util.testing import assert_frame_equal import test_helper import copy import json from operator import lt, le, eq, ne, ge, gt from pandas.core.index import Index __index_symbol__ = { Index.union: ',', Index.intersection: '&', ...
mit
zorroblue/scikit-learn
sklearn/linear_model/omp.py
13
31718
"""Orthogonal matching pursuit algorithms """ # Author: Vlad Niculae # # License: BSD 3 clause import warnings import numpy as np from scipy import linalg from scipy.linalg.lapack import get_lapack_funcs from .base import LinearModel, _pre_fit from ..base import RegressorMixin from ..utils import as_float_array, ch...
bsd-3-clause
ahoyosid/scikit-learn
examples/classification/plot_classification_probability.py
242
2624
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
BigDataforYou/movie_recommendation_workshop_1
big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/tests/series/test_misc_api.py
1
11674
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import numpy as np import pandas as pd from pandas import Index, Series, DataFrame, date_range from pandas.tseries.index import Timestamp from pandas.compat import range from pandas import compat import pandas.formats.printing as printing from pandas.util.testing impo...
mit
florian-f/sklearn
sklearn/metrics/cluster/tests/test_supervised.py
15
7635
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
shishaochen/TensorFlow-0.8-Win
tensorflow/examples/skflow/digits.py
4
2395
# 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
jayshonzs/ESL
KernelSmoothing/LocalLinearRegression.py
1
1142
''' Created on 2014-6-21 @author: xiajie ''' import numpy as np import SimulateData as sd import matplotlib.pyplot as plt def augment(X): lst = [[1, X[i]] for i in range(len(X))] return np.array(lst) def Epanechnikov(x0, x, lmbda): t = np.abs(x0-x)/lmbda if t > 1: return 0 else: r...
mit
paulsheehan/deeperSpeech
audio_input.py
1
1939
import csv import os import librosa import numpy as np import tensorflow as tf import pandas as pd testOutput = open('data/cluster_test_results.csv', 'w') outputWriter = csv.writer(testOutput, delimiter=',') headers = ["id", "freq_min", "freq_max", "freq_std", "mfcc_power", "mfcc_mean", "mfcc_std", "mfcc_delta_mean",...
mit
rosswhitfield/mantid
qt/python/mantidqt/widgets/plotconfigdialog/axestabwidget/__init__.py
3
2266
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2019 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # T...
gpl-3.0
DhashS/Olin-Complexity-Final-Project
code/stats.py
1
1959
from parsers import TSP from algs import simple_greed import matplotlib.pyplot as plt import seaborn as sns from ggplot import ggplot, aes, geom_point, geom_hline, ggtitle, geom_line import pandas as pd import numpy as np from decorator import decorator import os import time def get_stats(name="", path="../img/", d...
gpl-3.0
bhargav/scikit-learn
examples/cluster/plot_birch_vs_minibatchkmeans.py
333
3694
""" ================================= Compare BIRCH and MiniBatchKMeans ================================= This example compares the timing of Birch (with and without the global clustering step) and MiniBatchKMeans on a synthetic dataset having 100,000 samples and 2 features generated using make_blobs. If ``n_clusters...
bsd-3-clause
ClimbsRocks/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
SummaLabs/DLS
app/backend/core/datasets/dbhelpers.py
1
10266
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'ar' import os import sys import glob import fnmatch import numpy as np import json import pandas as pd from dbutils import calcNumImagesByLabel, getListDirNamesInDir, getListImagesInDirectory, checkFilePath ################################################# clas...
mit
xmnlab/minilab
data_type/array/plot.py
1
1109
# -*- coding: utf-8 -*- """ Visualiza datos en gráficos utilizando la librería google charts """ import matplotlib.pyplot as plt import numpy as np import random from matplotlib.ticker import EngFormatter sample = 2 sensors = [random.sample(xrange(100), sample), random.sample(xrange(100), sample), ...
gpl-3.0
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/pandas/tseries/util.py
7
3244
import warnings from pandas.compat import lrange import numpy as np from pandas.types.common import _ensure_platform_int from pandas.core.frame import DataFrame import pandas.core.nanops as nanops def pivot_annual(series, freq=None): """ Deprecated. Use ``pivot_table`` instead. Group a series by years, ...
gpl-3.0
gwparikh/cvguipy
genetic_compare.py
2
4329
#!/usr/bin/env python import os, sys, subprocess import argparse import subprocess import timeit from multiprocessing import Queue, Lock from configobj import ConfigObj from numpy import loadtxt from numpy.linalg import inv import matplotlib.pyplot as plt import moving from cvguipy import trajstorage, cvgenetic """co...
mit
moonbury/pythonanywhere
github/MasteringMLWithScikit-learn/8365OS_04_Codes/ch42.py
3
1763
import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.cross_validation import train_test_split from sklearn.metrics import precision_score, recall_score, roc_auc_score, auc, confusion_matrix import numpy as np from scipy.sparse i...
gpl-3.0
giorgiop/scikit-learn
sklearn/datasets/samples_generator.py
7
56557
""" Generate samples of synthetic data sets. """ # Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel, # G. Louppe, J. Nothman # License: BSD 3 clause import numbers import array import numpy as np from scipy import linalg import scipy.sparse as sp from ..preprocessing import MultiLabelBin...
bsd-3-clause
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/tseries/holiday.py
9
16176
import warnings from pandas import DateOffset, DatetimeIndex, Series, Timestamp from pandas.compat import add_metaclass from datetime import datetime, timedelta from dateutil.relativedelta import MO, TU, WE, TH, FR, SA, SU # noqa from pandas.tseries.offsets import Easter, Day import numpy as np def next_monday(dt):...
apache-2.0
js850/pele
pele/potentials/test_functions/_beale.py
1
3947
import numpy as np from numpy import exp, sqrt, cos, pi, sin from pele.potentials import BasePotential from pele.systems import BaseSystem def makeplot2d(f, nx=100, xmin=None, xmax=None, zlim=None, show=True): from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.pyplot as pl...
gpl-3.0
flightgong/scikit-learn
sklearn/decomposition/pca.py
1
26496
""" Principal Component Analysis """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause from math import log, sqrt import warnin...
bsd-3-clause
suvam97/zeppelin
python/src/main/resources/bootstrap.py
4
5728
# 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 use ...
apache-2.0
0x0all/scikit-learn
examples/linear_model/plot_ols_3d.py
350
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
pystruct/pystruct
examples/plot_snakes_typed.py
1
7289
""" ============================================== Conditional Interactions on the Snakes Dataset ============================================== This is a variant of plot_snakes.py where we use the NodeTypeEdgeFeatureGraphCRF class instead of EdgeFeatureGraphCRF, despite there is only 1 type of nodes. So this should g...
bsd-2-clause
LeoQuote/ingress-simple-planner
create_plan.py
1
5789
import csv import matplotlib.path as mplPath import numpy as np import json class portal: def __init__(self,name, lat, lon): self.name = name self.lat = float(lat)-40 self.lon = float(lon)-116 def __repr__(self): return '{}'.format(self.name) def __str__(self): ...
mit
yukisakurai/hhana
mva/plotting/classify.py
5
12122
# stdlib imports import os # local imports from . import log from ..variables import VARIABLES from .. import PLOTS_DIR from .draw import draw from statstools.utils import efficiency_cut, significance # matplotlib imports from matplotlib import cm from matplotlib import pyplot as plt from matplotlib.ticker import Ma...
gpl-3.0
rsivapr/scikit-learn
sklearn/qda.py
8
7229
""" Quadratic Discriminant Analysis """ # Author: Matthieu Perrot <matthieu.perrot@gmail.com> # # License: BSD 3 clause import warnings import numpy as np from .base import BaseEstimator, ClassifierMixin from .externals.six.moves import xrange from .utils.fixes import unique from .utils import check_arrays, array2d...
bsd-3-clause
hadim/pygraphml
pygraphml/graph.py
1
6171
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from __future__ import print_function from . import Node from . import Edge from collections import deque class Graph: """ Main class which represent a Graph :param na...
bsd-3-clause
alexlee-gk/visual_dynamics
scripts/plot_algorithm.py
1
8487
import argparse import csv import matplotlib.pyplot as plt import numpy as np import seaborn as sns import yaml from visual_dynamics.utils.iter_util import flatten_tree, unflatten_tree def main(): parser = argparse.ArgumentParser() parser.add_argument('--algorithm_fnames', nargs='+', type=str) parser.ad...
mit
nicolagritti/ACVU_scripts
source/check_piezo_movements.py
1
1793
# -*- coding: utf-8 -*- """ Created on Tue Dec 1 10:31:00 2015 @author: kienle """ import numpy as np import matplotlib.pyplot as plt import pickle from matplotlib import cm from generalFunctions import * from skimage import filters import matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 path = 'X:\\Nicola\\16...
gpl-3.0
jwiggins/scikit-image
doc/examples/features_detection/plot_local_binary_pattern.py
12
6776
""" =============================================== Local Binary Pattern for texture classification =============================================== In this example, we will see how to classify textures based on LBP (Local Binary Pattern). LBP looks at points surrounding a central point and tests whether the surroundin...
bsd-3-clause
lukauskas/scipy
scipy/signal/windows.py
32
53971
"""The suite of window functions.""" from __future__ import division, print_function, absolute_import import warnings import numpy as np from scipy import special, linalg from scipy.fftpack import fft from scipy._lib.six import string_types __all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall', ...
bsd-3-clause
Insight-book/data-science-from-scratch
scratch/recommender_systems.py
2
12803
users_interests = [ ["Hadoop", "Big Data", "HBase", "Java", "Spark", "Storm", "Cassandra"], ["NoSQL", "MongoDB", "Cassandra", "HBase", "Postgres"], ["Python", "scikit-learn", "scipy", "numpy", "statsmodels", "pandas"], ["R", "Python", "statistics", "regression", "probability"], ["machine learning", ...
unlicense
lfairchild/PmagPy
programs/hysteresis_magic2.py
2
13221
#!/usr/bin/env python import sys import matplotlib if matplotlib.get_backend() != "TKAgg": matplotlib.use("TKAgg") import pmagpy.pmagplotlib as pmagplotlib import pmagpy.pmag as pmag def main(): """ NAME hysteresis_magic.py DESCRIPTION calculates hystereis parameters and saves them i...
bsd-3-clause
nicproulx/mne-python
tutorials/plot_background_filtering.py
3
43173
# -*- coding: utf-8 -*- r""" .. _tut_background_filtering: =================================== Background information on filtering =================================== Here we give some background information on filtering in general, and how it is done in MNE-Python in particular. Recommended reading for practical app...
bsd-3-clause
neale/CS-program
434-MachineLearning/final_project/linearClassifier/sklearn/base.py
11
18381
"""Base classes for all estimators.""" # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause import copy import warnings import numpy as np from scipy import sparse from .externals import six from .utils.fixes import signature from .utils.deprecation import deprecated from .exceptions impo...
unlicense
IshankGulati/scikit-learn
sklearn/utils/tests/test_shortest_path.py
303
2841
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
mxjl620/scikit-learn
sklearn/ensemble/tests/test_weight_boosting.py
83
17276
"""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
jaidevd/scikit-learn
examples/ensemble/plot_gradient_boosting_oob.py
82
4768
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
bsd-3-clause
frank-tancf/scikit-learn
examples/decomposition/plot_pca_iris.py
29
1484
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= PCA example with Iris Data-set ========================================================= Principal Component Analysis applied to the Iris dataset. See `here <http://en.wikipedia.org/wiki/Iris_flower_data_set>`_ fo...
bsd-3-clause
xyguo/scikit-learn
sklearn/datasets/lfw.py
31
19544
"""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
jor-/scipy
doc/source/tutorial/examples/optimize_global_1.py
15
1752
import numpy as np import matplotlib.pyplot as plt from scipy import optimize def eggholder(x): return (-(x[1] + 47) * np.sin(np.sqrt(abs(x[0]/2 + (x[1] + 47)))) -x[0] * np.sin(np.sqrt(abs(x[0] - (x[1] + 47))))) bounds = [(-512, 512), (-512, 512)] x = np.arange(-512, 513) y = np.arange(-512, 513) ...
bsd-3-clause
MatteusDeloge/opengrid
opengrid/library/analysis.py
1
1817
# -*- coding: utf-8 -*- """ General analysis functions. Try to write all methods such that they take a dataframe as input and return a dataframe or list of dataframes. """ import numpy as np import pdb import pandas as pd from opengrid.library.misc import * def daily_min(df, starttime=None, endtime=None): """ ...
apache-2.0
qiime2/q2-types
q2_types/plugin_setup.py
1
1462
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2021, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
bsd-3-clause
kaleoyster/ProjectNBI
nbi-datacenterhub/top-level.py
1
7152
""" The script updates new cases to the top level file for the data-center hub """ import pandas as pd import csv import os import numpy as np from collections import OrderedDict from collections import defaultdict import sys __author__ = 'Akshay Kale' __copyright__ = 'GPL' __credits__ = ['Jonathan Monical'] __email__...
gpl-2.0
maxlikely/scikit-learn
sklearn/linear_model/tests/test_ridge.py
5
12759
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.u...
bsd-3-clause
alexmojaki/odo
odo/backends/aws.py
3
9445
from __future__ import print_function, division, absolute_import import os import uuid import zlib import re from contextlib import contextmanager from collections import Iterator from operator import attrgetter import pandas as pd from toolz import memoize, first from .. import (discover, CSV, resource, append, co...
bsd-3-clause
phobson/pygridtools
pygridtools/misc.py
2
13682
from collections import OrderedDict from shapely.geometry import Point, Polygon import numpy import matplotlib.path as mpath import pandas from shapely import geometry import geopandas from pygridgen import csa from pygridtools import validate def make_poly_coords(xarr, yarr, zpnt=None, triangles=False): """ Ma...
bsd-3-clause
ryfeus/lambda-packs
Sklearn_scipy_numpy/source/sklearn/neighbors/graph.py
208
7031
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_...
mit
KarrLab/kinetic_datanator
datanator/util/rna_halflife_util.py
1
6850
from datanator_query_python.query import query_uniprot from datanator.data_source import uniprot_nosql from datanator.util import file_util from datanator_query_python.util import mongo_util from pathlib import Path, PurePath, PurePosixPath import math import pandas as pd class RnaHLUtil(mongo_util.MongoUtil): d...
mit
liulohua/ml_tutorial
linear_regression/plot_error_surface.py
1
1119
import numpy as np import os import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def fun(w, b): # prepare data x_min = -10. x_max = 10. m = 100 x = np.random.uniform(x_min, x_max, m) true_w = 5. true_b = 5. y_noise_sigma = 3. y_ = true_w * x + true_b# + np.random...
apache-2.0
olafhauk/mne-python
mne/viz/tests/test_misc.py
9
10531
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.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> # # License: ...
bsd-3-clause
mathemage/h2o-3
h2o-py/tests/testdir_algos/kmeans/pyunit_iris_h2o_vs_sciKmeans.py
8
1469
from __future__ import print_function from builtins import zip from builtins import range import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils import numpy as np from sklearn.cluster import KMeans from h2o.estimators.kmeans import H2OKMeansEstimator def iris_h2o_vs_sciKmeans(): # Con...
apache-2.0
ceefour/opencog
opencog/python/spatiotemporal/temporal_events/membership_function.py
34
4673
from math import fabs from random import random from scipy.stats.distributions import rv_frozen from spatiotemporal.time_intervals import TimeInterval from spatiotemporal.unix_time import random_time, UnixTime from utility.generic import convert_dict_to_sorted_lists from utility.functions import Function, FunctionPiece...
agpl-3.0
mrocklin/partd
partd/tests/test_pandas.py
2
3727
from __future__ import absolute_import import pytest pytest.importorskip('pandas') # noqa import numpy as np import pandas as pd import pandas.util.testing as tm import os from partd.pandas import PandasColumns, PandasBlocks, serialize, deserialize df1 = pd.DataFrame({'a': [1, 2, 3], 'b': [1.,...
bsd-3-clause
hooram/ownphotos-backend
api/face_clustering.py
1
4573
from api.models import Face from api.models import Person import base64 import pickle import itertools from scipy import linalg from sklearn.decomposition import PCA import numpy as np import matplotlib as mpl from sklearn import cluster from sklearn import mixture from scipy.spatial import distance from sklearn.prep...
mit
yanchen036/tensorflow
tensorflow/contrib/timeseries/examples/lstm.py
24
13826
# 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
terna/SLAPP3
6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/basic2D/display2D.py
1
1838
#display2d.py for the basic2D project import matplotlib.pyplot as plt def checkRunningInIPython(): try: __IPYTHON__ return True except NameError: return False def display2D(agentList, cycle, nCycles, sleep): global IPy, ax, dots, fig, myDisplay # to avoid missing assignment errors...
cc0-1.0
njordsir/Movie-Script-Analysis
Doc2Vec and Classification/doc2vec_model.py
1
9067
# -*- coding: utf-8 -*- """ Created on Sat Sep 17 04:26:02 2016 @author: naman """ import multiprocessing import json from operator import itemgetter import os import gensim, logging from gensim.models.doc2vec import TaggedDocument from gensim.models.doc2vec import LabeledSentence import re import numpy as np loggin...
mit
gregcaporaso/short-read-tax-assignment
tax_credit/eval_framework.py
4
44170
#!/usr/bin/env python # ---------------------------------------------------------------------------- # Copyright (c) 2014--, tax-credit 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
jcmgray/xyzpy
xyzpy/gen/batch.py
1
52861
import os import re import copy import math import time import glob import shutil import pickle import pathlib import warnings import functools import importlib import itertools import numpy as np import xarray as xr from ..utils import _get_fn_name, prod, progbar from .combo_runner import ( _combo_runner, co...
mit
yufeldman/arrow
python/pyarrow/tests/test_feather.py
3
15177
# 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
cybernet14/scikit-learn
sklearn/manifold/tests/test_mds.py
324
1862
import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_raises from sklearn.manifold import mds def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
kaylanb/SkinApp
machine_learn/blob_hog_predict_common_url_set/predict_with_hog.py
1
4118
'''outputs features for HOG machine learning''' from matplotlib import image as mpimg from scipy import sqrt, pi, arctan2, cos, sin, ndimage, fftpack, stats from skimage import exposure, measure, feature from PIL import Image import cStringIO import urllib2 from numpy.random import rand from numpy import ones, zeros, ...
bsd-3-clause
mojoboss/scikit-learn
examples/ensemble/plot_gradient_boosting_oob.py
230
4762
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
bsd-3-clause
rrohan/scikit-learn
examples/svm/plot_svm_kernels.py
329
1971
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= SVM-Kernels ========================================================= Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially useful when the data-points are not linearly sep...
bsd-3-clause
cl4rke/scikit-learn
examples/applications/plot_stock_market.py
227
8284
""" ======================================= 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
QuLogic/cartopy
lib/cartopy/tests/mpl/__init__.py
2
12599
# Copyright Cartopy Contributors # # This file is part of Cartopy and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. import base64 import distutils import os import glob import shutil import warnings import flufl.lock import matplotlib ...
lgpl-3.0
ningchi/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
all-umass/graphs
graphs/construction/incremental.py
1
1809
from __future__ import absolute_import import numpy as np from sklearn.metrics import pairwise_distances from graphs import Graph __all__ = ['incremental_neighbor_graph'] def incremental_neighbor_graph(X, precomputed=False, k=None, epsilon=None, weighting='none'): '''See neighbor_g...
mit
ilyes14/scikit-learn
sklearn/utils/extmath.py
70
21951
""" Extended math utilities. """ # Authors: Gael Varoquaux # Alexandre Gramfort # Alexandre T. Passos # Olivier Grisel # Lars Buitinck # Stefan van der Walt # Kyle Kastner # License: BSD 3 clause from __future__ import division from functools import partial import ...
bsd-3-clause
btgorman/RISE-power-water-ss-1phase
classes_power.py
1
88826
# Copyright 2017 Brandon T. Gorman # 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
SlicerRt/SlicerDebuggingTools
PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/pydev_ipython/qt_for_kernel.py
2
3698
""" Import Qt in a manner suitable for an IPython kernel. This is the import used for the `gui=qt` or `matplotlib=qt` initialization. Import Priority: if Qt4 has been imported anywhere else: use that if matplotlib has been imported and doesn't support v2 (<= 1.0.1): use PyQt4 @v1 Next, ask ETS' ...
bsd-3-clause
chhao91/pysal
pysal/contrib/spint/gravity_stats.py
8
5584
# coding=utf-8 """ Statistics for gravity models References ---------- Fotheringham, A. S. and O'Kelly, M. E. (1989). Spatial Interaction Models: Formulations and Applications. London: Kluwer Academic Publishers. Williams, P. A. and A. S. Fotheringham (1984), The Calibration of Spatial Interaction Models by Maximu...
bsd-3-clause
microsoft/EconML
prototypes/dml_iv/deep_dml_iv.py
1
3996
import numpy as np from sklearn.model_selection import KFold from econml.utilities import hstack from dml_iv import _BaseDMLIV import keras import keras.layers as L from keras.models import Model, clone_model class DeepDMLIV(_BaseDMLIV): """ A child of the _BaseDMLIV class that specifies a deep neu...
mit
fzalkow/scikit-learn
sklearn/qda.py
140
7682
""" Quadratic Discriminant Analysis """ # Author: Matthieu Perrot <matthieu.perrot@gmail.com> # # License: BSD 3 clause import warnings import numpy as np from .base import BaseEstimator, ClassifierMixin from .externals.six.moves import xrange from .utils import check_array, check_X_y from .utils.validation import ...
bsd-3-clause
benschneider/sideprojects1
FFT_filters/corrFiltSim.py
1
2043
# -*- coding: utf-8 -*- """ Created on Fri Nov 06 13:43:48 2015 @author: Ben simulation of correlation calculations and averages with data which includes noise. """ import numpy as np import scipy.signal as signal import matplotlib.pyplot as plt from time import time lags = 25 points = int(1e4) triggers = 1 Noise...
gpl-2.0
salkinium/bachelor
link_analysis/fec_plotter.py
1
13015
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2014, Niklas Hauser # All rights reserved. # # The file is part of my bachelor thesis and is released under the 3-clause BSD # license. See the file `LICENSE` for the full license governing this code. # -------------------------------------------------------...
bsd-2-clause
hlin117/scikit-learn
sklearn/metrics/tests/test_pairwise.py
42
27323
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
classner/barrista
barrista/monitoring.py
1
84399
# -*- coding: utf-8 -*- """Defines several tools for monitoring net activity.""" # pylint: disable=F0401, E1101, too-many-lines, wrong-import-order import logging as _logging import os as _os import subprocess as _subprocess import collections as _collections import numpy as _np # pylint: disable=no-name-in-module from...
mit
kiryx/pagmo
PyGMO/util/_analysis.py
5
169844
from __future__ import print_function as _dummy class analysis: """ This class contains the tools necessary for exploratory analysis of the search, fitness and constraint space of a given problem. Several tests can be conducted on a low-discrepancy sample of the search space or on an existing populat...
gpl-3.0
napjon/moocs_solution
ml-udacity/k_means/k_means_cluster.py
6
2570
#!/usr/bin/python """ skeleton code for k-means clustering mini-project """ import pickle import numpy import matplotlib.pyplot as plt import sys sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit def Draw(pred, features, poi, mark_poi=False, name="image.png", f1_n...
mit
zhyuey/maps
usa_map_general/usa_map.py
1
2854
# -*- coding: utf-8 -*- from __future__ import unicode_literals import csv import sys, os import shapefile import numpy as np import matplotlib as mpl mpl.use('Agg') from matplotlib import cm import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap from matplotlib.patches import Polygon from matplotlib...
mit