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
alexandreday/fast_density_clustering
build/lib/fdc/plotting.py
2
16580
''' Created on Jan 16, 2017 @author: Alexandre Day ''' import numpy as np from matplotlib import pyplot as plt import matplotlib.patheffects as PathEffects from .mycolors import COLOR_PALETTE from .fdc import FDC import math def set_nice_font(size = 18, usetex=False): font = {'family' : 'serif', 'size' : size}...
bsd-3-clause
linebp/pandas
pandas/tests/sparse/test_libsparse.py
14
22152
from pandas import Series import pytest import numpy as np import operator import pandas.util.testing as tm from pandas import compat from pandas.core.sparse.array import IntIndex, BlockIndex, _make_index import pandas._libs.sparse as splib TEST_LENGTH = 20 plain_case = dict(xloc=[0, 7, 15], xlen=[3, 5, 5], yloc=[...
bsd-3-clause
hazelnusse/sympy-old
examples/intermediate/sample.py
11
3354
""" Utility functions for plotting sympy functions. See examples\mplot2d.py and examples\mplot3d.py for usable 2d and 3d graphing functions using matplotlib. """ from numpy import repeat, arange, empty, ndarray, array from sympy import Symbol, Basic, Real, Rational, I, sympify def sample2d(f, x_args): """ Sa...
bsd-3-clause
alvarofierroclavero/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
BoltzmannBrain/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/mathtext.py
69
101723
r""" :mod:`~matplotlib.mathtext` is a module for parsing a subset of the TeX math syntax and drawing them to a matplotlib backend. For a tutorial of its usage see :ref:`mathtext-tutorial`. This document is primarily concerned with implementation details. The module uses pyparsing_ to parse the TeX expression. .. _p...
agpl-3.0
hncg/jieba
test/extract_topic.py
65
1463
import sys sys.path.append("../") from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn import decomposition import jieba import time import glob import sys import os import random if len(sys.argv)<2: print("usage: extract_topic.py di...
mit
kjung/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause
sbussmann/Bussmann2015
Code/fluxplot.py
2
2222
""" 2014 July 16 Shane Bussmann Plot the distribution of fluxdensities for the ALMA sample. Compare total observed flux (what a single-dish telescope with 20" FWHM resolution would see) with the individual observed flux (accounting for blending) and with the individual intrinsic flux (accounting for lensing). """ ...
mit
lin-credible/scikit-learn
sklearn/datasets/tests/test_svmlight_format.py
228
11221
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
v0devil/jltom
datagenerator_py3.py
1
38469
from collections import OrderedDict import json import logging #from pylab import * import numpy as np import pandas as pd import sys import re import os import zipfile import sqlalchemy import shutil import time import datetime import argparse from xml.etree.ElementTree import ElementTree from os.path import basename ...
mit
quimaguirre/diana
scripts/compare_profiles.py
1
35855
import argparse import configparser import copy import ntpath import numpy as np import pandas as pd import time import sys, os, re from context import diana import diana.classes.drug as diana_drug import diana.classes.comparison as comparison import diana.classes.network_analysis as network_analysis import diana.clas...
mit
martin-hunt/foobar
docs/conf.py
1
8160
# -*- coding: utf-8 -*- # # 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. # # All configuration values have a default; values that are commented out # serve to show the default. import sys imp...
mit
deepakantony/sms-tools
lectures/05-Sinusoidal-model/plots-code/sineModelAnal-bendir.py
24
1245
import numpy as np import matplotlib.pyplot as plt import sys, os, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import stft as STFT import sineModel as SM import utilFunctions as UF (fs, x) = UF.wavread(os.path.join(os.path.dirname(os.path.realpath(__fi...
agpl-3.0
gfyoung/pandas
pandas/tests/series/methods/test_to_csv.py
3
6229
from datetime import datetime from io import StringIO import numpy as np import pytest import pandas as pd from pandas import Series import pandas._testing as tm from pandas.io.common import get_handle class TestSeriesToCSV: def read_csv(self, path, **kwargs): params = {"squeeze": True, "index_col": 0,...
bsd-3-clause
zanton123/HaSAPPy
program/DesignGeneInsertion.py
1
9186
# -*- coding: utf-8 -*- """ Created on Tue May 24 08:20:07 2016 @author: GDM """ #### Importing modules #### import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.patches as patches import HTSeq import cPickle as pickle import os import re mpl.interactive(False) #### #### Class definition #### ...
mit
sunshineDrizzle/FreeROI
froi/algorithm/unused/spectralmapper.py
6
3516
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Mapper for spectral clustering. Date: 2012.05.29 """ __docformat__ = 'restructuredtext' import numpy as np import scipy.sparse as sp from mvpa2.base import warning from mvpa2.base.doc...
bsd-3-clause
alvations/oque
que.py
1
8287
import io, sys import numpy as np from scipy.stats import uniform as sp_rand from itertools import combinations from sklearn.linear_model import BayesianRidge from sklearn.grid_search import RandomizedSearchCV from sklearn.metrics import mean_squared_error, mean_absolute_error from sklearn.svm import SVR from sklear...
mit
glennq/scikit-learn
examples/svm/plot_svm_regression.py
120
1520
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
bsd-3-clause
abhisg/scikit-learn
sklearn/tests/test_metaestimators.py
226
4954
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.pipeline import Pipeline...
bsd-3-clause
inkenbrandt/WellApplication
wellapplication/hydropy.py
1
5866
""" Hydropy package @author: Stijn Van Hoey from: https://github.com/stijnvanhoey/hydropy/tree/master/hydropy for a better and more up to date copy of this script go to the original repo. """ from __future__ import absolute_import, division, print_function, unicode_literals import pandas as pd import numpy as np from s...
mit
Vimos/scikit-learn
examples/cluster/plot_kmeans_digits.py
42
4491
""" =========================================================== A demo of K-Means clustering on the handwritten digits data =========================================================== In this example we compare the various initialization strategies for K-means in terms of runtime and quality of the results. As the gr...
bsd-3-clause
xiaoxiamii/scikit-learn
sklearn/metrics/setup.py
299
1024
import os import os.path import numpy from numpy.distutils.misc_util import Configuration from sklearn._build_utils import get_blas_info def configuration(parent_package="", top_path=None): config = Configuration("metrics", parent_package, top_path) cblas_libs, blas_info = get_blas_info() if os.name ==...
bsd-3-clause
krez13/scikit-learn
sklearn/metrics/classification.py
8
68395
"""Metrics to assess performance on classification task given classe prediction 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.gram...
bsd-3-clause
gfyoung/pandas
pandas/tests/arrays/categorical/test_constructors.py
2
28825
from datetime import date, datetime import numpy as np import pytest from pandas.compat import IS64, is_platform_windows from pandas.core.dtypes.common import is_float_dtype, is_integer_dtype from pandas.core.dtypes.dtypes import CategoricalDtype import pandas as pd from pandas import ( Categorical, Categor...
bsd-3-clause
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/tests/indexing/common.py
7
9615
""" common utilities """ import itertools from warnings import catch_warnings import numpy as np from pandas.compat import lrange from pandas.core.dtypes.common import is_scalar from pandas import Series, DataFrame, Panel, date_range, UInt64Index from pandas.util import testing as tm from pandas.io.formats.printing i...
apache-2.0
RoboticsClubatUCF/RoboSub
ucf_sub_catkin_ros/src/sub_utils/src/color.py
1
2950
from matplotlib import pyplot as plt import numpy as np import argparse import cv2 from imutils import paths import imutils import os from sklearn.externals import joblib #Argument Parsing ap = argparse.ArgumentParser() ap.add_argument("-p", "--positive", required=True, help="path to positive images directory") ap.a...
mit
bdh1011/wau
venv/lib/python2.7/site-packages/pandas/stats/tests/test_math.py
15
1927
import nose from datetime import datetime from numpy.random import randn import numpy as np from pandas.core.api import Series, DataFrame, date_range from pandas.util.testing import assert_almost_equal import pandas.core.datetools as datetools import pandas.stats.moments as mom import pandas.util.testing as tm import...
mit
chrisdamba/mining
mining/controllers/data/__init__.py
4
5907
# -*- coding: utf-8 -*- from gevent import monkey monkey.patch_all() import json import gc from bottle import Bottle, request, response from bottle.ext.mongo import MongoPlugin from pandas import DataFrame from mining.settings import PROJECT_PATH from mining.utils import conf, __from__ from mining.utils._pandas imp...
mit
fbagirov/scikit-learn
sklearn/utils/estimator_checks.py
33
48331
from __future__ import print_function import types import warnings import sys import traceback import inspect import pickle from copy import deepcopy import numpy as np from scipy import sparse import struct from sklearn.externals.six.moves import zip from sklearn.externals.joblib import hash, Memory from sklearn.ut...
bsd-3-clause
Weihonghao/ECM
Vpy34/lib/python3.5/site-packages/pandas/io/sas/sas_xport.py
14
14805
""" Read a SAS XPort format file into a Pandas DataFrame. Based on code from Jack Cushman (github.com/jcushman/xport). The file format is defined here: https://support.sas.com/techsup/technote/ts140.pdf """ from datetime import datetime import pandas as pd from pandas.io.common import get_filepath_or_buffer, BaseIt...
agpl-3.0
mikekestemont/beckett
code/diachron.py
1
7046
import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import seaborn as sb sb.set_style("dark") import os import string import codecs import glob from operator import itemgetter from collections import named...
mit
rajat1994/scikit-learn
examples/cluster/plot_kmeans_digits.py
230
4524
""" =========================================================== A demo of K-Means clustering on the handwritten digits data =========================================================== In this example we compare the various initialization strategies for K-means in terms of runtime and quality of the results. As the gr...
bsd-3-clause
ZENGXH/scikit-learn
sklearn/ensemble/tests/test_weight_boosting.py
40
16837
"""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
strands-project/strands_qsr_lib
qsr_lib/dbg/dbg_cardinal_directions.py
8
3697
#!/usr/bin/python import math 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 center ...
mit
ArcherSys/ArcherSys
eclipse/plugins/org.python.pydev_4.5.5.201603221110/pysrc/pydev_ipython/qt_for_kernel.py
67
2337
""" 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' QT_API env v...
mit
louispotok/pandas
pandas/tests/frame/test_timezones.py
7
5632
# -*- coding: utf-8 -*- """ Tests for DataFrame timezone-related methods """ from datetime import datetime import pytest import pytz import numpy as np import pandas.util.testing as tm from pandas.compat import lrange from pandas.core.indexes.datetimes import date_range from pandas.core.dtypes.dtypes import DatetimeT...
bsd-3-clause
viiru-/pytrainer
pytrainer/lib/graphdata.py
2
4969
# -*- coding: iso-8859-1 -*- #Copyright (C) Fiz Vazquez vud1@sindominio.net #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version...
gpl-2.0
prasetiyohadi/learn-computations
monte-carlo/hitnmiss3.py
1
2969
from collections import OrderedDict as od from matplotlib import pyplot as plt import csv import operator import random import time # function def myfunc(x, y, z): return x*y**2*z+x**3*y*z**2-x*y*z**3 # analitically integrated function def myintfunc(xa, ya, za, xb, yb, zb): return (xb**2-xa**2)*(yb**3-ya**3...
mit
da1z/intellij-community
python/helpers/pydev/pydevd.py
1
69071
''' Entry point module (keep at root): This module starts the debugger. ''' import sys if sys.version_info[:2] < (2, 6): raise RuntimeError('The PyDev.Debugger requires Python 2.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.') import atexit import os import...
apache-2.0
dpshelio/sunpy
examples/plotting/Finding_Local_Peaks_in_Solar_Data.py
2
3152
""" ================================= Finding Local Peaks in Solar Data ================================= Detecting intensity peaks in solar images can be useful, for example as a simple flare identification mechanism. This example illustrates detection of areas where there is a spike in solar intensity. We use the `~...
bsd-2-clause
jniediek/mne-python
mne/viz/tests/test_3d.py
5
9195
# 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> # Mainak Jas <mainak@neuro.hut.fi> # Mark Wronkiewicz <wronk.mark@gmail.c...
bsd-3-clause
GGiecold/pyRMT
pyRMT.py
1
26076
#!/usr/bin/env python # -*- coding: utf-8 -*- r"""Python for Random Matrix Theory. This package implements several cleaning schemes for noisy correlation matrices, including the optimal shrinkage, rotationally-invariant estimator to an underlying correlation matrix (as proposed by Joel Bun, Jean-Philippe Bouchaud,...
mit
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/numpy/doc/creation.py
118
5507
""" ============== Array Creation ============== Introduction ============ There are 5 general mechanisms for creating arrays: 1) Conversion from other Python structures (e.g., lists, tuples) 2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros, etc.) 3) Reading arrays from disk, either from...
apache-2.0
costypetrisor/scikit-learn
sklearn/learning_curve.py
13
13351
"""Utilities to evaluate models with respect to a variable """ # Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings import numpy as np from .base import is_classifier, clone from .cross_validation import _check_cv from .externals.joblib import Parallel, delayed fr...
bsd-3-clause
justincassidy/scikit-learn
sklearn/linear_model/tests/test_logistic.py
105
26588
import numpy as np import scipy.sparse as sp from scipy import linalg, optimize, sparse from sklearn.utils.testing import assert_almost_equal 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.util...
bsd-3-clause
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/tests/indexes/test_datetimelike.py
7
52802
# -*- coding: utf-8 -*- from datetime import datetime, timedelta, time import numpy as np from pandas import (DatetimeIndex, Float64Index, Index, Int64Index, NaT, Period, PeriodIndex, Series, Timedelta, TimedeltaIndex, date_range, period_range, timedelta_ra...
apache-2.0
shahankhatch/scikit-learn
examples/svm/plot_oneclass.py
249
2302
""" ========================================== One-class SVM with non-linear kernel (RBF) ========================================== An example using a one-class SVM for novelty detection. :ref:`One-class SVM <svm_outlier_detection>` is an unsupervised algorithm that learns a decision function for novelty detection: ...
bsd-3-clause
bnaul/scikit-learn
sklearn/linear_model/tests/test_huber.py
12
7600
# Authors: Manoj Kumar mks542@nyu.edu # License: BSD 3 clause import numpy as np from scipy import optimize, sparse from sklearn.utils._testing import assert_almost_equal from sklearn.utils._testing import assert_array_equal from sklearn.utils._testing import assert_array_almost_equal from sklearn.datasets import ma...
bsd-3-clause
calum-chamberlain/EQcorrscan
eqcorrscan/utils/mag_calc.py
1
49349
""" Functions to aid magnitude estimation. :copyright: EQcorrscan developers. :license: GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html) """ import numpy as np import logging import eqcorrscan # Used to get version number import os import glob import matplotlib.pypl...
gpl-3.0
michaelbramwell/sms-tools
lectures/08-Sound-transformations/plots-code/stftMorph-orchestra.py
18
2053
import numpy as np import time, os, sys from scipy.signal import hamming, resample import matplotlib.pyplot as plt sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/transfo...
agpl-3.0
Akshay0724/scikit-learn
sklearn/tests/test_multioutput.py
23
12429
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.utils import shuffle from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_raises_regex from s...
bsd-3-clause
ageron/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimators_test.py
46
6682
# 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
MohammedWasim/Data-Science-45min-Intros
support-vector-machines-101/svm-example.py
26
2219
#!/usr/bin/env python # -*- coding: UTF-8 -*- __author__="Josh Montague" __license__="MIT License" import sys import pandas as pd import numpy as np from sklearn.datasets import make_blobs from sklearn.svm import SVC import matplotlib.pyplot as plt try: import seaborn as sns except ImportError as e: sys.stde...
unlicense
hannwoei/paparazzi
sw/tools/calibration/calibration_utils.py
19
9087
# Copyright (C) 2010 Antoine Drouin # # This file is part of Paparazzi. # # Paparazzi 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, or (at your option) # any later version. # # Paparazzi ...
gpl-2.0
loli/sklearn-ensembletrees
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
CVML/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
256
2406
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
seckcoder/lang-learn
python/sklearn/sklearn/ensemble/gradient_boosting.py
1
40371
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
unlicense
mikebenfield/scikit-learn
examples/cluster/plot_ward_structured_vs_unstructured.py
320
3369
""" =========================================================== Hierarchical clustering: structured vs unstructured ward =========================================================== Example builds a swiss roll dataset and runs hierarchical clustering on their position. For more information, see :ref:`hierarchical_clus...
bsd-3-clause
MJuddBooth/pandas
pandas/tests/extension/base/interface.py
3
2284
import numpy as np from pandas.core.dtypes.common import is_extension_array_dtype from pandas.core.dtypes.dtypes import ExtensionDtype import pandas as pd import pandas.util.testing as tm from .base import BaseExtensionTests class BaseInterfaceTests(BaseExtensionTests): """Tests that the basic interface is sat...
bsd-3-clause
soravux/pms
pms.py
1
7603
#!/usr/bin/env python import argparse import json import pickle import numpy as np from scipy.misc import imread from scipy import sparse from scipy import optimize import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import mesh def getImage(filename): """Open image file in greyscale m...
mit
stopfer/opengm
src/interfaces/python/opengm/benchmark/__init__.py
14
2396
import opengm import os import numpy try: import matplotlib.pyplot as plt from matplotlib import pyplot from matplotlib import pylab except: pass class ModelResult(object): def __init__(self): print opengm.configuration def filenamesFromDir(path,ending='.h5'): return [path+f for f in os.listdir(path) i...
mit
JPFrancoia/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
jseabold/statsmodels
statsmodels/emplike/tests/test_regression.py
5
5787
from numpy.testing import assert_almost_equal import pytest from statsmodels.regression.linear_model import OLS from statsmodels.tools import add_constant from .results.el_results import RegressionResults from statsmodels.datasets import stackloss class GenRes(object): """ Loads data and creates class insta...
bsd-3-clause
lewislone/mStocks
packets-analysis/lib/XlsxWriter-0.7.3/examples/pandas_chart.py
9
1049
############################################################################## # # An example of converting a Pandas dataframe to an xlsx file with a chart # using Pandas and XlsxWriter. # # Copyright 2013-2015, John McNamara, jmcnamara@cpan.org # import pandas as pd # Create a Pandas dataframe from some data. df = ...
mit
vanatteveldt/semafor
src/main/python/semafor/framenet/pmi.py
5
1525
from itertools import chain, combinations, product import codecs import json from math import log import networkx as nx import matplotlib as plt from nltk import FreqDist from semafor.framenet.frames import FrameHierarchy THRESHOLD = 4 def draw_graph(graph): pos = nx.graphviz_layout(graph, prog='dot') nx.d...
gpl-3.0
q1ang/scikit-learn
sklearn/metrics/cluster/tests/test_unsupervised.py
230
2823
import numpy as np from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.metrics.cluster.unsupervised import silhouette_score from sklearn.metrics import pairwise_distances from sklearn.utils.testing import assert_false, assert_almost_equal from sklearn.utils.testing import assert_raises_regexp...
bsd-3-clause
filipkilibarda/Ants-on-a-Polygon
simulation.py
1
3153
import matplotlib.pyplot as plt import matplotlib.animation as animation from math import pi,cos,sin,sqrt import numpy as np import ants def calcAnalyticalSolution(): ngon = ants.Ngon(NUMBER_OF_ANTS) phi = ngon.getInteriorAngle() intialDistanceAnts = 2*INITIAL_DISTANCE_ORIGIN*sin(2*pi/NUMBER_OF_ANTS/2) ...
mit
galactics/beyond
tests/propagators/test_keplernum.py
2
15660
import numpy as np from contextlib import contextmanager from pytest import fixture, raises, mark from unittest.mock import patch import beyond.io.ccsds as ccsds from beyond.dates import Date, timedelta from beyond.io.tle import Tle from beyond.propagators.keplernum import KeplerNum, SOIPropagator from beyond.env.sol...
mit
trankmichael/scikit-learn
examples/model_selection/plot_precision_recall.py
249
6150
""" ================ Precision-Recall ================ Example of Precision-Recall metric to evaluate classifier output quality. In information retrieval, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned. A high area under the curve represents both ...
bsd-3-clause
glorizen/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/path.py
69
20263
""" Contains a class for managing paths (polylines). """ import math from weakref import WeakValueDictionary import numpy as np from numpy import ma from matplotlib._path import point_in_path, get_path_extents, \ point_in_path_collection, get_path_collection_extents, \ path_in_path, path_intersects_path, con...
agpl-3.0
kastnerkyle/COCORA2012
gui.py
1
17016
#!/usr/bin/python import sys from PyQt4 import QtGui as qtg from PyQt4 import QtCore as qtc from numpy import arange, sin, pi from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure from matplotlib.patches import Rectangle from matplotlib.ticker import Fun...
bsd-3-clause
jzt5132/scikit-learn
examples/decomposition/plot_faces_decomposition.py
204
4452
""" ============================ Faces dataset decompositions ============================ This example applies to :ref:`olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter :ref:`decompositions`) . """...
bsd-3-clause
pratapvardhan/pandas
pandas/tests/scalar/timestamp/test_comparisons.py
7
6112
# -*- coding: utf-8 -*- from datetime import datetime import operator import pytest import numpy as np from dateutil.tz import tzutc from pytz import utc from pandas.compat import long, PY2 from pandas import Timestamp class TestTimestampComparison(object): def test_comparison_object_array(self): # GH#...
bsd-3-clause
Silmathoron/NNGT
nngt/__init__.py
1
10076
#!/usr/bin/env python #-*- coding:utf-8 -*- # # This file is part of the NNGT project to generate and analyze # neuronal networks and their activity. # Copyright (C) 2015-2019 Tanguy Fardet # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License a...
gpl-3.0
intel-analytics/analytics-zoo
pyzoo/test/zoo/orca/learn/ray/tf/test_tf_ray_estimator.py
1
21559
# # Copyright 2018 Analytics Zoo Authors. # # 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...
apache-2.0
massmutual/scikit-learn
sklearn/externals/joblib/__init__.py
72
4795
""" Joblib is a set of tools to provide **lightweight pipelining in Python**. In particular, joblib offers: 1. transparent disk-caching of the output values and lazy re-evaluation (memoize pattern) 2. easy simple parallel computing 3. logging and tracing of the execution Joblib is optimized to be **fast*...
bsd-3-clause
dariox2/CADL
session-5/s5p3-latent_space_arithmetic.py
1
18992
# # Session 5, part 3 # print("Begin import...") import sys import os import numpy as np import matplotlib.pyplot as plt from skimage.transform import resize #from skimage import data # ERROR: Cannot load libmkl_def.so from scipy.misc import imresize from scipy.ndimage.filters import gaussian_filter print("Loading ...
apache-2.0
justincassidy/scikit-learn
sklearn/tests/test_metaestimators.py
226
4954
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.pipeline import Pipeline...
bsd-3-clause
seanpquinn/augerta
web_monitor/unhex_and_sort_mar2017_v4_catchup.py
1
24486
# Copyright (c) Case Western Reserve University 2017 # This software is distributed under Apache License 2.0 # Consult the file LICENSE.txt # Author: Sean Quinn spq@case.edu # Mar 23 2017 import binascii import bz2 import struct import os import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import n...
apache-2.0
PanDAWMS/panda-bigmon-core-old
core/common/models.py
1
139296
# Create your models here. # This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # Feel free to rename the models, but don't rename db_table values or field names. # #...
apache-2.0
danielfrg/datasciencebox
datasciencebox/salt/_states/conda.py
1
5256
import os __virtualname__ = 'conda' def __virtual__(): """ Only load if the conda module is available in __salt__ """ if 'pip.list' in __salt__: return __virtualname__ return False def managed(name, packages=None, requirements=None, saltenv='base', user=None): """ Create and ins...
apache-2.0
OpenGenus/cosmos
code/artificial_intelligence/src/artificial_neural_network/ann.py
3
1384
import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv("dataset.csv") X = dataset.iloc[:, 3:13].values y = dataset.iloc[:, 13].values from sklearn.preprocessing import LabelEncoder, OneHotEncoder labelencoder_X_1 = LabelEncoder() X[:, 1] = labelencoder_X_1.fit_transform(X[:, 1])...
gpl-3.0
pbashivan/EEGLearn
eeglearn/eeg_cnn_lib.py
1
24878
from __future__ import print_function import time import numpy as np np.random.seed(1234) from functools import reduce import math as m import scipy.io import theano import theano.tensor as T from scipy.interpolate import griddata from sklearn.preprocessing import scale from utils import augment_EEG, c...
gpl-2.0
NickC1/skedm
build/lib/skedm/utilities.py
1
9845
""" Metrics for scoring predictions and also some more specialized math needed for skedm """ import numpy as np from scipy import stats as stats from numba import jit def weighted_mean(X, distances ): """ Calculates the weighted mean given a set of values and their corresponding distances. Only 1/distan...
mit
exepulveda/swfc
python/spatial_correction_kmean_2d.py
1
2530
import sys import random import logging import collections import math import sys import json sys.path += ['..'] import numpy as np import scipy.stats from graph_labeling import graph_cut, make_neighbourhood from scipy.spatial import cKDTree from sklearn.preprocessing import StandardScaler from sklearn.cluster imp...
gpl-3.0
kshedstrom/pyroms
examples/cobalt-preproc/Boundary_bio/remap_bdry_bio.py
1
6606
import numpy as np import os try: import netCDF4 as netCDF except: import netCDF3 as netCDF import matplotlib.pyplot as plt import time from datetime import datetime from matplotlib.dates import date2num, num2date import pyroms import pyroms_toolbox import _remapping class nctime(object): pass def remap_bdry...
bsd-3-clause
sara-02/fabric8-analytics-stack-analysis
analytics_platform/kronos/pgm/src/offline_training.py
1
6130
"""Functions to perform offline training for Kronos PGM.""" import sys import time import os from analytics_platform.kronos.src import config import analytics_platform.kronos.pgm.src.pgm_constants as pgm_constants from analytics_platform.kronos.pgm.src.pgm_pomegranate import PGMPomegranate from util.analytics_platform...
gpl-3.0
DerThorsten/seglib
seglibpython/seglib/clustering/ce_multicut.py
1
7168
from seglib import cgp2d from seglib.preprocessing import norm01 import opengm import numpy import vigra from sklearn.cluster import Ward,WardAgglomeration class CgpClustering(object): def __init__(self,cgp): self.cgp = cgp self.labels = numpy.zeros(self.cgp.numCells(2),dtype=numpy.uint64) class Hierarchica...
mit
alephu5/Soundbyte
environment/lib/python3.3/site-packages/pandas/tests/test_format.py
1
81984
from __future__ import print_function # -*- coding: utf-8 -*- from pandas.compat import range, zip, lrange, StringIO, PY3, lzip, u import pandas.compat as compat import itertools import os import sys from textwrap import dedent import warnings from numpy import nan from numpy.random import randn import numpy as np f...
gpl-3.0
mmottahedi/neuralnilm_prototype
scripts/experiment035.py
2
10172
from __future__ import division, print_function import matplotlib.pyplot as plt import numpy as np import pandas as pd from datetime import timedelta from numpy.random import rand from time import time from nilmtk import TimeFrame, DataSet, MeterGroup """ INPUT: quantized mains fdiff, all-hot OUTPUT: appliance fdiff ...
mit
radjkarl/imgProcessor
imgProcessor/interpolate/interpolateCircular2dStructuredIDW.py
1
6467
from __future__ import division import numpy as np from numba import jit from math import atan2 @jit(nopython=True) def interpolateCircular2dStructuredIDW(grid, mask, kernel=15, power=2, fr=1, fphi=1, cx=0, cy=0): ''' same as interpolate2dStructuredIDW but calcul...
gpl-3.0
herilalaina/scikit-learn
examples/cluster/plot_cluster_iris.py
56
2815
#!/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
dmnfarrell/mirnaseq
smallrnaseq/plotting.py
2
7525
#!/usr/bin/env python # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. # # This program is distributed in the hope that ...
gpl-3.0
alshedivat/tensorflow
tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py
30
40476
# 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
tangyouze/tushare
tushare/datayes/future.py
17
1740
# -*- coding:utf-8 -*- """ 通联数据 Created on 2015/08/24 @author: Jimmy Liu @group : waditu @contact: jimmysoa@sina.cn """ from pandas.compat import StringIO import pandas as pd from tushare.util import vars as vs from tushare.util.common import Client from tushare.util import upass as up class Future(): def _...
bsd-3-clause
ChanderG/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_array from ..utils.graph import...
bsd-3-clause
vishwa91/OptSys
examples/objective.py
1
1478
#!/usr/bin/env python3 import os, sys sys.path.append('../modules') import numpy as np import matplotlib.pyplot as plt import raytracing as rt import visualize as vis import ray_utilities if __name__ == '__main__': # Create a relay lens system components = [] rays = [] image_plane = -300 nrays =...
mit
coreyabshire/stacko
src/competition_utilities.py
1
5336
from __future__ import division from collections import Counter import csv import dateutil from datetime import datetime from dateutil.relativedelta import relativedelta import numpy as np import os import pandas as pd import pymongo data_path = "C:/Projects/ML/stacko/data2" submissions_path = data_path if not data_pa...
bsd-2-clause
madjelan/scikit-learn
sklearn/linear_model/tests/test_base.py
120
10082
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model....
bsd-3-clause
akshayka/edxclassify
edxclassify/classifiers/clf_util.py
1
3557
import numpy as np from sklearn.cross_validation import StratifiedKFold from sklearn import metrics from sklearn.externals import joblib import skll def load_clf(pkl_file): """Load a joblib-dumped data_cleaner and trained classifier""" data_cleaner, clf = joblib.load(pkl_file) return data_cleaner, clf d...
gpl-2.0