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
itdxer/neupy
tests/algorithms/memory/test_cmac.py
1
2806
import numpy as np from sklearn import metrics from neupy import algorithms from base import BaseTestCase class CMACTestCase(BaseTestCase): def test_cmac(self): X_train = np.reshape(np.linspace(0, 2 * np.pi, 100), (100, 1)) X_train_before = X_train.copy() X_test = np.reshape(np.linspace(...
mit
macks22/scikit-learn
sklearn/utils/fixes.py
133
12882
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # ...
bsd-3-clause
heli522/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
240
6055
"""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, assert_greater, ...
bsd-3-clause
yl565/statsmodels
statsmodels/base/wrapper.py
6
4402
import inspect import functools import numpy as np from statsmodels.compat.python import get_function_name, iteritems, getargspec class ResultsWrapper(object): """ Class which wraps a statsmodels estimation Results class and steps in to reattach metadata to results (if available) """ _wrap_attrs =...
bsd-3-clause
tttor/csipb-jamu-prj
predictor/connectivity/classifier/kronrls/devel_parallel.py
1
2602
# devel.py import sys import time import numpy as np import matplotlib.pyplot as plt from kronrls import KronRLS from sklearn.cross_validation import KFold from sklearn.cross_validation import StratifiedKFold from sklearn.metrics import precision_recall_curve from sklearn.metrics import average_precision_score from sco...
mit
zasdfgbnm/tensorflow
tensorflow/contrib/distributions/python/ops/mixture.py
8
20696
# 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
gfyoung/pandas
pandas/tests/arithmetic/test_timedelta64.py
2
79397
# Arithmetic tests for DataFrame/Series/Index/Array classes that should # behave identically. from datetime import datetime, timedelta import numpy as np import pytest from pandas.errors import OutOfBoundsDatetime, PerformanceWarning import pandas as pd from pandas import ( DataFrame, DatetimeIndex, NaT,...
bsd-3-clause
saketkc/statsmodels
statsmodels/datasets/fertility/data.py
26
2511
#! /usr/bin/env python """World Bank Fertility Data.""" __docformat__ = 'restructuredtext' COPYRIGHT = """This data is distributed according to the World Bank terms of use. See SOURCE.""" TITLE = """World Bank Fertility Data""" SOURCE = """ This data has been acquired from The World Bank: Fertility rat...
bsd-3-clause
zkbt/skyofstars
skyofstars/catalog.py
1
3327
import matplotlib.pyplot as plt import numpy as np import astropy.coordinates as coord import astropy.units as u class Catalog: ''' This defines a Catalog object, which can be plotted or written out into a variety of formats. ''' def __init__(self, coordinates, name="skyofstars", apparentmagnitud...
mit
zaxliu/learning-spark
src/python/IntersectByKey.py
42
1280
""" >>> from pyspark.context import SparkContext >>> sc = SparkContext('local', 'test') >>> input = [("coffee", 1), ("pandas", 2), ("coffee", 3), ("very", 4)] >>> rdd1 = sc.parallelize(input) >>> rdd2 = sc.parallelize([("pandas", 20)]) >>> intserectByKey(rdd1, rdd2).collect() [('pandas', 2), ('pandas', 20)] """ import...
mit
JVillella/tensorflow
tensorflow/tools/dist_test/python/census_widendeep.py
42
11900
# 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
rajat1994/scikit-learn
examples/svm/plot_svm_anova.py
250
2000
""" ================================================= SVM-Anova: SVM with univariate feature selection ================================================= This example shows how to perform univariate feature before running a SVC (support vector classifier) to improve the classification scores. """ print(__doc__) import...
bsd-3-clause
yungyuc/solvcon
sandbox/gas/tube/compare-fixed-location.py
2
5563
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # Copyright (c) 2017, Taihsiang Ho <tai271828@gmail.com> # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # - Redistributions of source code must...
bsd-3-clause
liyu1990/sklearn
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
pism/pism
examples/std-greenland/hydro/showPvsW.py
1
6200
#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt import sys import argparse try: from netCDF4 import Dataset as NC except: print("netCDF4 is not installed!") sys.exit(1) parser = argparse.ArgumentParser(description='show scatter plot P versus W from a PISM run') parser.add_argu...
gpl-3.0
louispotok/pandas
pandas/tests/series/indexing/test_alter_index.py
1
16335
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import pytest from datetime import datetime import pandas as pd import numpy as np from numpy import nan from pandas import compat from pandas import (Series, date_range, isna, Categorical) from pandas.compat import lrange, range from pandas.util.testing import (a...
bsd-3-clause
ndiamant/arboreum
fast_arboreum/arboreum.py
1
4965
from collections import namedtuple from scipy.misc import imsave import numpy as np import random import matplotlib.pyplot as plt import gif_writer import greenhouse ITERS = 100 WIDTH = 201 HEIGHT = 100 NUM_PLANTS = 50 IGNORE_LEAVES = False SAVE_BOARD = True board = np.zeros((HEIGHT, WIDTH), dtype=np.int16) # only re...
mit
GuessWhoSamFoo/pandas
pandas/tests/frame/test_sorting.py
1
25891
# -*- coding: utf-8 -*- from __future__ import print_function import random import numpy as np import pytest from pandas.compat import lrange import pandas as pd from pandas import ( Categorical, DataFrame, IntervalIndex, MultiIndex, NaT, Series, Timestamp, date_range) from pandas.api.types import Categori...
bsd-3-clause
abelcarreras/cubesym
cubesymapi/__init__.py
1
24437
from scipy.interpolate import RegularGridInterpolator from scipy import interpolate, optimize, integrate #import multiprocessing as mp import matplotlib.pyplot as plt import numpy as np import cubesymapi.iofile import cubesymapi.rotations def z_slides(x, y, z, function): return function([x, y, z]) def z_slides_...
mit
keit0222/force-plate-analizer
openForce/synchronize.py
1
5289
# coding : utf-8 import force_analyzer as fa import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.cm as cm from coordinate_transform import * # visualize from mpl_toolkits.mplot3d import Axes3D # check whether file exist or not import os import glob # serialize and de-serialize l...
mit
b-cuts/airflow
airflow/www/app.py
2
69417
from __future__ import print_function from __future__ import division from builtins import str from past.utils import old_div import copy from datetime import datetime, timedelta import dateutil.parser from functools import wraps import inspect import json import logging import os import socket import sys import time ...
apache-2.0
saketkc/statsmodels
examples/python/regression_diagnostics.py
28
2876
## Regression diagnostics # This example file shows how to use a few of the ``statsmodels`` regression diagnostic tests in a real-life context. You can learn about more tests and find out more information abou the tests here on the [Regression Diagnostics page.](http://statsmodels.sourceforge.net/stable/diagnostic.ht...
bsd-3-clause
haphaeu/yoshimi
fall_factor.py
1
3916
# -*- coding: utf-8 -*- """ Fall Factor Impact loads on rock climbing gear. Force = sqrt(2 * m * g * EA * h/Lo) where: m: mass of the falling object g: gravity EA: stiffness of the rope/sling h: height of the fall Lo: length of rope/sling absorbing the impact load Note that a fall factor can b...
lgpl-3.0
samuel1208/scikit-learn
examples/semi_supervised/plot_label_propagation_digits_active_learning.py
294
3417
""" ======================================== Label Propagation digits active learning ======================================== Demonstrates an active learning technique to learn handwritten digits using label propagation. We start by training a label propagation model with only 10 labeled points, then we select the t...
bsd-3-clause
Ninad998/FinalYearProject
PythonScripts/DatabaseQuery.py
3
4825
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function import nltk.tokenize import psycopg2 import pandas as pd import sys, re def clean_str(string): """ Tokenization/string cleaning for all datasets Every dataset is lower cased Original taken from https://github.com/yoonkim/CN...
mit
SepehrMN/nest-simulator
pynest/examples/hh_psc_alpha.py
7
2134
# -*- coding: utf-8 -*- # # hh_psc_alpha.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, o...
gpl-2.0
annahs/atmos_research
WHI_long_term_v2_GC_V10_vs_alt_by_cluster.py
1
8922
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 mysql.connector from pyhdf.SD import SD, SDC, SDS #fire times timezone = timedelta(hours = -...
mit
wreckJ/intellij-community
python/helpers/pydev/pydevd.py
9
99805
#IMPORTANT: pydevd_constants must be the 1st thing defined because it'll keep a reference to the original sys._getframe from __future__ import nested_scopes # Jython 2.1 support import pydev_monkey_qt from pydevd_utils import save_main_module import pydevd_utils pydev_monkey_qt.patch_qt() import traceback from pyde...
apache-2.0
istellartech/OpenGoddard
examples/05_Goddard_1knot.py
1
6584
# -*- coding: utf-8 -*- # Copyright 2017 Interstellar Technologies Inc. All Rights Reserved. from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from OpenGoddard.optimize import Problem, Guess, Condition, Dynamics class Rocket: g0 = 1.0 # Gravity at surface [-] def __in...
mit
ratschlab/ASP
examples/undocumented/python_modular/graphical/interactive_clustering_demo.py
1
11542
""" Shogun demo, based on PyQT Demo by Eli Bendersky Christian Widmer Soeren Sonnenburg License: GPLv3 """ import numpy import sys, os, csv from PyQt4.QtCore import * from PyQt4.QtGui import * import matplotlib from matplotlib import mpl from matplotlib.colorbar import make_axes, Colorbar from matplotlib.backends.bac...
gpl-2.0
ilyes14/scikit-learn
sklearn/manifold/t_sne.py
52
34602
# Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de> # Author: Christopher Moody <chrisemoody@gmail.com> # Author: Nick Travers <nickt@squareup.com> # License: BSD 3 clause (C) 2014 # This is the exact and Barnes-Hut t-SNE implementation. There are other # modifications of the algorithm: # * Fast Optimi...
bsd-3-clause
mmadsen/axelrod-ct
madsenlab/axelrod/population/base_population_classes.py
1
8925
#!/usr/bin/env python # Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org> # # This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details. """ Description here """ import logging as log import networkx as nx import madsenlab.axelrod.utils.configuration ...
apache-2.0
dhimmel/networkx
examples/drawing/labels_and_colors.py
44
1330
#!/usr/bin/env python """ Draw a graph with matplotlib, color by degree. You must have matplotlib for this to work. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" import matplotlib.pyplot as plt import networkx as nx G=nx.cubical_graph() pos=nx.spring_layout(G) # positions for all nodes # nodes nx.draw...
bsd-3-clause
qifeigit/scikit-learn
examples/model_selection/plot_confusion_matrix.py
244
2496
""" ================ Confusion matrix ================ Example of confusion matrix usage to evaluate the quality of the output of a classifier on the iris data set. The diagonal elements represent the number of points for which the predicted label is equal to the true label, while off-diagonal elements are those that ...
bsd-3-clause
choldgraf/ecogtools
ecogtools/viz.py
1
14763
"""Convenience functions for plotting.""" import numpy as np import matplotlib.pyplot as plt from matplotlib.transforms import Affine2D import mpl_toolkits.axisartist.floating_axes as floating_axes from matplotlib.collections import PathCollection from matplotlib.patches import Rectangle from matplotlib.colors import...
bsd-2-clause
gfyoung/pandas
pandas/core/internals/managers.py
1
62193
from __future__ import annotations from collections import defaultdict import itertools from typing import ( Any, Callable, DefaultDict, Dict, Hashable, List, Optional, Sequence, Tuple, TypeVar, Union, ) import warnings import numpy as np from pandas._libs import internals...
bsd-3-clause
466152112/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
xubenben/scikit-learn
sklearn/covariance/__init__.py
389
1157
""" The :mod:`sklearn.covariance` module includes methods and algorithms to robustly estimate the covariance of features given a set of points. The precision matrix defined as the inverse of the covariance is also estimated. Covariance estimation is closely related to the theory of Gaussian Graphical Models. """ from ...
bsd-3-clause
ville-k/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py
71
12923
# 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
bearishtrader/trading-with-python
cookbook/workingWithDatesAndTime.py
77
1551
# -*- coding: utf-8 -*- """ Created on Sun Oct 16 17:45:02 2011 @author: jev """ import time import datetime as dt from pandas import * from pandas.core import datetools # basic functions print 'Epoch start: %s' % time.asctime(time.gmtime(0)) print 'Seconds from epoch: %.2f' % time.time() t...
bsd-3-clause
anthonycorbacho/incubator-zeppelin
python/src/main/resources/grpc/python/ipython_client.py
27
1457
# 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
wanggang3333/scikit-learn
examples/svm/plot_weighted_samples.py
188
1943
""" ===================== SVM: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. The sample weighting rescales the C parameter, which means that the classifier puts more emphasis on getting these points right. The effect might ...
bsd-3-clause
artmusic0/theano-learning.part03
Layer_Changes/LayerChange_release_v2/cnn.py
1
8987
import os import sys, getopt import time import numpy import theano import cPickle import theano.tensor as T from sklearn import preprocessing from logistic_sgd import LogisticRegression from theano.tensor.signal import downsample from theano.tensor.nnet import conv def ReLU(x): y = T.maximum(0.0, x) return (y...
gpl-3.0
lbishal/scikit-learn
examples/gaussian_process/plot_gpr_prior_posterior.py
104
2878
""" ========================================================================== Illustration of prior and posterior Gaussian process for different kernels ========================================================================== This example illustrates the prior and posterior of a GPR with different kernels. Mean, st...
bsd-3-clause
ChanderG/scikit-learn
examples/model_selection/grid_search_text_feature_extraction.py
253
4158
""" ========================================================== Sample pipeline for text feature extraction and evaluation ========================================================== The dataset used in this example is the 20 newsgroups dataset which will be automatically downloaded and then cached and reused for the do...
bsd-3-clause
Eric89GXL/mne-python
mne/time_frequency/tests/test_tfr.py
2
32209
from itertools import product import datetime import os.path as op import numpy as np from numpy.testing import (assert_array_equal, assert_equal, assert_allclose) import pytest import matplotlib.pyplot as plt import mne from mne import (Epochs, read_events, pick_types, create_info, EpochsArray, Info...
bsd-3-clause
ds283/splinter
python/examples/bspline_multivariate.py
2
2557
# This file is part of the SPLINTER library. # Copyright (C) 2012 Bjarne Grimstad (bjarne.grimstad@gmail.com). # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Add t...
mpl-2.0
Weihonghao/ECM
Vpy34/lib/python3.5/site-packages/numpy/lib/twodim_base.py
34
25580
""" Basic functions for manipulating 2d arrays """ from __future__ import division, absolute_import, print_function from numpy.core.numeric import ( absolute, asanyarray, arange, zeros, greater_equal, multiply, ones, asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal, ) from numpy.c...
agpl-3.0
cython-testbed/pandas
pandas/tests/arithmetic/conftest.py
2
5332
# -*- coding: utf-8 -*- import pytest import numpy as np import pandas as pd from pandas.compat import long @pytest.fixture(params=[1, np.array(1, dtype=np.int64)]) def one(request): # zero-dim integer array behaves like an integer return request.param zeros = [box_cls([0] * 5, dtype=dtype) for b...
bsd-3-clause
pv/scikit-learn
examples/decomposition/plot_sparse_coding.py
247
3846
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
RPGOne/scikit-learn
sklearn/cluster/tests/test_mean_shift.py
48
3653
""" Testing for mean shift clustering methods """ import numpy as np import warnings from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import asser...
bsd-3-clause
GeographicaGS/daynight2geojson
daynight2geojson/daynight2geojson.py
2
3599
# -*- coding: utf-8 -*- # # Author: Cayetano Benavent, 2015. # https://github.com/GeographicaGS/daynight2geojson # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the ...
gpl-2.0
johnmgregoire/PythonCompositionPlots
quaternary_ternary_faces_demo3.py
1
3340
import matplotlib.cm as cm import numpy, sys import pylab import operator, copy, os from PyQt4.QtCore import * from PyQt4.QtGui import * from quaternary_ternary_faces import ternaryfaces from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas try: from matplotlib.backends.backend_qt4agg imp...
bsd-3-clause
Erotemic/vtool
vtool_ibeis/clustering2.py
1
30955
# -*- coding: utf-8 -*- # LICENCE """ TODO: Does HDBSCAN work on 128 dim vectors? http://nbviewer.jupyter.org/github/lmcinnes/hdbscan/blob/master/notebooks/Comparing%20Clustering%20Algorithms.ipynb """ from __future__ import absolute_import, division, print_function, unicode_literals from six.moves import zip, ...
apache-2.0
stggh/PyAbel
examples/example_hansenlaw.py
2
3117
# -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import abel import matplotlib.pylab as plt import bz2 # Hansen and Law inverse Abel transform of velocity-map imaged electrons # from O2- photodetachement at 454 nm....
mit
haudren/scipy
scipy/signal/fir_filter_design.py
23
28336
# -*- coding: utf-8 -*- """Functions for FIR filter design.""" from __future__ import division, print_function, absolute_import from math import ceil, log import numpy as np from numpy.fft import irfft from scipy.special import sinc from scipy.linalg import toeplitz, hankel, pinv from . import sigtools __all__ = ['ka...
bsd-3-clause
wanggang3333/scikit-learn
sklearn/metrics/regression.py
175
16953
"""Metrics to assess performance on regression task Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Ma...
bsd-3-clause
ohinai/pas
pas/buckley_leverett.py
1
11928
""" Module for solving and visualizing the Buckley-Leverett solution for two-phase flow problems. """ import numpy as np from scipy import interpolate import matplotlib.pyplot as plt from matplotlib.patches import Polygon class BuckleyLeverett(): """ Solves the two-phase flow problem using the Buckley-Leverett ...
bsd-3-clause
nsalomonis/AltAnalyze
stats_scripts/mpmath/visualization.py
6
9486
""" Plotting (requires matplotlib) """ from colorsys import hsv_to_rgb, hls_to_rgb from .libmp import NoConvergence from .libmp.backend import xrange class VisualizationMethods(object): plot_ignore = (ValueError, ArithmeticError, ZeroDivisionError, NoConvergence) def plot(ctx, f, xlim=[-5,5], ylim=Non...
apache-2.0
bgris/ODL_bgris
lib/python3.5/site-packages/matplotlib/projections/__init__.py
21
3371
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes from .polar import PolarAxes from matplotlib import axes class ProjectionRegistry(object): """ Manages the set of project...
gpl-3.0
RachitKansal/scikit-learn
sklearn/preprocessing/tests/test_function_transformer.py
176
2169
from nose.tools import assert_equal import numpy as np from sklearn.preprocessing import FunctionTransformer def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X): def _func(X, *args, **kwargs): args_store.append(X) args_store.extend(args) kwargs_store.update(kwargs) ...
bsd-3-clause
jlerman44/pyms
Display/Function.py
7
3652
"""Display.Function.py """ ############################################################################# # # # PyMS software for processing of metabolomic mass-spectrometry data # # Copyright (C) 2005-2012 Vladimir Likic ...
gpl-2.0
ottogroup/dstoolbox
dstoolbox/visualization.py
1
2837
"""Helper functions for creating visualizations. Note: * The helper functions contain additional dependencies not covered by dstoolbox. * They are not covered by tests and thus should only be used for convenience but not for production purposes. """ import io from sklearn.utils import murmurhash3_32 from dstoolbo...
apache-2.0
keflavich/scikit-image
skimage/viewer/utils/core.py
18
6556
import warnings import numpy as np from ..qt import QtWidgets, has_qt, FigureManagerQT, FigureCanvasQTAgg import matplotlib as mpl from matplotlib.figure import Figure from matplotlib import _pylab_helpers from matplotlib.colors import LinearSegmentedColormap if has_qt and 'agg' not in mpl.get_backend().lower(): ...
bsd-3-clause
prudhvid/github-recommendations
test/samplenetworkx.py
1
1813
__author__ = 'prudhvi' import MySQLdb as mdb import networkx as nx import matplotlib.pyplot as plt db = mdb.connect('localhost', 'root', 'pass', 'github'); cursor = db.cursor() cursor.execute("Select * from org_mem group by user_id") rows=cursor.fetchall() cursor.execute("Select * from org_mem group by org_id"...
gpl-2.0
NelisVerhoef/scikit-learn
sklearn/metrics/regression.py
175
16953
"""Metrics to assess performance on regression task Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Ma...
bsd-3-clause
maheshakya/scikit-learn
examples/cluster/plot_cluster_iris.py
350
2593
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= K-means Clustering ========================================================= The plots display firstly what a K-means algorithm would yield using three clusters. It is then shown what the effect of a bad initializa...
bsd-3-clause
demis001/scikit-bio
setup.py
3
4795
#!/usr/bin/env python # ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # ---------------------...
bsd-3-clause
socialsensor/public-figure-image-ranking
python/staticCommEventTask.py
1
35270
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: # Purpose: This .py file is the class file that does all the work # It ranks images in specific events # # Required libs: python-dateutil, numpy,matplotlib,pyparsi...
apache-2.0
yanlend/scikit-learn
sklearn/ensemble/tests/test_forest.py
4
39342
""" Testing for the forest module (sklearn.ensemble.forest). """ # Authors: Gilles Louppe, # Brian Holt, # Andreas Mueller, # Arnaud Joly # License: BSD 3 clause import pickle from collections import defaultdict from itertools import combinations from itertools import product import numpy ...
bsd-3-clause
Raziel90/strands_qsr_lib
qsr_lib/dbg/dbg_template_bounding_boxes_qsrs.py
8
2711
#!/usr/bin/python # import numpy as np from matplotlib import pyplot as plt from matplotlib.patches import Rectangle class Dbg(object): def __init__(self): pass def return_bounding_box_2d(self, x, y, xsize, ysize): """Return the bounding box :param x: x center :param y: y cen...
mit
jseabold/statsmodels
statsmodels/emplike/descriptive.py
5
38955
""" Empirical likelihood inference on descriptive statistics This module conducts hypothesis tests and constructs confidence intervals for the mean, variance, skewness, kurtosis and correlation. If matplotlib is installed, this module can also generate multivariate confidence region plots as well as mean-variance con...
bsd-3-clause
Garrett-R/scikit-learn
benchmarks/bench_random_projections.py
397
8900
""" =========================== Random projection benchmark =========================== Benchmarks for random projections. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import collections import numpy as np import scipy.s...
bsd-3-clause
joernhees/scikit-learn
sklearn/decomposition/__init__.py
66
1433
""" The :mod:`sklearn.decomposition` module includes matrix decomposition algorithms, including among others PCA, NMF or ICA. Most of the algorithms of this module can be regarded as dimensionality reduction techniques. """ from .nmf import NMF, non_negative_factorization from .pca import PCA, RandomizedPCA from .incr...
bsd-3-clause
pysmo/aimbat
tests/plotutils_tests.py
1
1793
import unittest import sys, os, matplotlib import matplotlib.pyplot as py from pysmo.aimbat.plotutils import TimeSelector from pysmo.aimbat.qualctrl import getOptions, getDataOpts, sortSeis, getAxes, PickPhaseMenuMore from pysmo.aimbat.pickphase import PickPhaseMenu, PickPhase test_filename = '20120109.04071467.bhz.pk...
gpl-3.0
udaypandit/black_scholes
Lessons.and.Assignments/Blasius.Shooting.Method/final-project-carr.py
2
1812
# Final Project - Ian Carr # Blasius solution - introduction to fluids import numpy as np import matplotlib.pyplot as plt # building initial parameters nfinal = 8. # final value of n dn = 0.01 # step size N = int(nfinal/dn) # n = np.linspace(0.0,nfinal,N) f = np.zeros(N) f1 = np.zeros(N) f2 = np.zeros(N) # expl...
mit
sumspr/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
242
5885
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
alexis-roche/nipy
examples/algorithms/gaussian_mixture_models.py
4
1220
#!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility __doc__ = """ Example of a demo that fits a Gaussian Mixture Model (GMM) to a dataset The possible number of clusters ...
bsd-3-clause
ngoix/OCRF
sklearn/neighbors/regression.py
7
10997
"""Nearest Neighbor Regression""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck # Multi-output support by Arnaud Joly <a.joly@ulg.ac...
bsd-3-clause
dalejung/ts-charting
ts_charting/test/test_formatter.py
1
5625
from unittest import TestCase import numpy as np import pandas as pd import pandas.util.testing as tm import ts_charting.formatter as formatter plot_index = pd.date_range(start="2000-1-1", freq="B", periods=10000) class TestTimestampLocator(TestCase): def __init__(self, *args, **kwargs): TestCase.__init...
mit
rcbrgs/tuna
setup.py
1
4582
# -*- coding: utf-8 -*- """A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os impor...
gpl-3.0
jamserve/epynet
src/readAndPlot_chbmit_v02.py
1
12159
# -*- coding: utf-8 -*- """ Created on Mon Oct 24 20:40:52 2016 Remember to open from terminal in Python 2.7 brew install wget wget -r -np -c -N -k http://www.physionet.org/pn6/chbmit/ %reset matlab array -> python numpy array matlab cell array -> python list matlab structure -> python dict @author: heslote1 "...
mit
ngoix/OCRF
sklearn/tests/test_cross_validation.py
24
47465
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy.sparse import csr_matrix from scipy import stats from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.test...
bsd-3-clause
lancezlin/ml_template_py
lib/python2.7/site-packages/mpl_toolkits/tests/test_axes_grid.py
7
1600
from matplotlib.testing.decorators import image_comparison from mpl_toolkits.axes_grid1 import ImageGrid import numpy as np import matplotlib.pyplot as plt @image_comparison(baseline_images=['imagegrid_cbar_mode'], extensions=['png'], remove_text=True) def test_imagegrid_cbar_mode...
mit
simonvh/fluff
fluff/plot.py
1
26630
import os import re import sys import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np from matplotlib.font_manager import FontProperties from matplotlib.offsetbox import HPacker, TextArea, AnnotationBbox from matplotlib.patches import FancyArrowPatch, ArrowStyle, Polygon from matplot...
mit
marionleborgne/nupic.research
htmresearch/support/text_preprocess.py
9
12501
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have purchased from # Numenta, Inc. a separate commercial license for this software code, the # following terms and conditions apply: # # This pro...
agpl-3.0
bemcdonnell/SWMMOutputAPI
testing/QuickWrapperTesting_LargeFile.py
1
2089
import sys sys.path.append('..') from datetime import datetime, timedelta from SWMMOutputReader import * import matplotlib.pyplot as plt OutputCollections = SwmmOutputObjects('../data/outputAPI_winx86.dll') OUTFILES = ['C:\\PROJECTCODE\\SWMMOutputAPI\\testing\\OutputTestModel_LargeOutput.out']#,\ ## 'C:\\P...
bsd-2-clause
jaidevd/scikit-learn
examples/plot_isotonic_regression.py
55
1767
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
bsd-3-clause
lzamparo/crisprML
src/specificity_score_distance_neighbors.py
1
16743
__author__ = 'Alexendar Perez' ##################### # # # Introduction # # # ##################### """compute specificity score, Hamming, and Levinstein distance neighborhoods for strings""" ################# # # # Libraries # # # ############...
bsd-3-clause
imaculate/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
102
2319
#!/usr/bin/env python """ ============================================= Joint feature selection with multi-task Lasso ============================================= The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected features to be the same across tasks. This example simulates...
bsd-3-clause
Fireblend/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
157
13799
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import assert_array_almost_equal, assert_array_equal from sklearn.datasets import make_classification from sklearn.utils.sparsefuncs import (mean_variance_axis, inplace_column_scale, ...
bsd-3-clause
MaxPoint/cyavro
cyavro/__init__.py
1
17429
# Copyright (c) 2015 MaxPoint Interactive, Inc. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this list of conditi...
bsd-3-clause
maxalbert/geopandas
tests/test_tools.py
8
1589
from __future__ import absolute_import from shapely.geometry import Point, MultiPoint, LineString from geopandas import GeoSeries from geopandas.tools import collect from .util import unittest class TestTools(unittest.TestCase): def setUp(self): self.p1 = Point(0,0) self.p2 = Point(1,1) sel...
bsd-3-clause
Achuth17/scikit-learn
examples/feature_selection/plot_rfe_with_cross_validation.py
226
1384
""" =================================================== Recursive feature elimination with cross-validation =================================================== A recursive feature elimination example with automatic tuning of the number of features selected with cross-validation. """ print(__doc__) import matplotlib.p...
bsd-3-clause
atulsingh0/MachineLearning
ML_A2Z/04_Polynomial_Regression.py
1
2285
# -*- coding: utf-8 -*- """ Created on Sun May 7 09:39:47 2017 # Polynomial Regression @author: Atul """ # import import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.preprocessing import LabelEncoder, OneHotEncoder from sklearn.preprocessing import PolynomialFeatures from sklearn.mod...
gpl-3.0
RittmanResearch/maybrain
maybrain/plotting/histograms.py
1
2008
""" Module which plotting functions to visualise histograms """ import matplotlib.pyplot as plt import numpy as np import networkx as nx def show(): """ Show all the figures generated by matplotlib This function is equivalent to :func:`matplotlib.pyplot.show`. """ plt.show() def plot_weight_dist...
apache-2.0
Caoimhinmg/PmagPy
pmagpy/new_builder.py
1
77768
#!/usr/bin/env python """ This module is for creating or editing a MagIC contribution, (or a piece of one). You can build a contribution or an individual table from the ground up, or you can read in one or more MagIC-format files. You can also extract specific data from a table -- for instance, you can build a DIblock...
bsd-3-clause
potash/scikit-learn
examples/applications/wikipedia_principal_eigenvector.py
50
7817
""" =============================== Wikipedia principal eigenvector =============================== A classical way to assert the relative importance of vertices in a graph is to compute the principal eigenvector of the adjacency matrix so as to assign to each vertex the values of the components of the first eigenvect...
bsd-3-clause
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/tseries/offsets.py
7
95013
from datetime import date, datetime, timedelta from pandas.compat import range from pandas import compat import numpy as np from pandas.types.generic import ABCSeries, ABCDatetimeIndex, ABCPeriod from pandas.tseries.tools import to_datetime, normalize_date from pandas.core.common import AbstractMethodError # import a...
apache-2.0
smrjan/seldon-server
python/build/lib/seldon/keras.py
2
7582
from __future__ import absolute_import from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.normalization import BatchNormalization from keras.utils import np_utils from keras.models import model_from_json import sys import numpy as np import pandas as pd from s...
apache-2.0