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
mkukielka/oddt
oddt/spatial.py
2
9648
"""Spatial functions included in ODDT Mainly used by other modules, but can be accessed directly. """ from math import sin, cos import numpy as np from scipy.spatial.distance import cdist # for Hungarian algorithm, in future use scipy.optimize.linear_sum_assignment (in scipy 0.17+) try: from scipy.optimize import...
bsd-3-clause
rs2/pandas
pandas/tests/arithmetic/test_timedelta64.py
1
78590
# 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
RayMick/scikit-learn
examples/ensemble/plot_forest_iris.py
335
6271
""" ==================================================================== Plot the decision surfaces of ensembles of trees on the iris dataset ==================================================================== Plot the decision surfaces of forests of randomized trees trained on pairs of features of the iris dataset. ...
bsd-3-clause
chenyyx/scikit-learn-doc-zh
examples/zh/preprocessing/plot_function_transformer.py
158
1993
""" ========================================================= Using FunctionTransformer to select columns ========================================================= Shows how to use a function transformer in a pipeline. If you know your dataset's first principle component is irrelevant for a classification task, you ca...
gpl-3.0
pyoceans/pocean-core
pocean/utils.py
1
14316
#!python # coding=utf-8 import six import uuid import decimal import operator import itertools import simplejson as json from datetime import datetime, date, time from collections import namedtuple, Mapping, Counter try: # PY2 support from urlparse import urlparse as uparse except ImportError: from urllib....
mit
PFCM/facebook_data_collection
test_mergetools.py
1
5340
""" Tests for the mergetools.py script. """ import tempfile import random from contextlib import contextmanager import string import datetime import csv import os import pandas as pd import mergetools from scraper import CSV_HEADERS, write_data def random_str(length, chars=string.ascii_lowercase): return ''.join...
bsd-2-clause
dsm054/pandas
pandas/plotting/_timeseries.py
4
11279
# TODO: Use the fact that axis can have units to simplify the process import functools import numpy as np from matplotlib import pylab from pandas._libs.tslibs.period import Period from pandas.core.dtypes.generic import ( ABCPeriodIndex, ABCDatetimeIndex, ABCTimedeltaIndex) from pandas.tseries.offsets import D...
bsd-3-clause
gsathya/metrics-tasks
task-2718/detectorv2.py
2
17462
## Copyright (c) 2011 George Danezis <gdane@microsoft.com> ## ## All rights reserved. ## ## Redistribution and use in source and binary forms, with or without ## modification, are permitted (subject to the limitations in the ## disclaimer below) provided that the following conditions are met: ## ## * Red...
bsd-3-clause
mrcouts/Bootstrap-Paradox
Experimental/Aquisicoes/SMCx_triangulo/aquisicoes.py
1
8595
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np from math import pi as Pi from txt2py import * from matplotlib.ticker import MultipleLocator A = txt2py("aquisicao_triangulo_SMCx_lambda60_phi6_k103_0_2.txt") #aquisicao_circulo_PIDSMCx_lambda70_phi6_k70_0_3: e_quad = 0.912252649215 | tau_quad...
gpl-3.0
alexpearce/thesis
scripts/background_categories.py
1
3206
from __future__ import absolute_import, division, print_function import os import matplotlib.pyplot as plt import ROOT import root_pandas from histograms import histogram from root_converters import roocurve, tgraphasymerrors from plotting_utilities import ( COLOURS as colours, set_axis_labels ) PREFIX = 'ro...
mit
Caranarq/01_Dmine
Scripts/PCCS_variables/PCCS_variables.py
1
2306
# -*- coding: utf-8 -*- """ Created on Tue Aug 29 10:45:27 2017 @author: carlos.arana """ ''' Descripcion: Script para revisar variables existentes en un dataset. El script revisa, a partir de una lista, si las variables se encuentran previamente identificadas en el proyecto de la PCCS (En el archivo PCCS_variables.c...
gpl-3.0
GuessWhoSamFoo/pandas
pandas/core/reshape/reshape.py
1
36545
# pylint: disable=E1101,E1103 # pylint: disable=W0703,W0622,W0613,W0201 from functools import partial import itertools import numpy as np from pandas._libs import algos as _algos, reshape as _reshape from pandas._libs.sparse import IntIndex from pandas.compat import PY2, range, text_type, u, zip from pandas.core.dty...
bsd-3-clause
rdo-management/cardiff
cardiff/check.py
2
25187
import re import numpy from pandas import * from cardiff import compare_sets from cardiff import perf_cpu_tables from cardiff import utils def search_item(systems, unique_id, item, regexp, exclude_list=[], include_list=[], override_list=[]): sets = {} for system in systems: sets[system[unique_id]] =...
apache-2.0
leggitta/mne-python
examples/stats/plot_fdr_stats_evoked.py
19
2743
""" ======================================= FDR correction on T-test on sensor data ======================================= One tests if the evoked response significantly deviates from 0. Multiple comparison problem is addressed with False Discovery Rate (FDR) correction. """ # Authors: Alexandre Gramfort <alexandre....
bsd-3-clause
herilalaina/scikit-learn
sklearn/ensemble/tests/test_iforest.py
27
8377
""" Testing for Isolation Forest algorithm (sklearn.ensemble.iforest). """ # Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from sklearn.utils.fixes import euler_gamma from sklearn.utils.test...
bsd-3-clause
StevenBlack/pandashells
pandashells/bin/p_format.py
7
1691
#! /usr/bin/env python import argparse import sys import textwrap from pandashells.lib import arg_lib, io_lib class OutStream(object): # pragma no cover """ This class exisist for easing testing of sys.stdout and doesn't need to be tested itself """ def __init__(self, template): self.te...
bsd-2-clause
hmendozap/auto-sklearn
autosklearn/ensembles/ensemble_selection.py
1
8074
from collections import Counter import random import numpy as np import six from autosklearn.constants import * from autosklearn.ensembles.abstract_ensemble import AbstractEnsemble from autosklearn.evaluation.util import calculate_score class EnsembleSelection(AbstractEnsemble): def __init__(self, ensemble_size...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/mpl_examples/units/bar_demo2.py
9
1062
""" plot using a variety of cm vs inches conversions. The example shows how default unit instrospection works (ax1), how various keywords can be used to set the x and y units to override the defaults (ax2, ax3, ax4) and how one can set the xlimits using scalars (ax3, current units assumed) or units (conversions applie...
mit
xzh86/scikit-learn
sklearn/utils/testing.py
84
24860
"""Testing utilities.""" # Copyright (c) 2011, 2012 # Authors: Pietro Berkes, # Andreas Muller # Mathieu Blondel # Olivier Grisel # Arnaud Joly # Denis Engemann # License: BSD 3 clause import os import inspect import pkgutil import warnings import sys import re import platf...
bsd-3-clause
benkirk/libmesh
doc/statistics/libmesh_mailinglists.py
1
9729
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np from operator import add # Import stuff for working with dates from datetime import datetime from matplotlib.dates import date2num, num2date # Number of messages to libmesh-devel and libmesh-users over the life # of the project. I cut and paste...
lgpl-2.1
eg-zhang/scikit-learn
sklearn/tests/test_kernel_ridge.py
342
3027
import numpy as np import scipy.sparse as sp from sklearn.datasets import make_regression from sklearn.linear_model import Ridge from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import pairwise_kernels from sklearn.utils.testing import ignore_warnings from sklearn.utils.testing import assert...
bsd-3-clause
alphaBenj/zipline
tests/test_api_shim.py
5
19179
import warnings from mock import patch import numpy as np import pandas as pd from pandas.core.common import PerformanceWarning from zipline import TradingAlgorithm from zipline.finance.trading import SimulationParameters from zipline.testing import ( MockDailyBarReader, create_daily_df_for_asset, create_...
apache-2.0
remenska/rootpy
rootpy/plotting/style/__init__.py
5
2962
# Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License from __future__ import absolute_import import ROOT from ... import log; log = log[__name__] from ... import asrootpy, QROOT from ...base import Object from ...extern.six import string_types __all__ = [ 'get_sty...
gpl-3.0
andrewnc/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
jeffery-do/Vizdoombot
doom/lib/python3.5/site-packages/dask/dataframe/tests/test_rolling.py
1
9749
import pandas as pd import pytest import numpy as np import dask.dataframe as dd from dask.dataframe.utils import assert_eq from dask.utils import ignoring def mad(x): return np.fabs(x - x.mean()).mean() def rolling_functions_tests(p, d): # Old-fashioned rolling API assert_eq(pd.rolling_count(p, 3), dd...
mit
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/mpl_examples/mplot3d/lorenz_attractor.py
3
1242
# Plot of the Lorenz Attractor based on Edward Lorenz's 1963 "Deterministic # Nonperiodic Flow" publication. # http://journals.ametsoc.org/doi/abs/10.1175/1520-0469%281963%29020%3C0130%3ADNF%3E2.0.CO%3B2 # # Note: Because this is a simple non-linear ODE, it would be more easily # done using SciPy's ode solver, bu...
mit
x75/actinf
active_inference_basic.py
1
80206
import argparse, cPickle, os, sys from collections import OrderedDict from functools import partial # mhm :) import numpy as np import pylab as pl import matplotlib.gridspec as gridspec import pandas as pd import explauto from explauto import Environment from explauto.environment import environments from explauto....
mit
trungnt13/scikit-learn
examples/tree/plot_tree_regression_multioutput.py
206
1800
""" =================================================================== Multi-output Decision Tree Regression =================================================================== An example to illustrate multi-output regression with decision tree. The :ref:`decision trees <tree>` is used to predict simultaneously the ...
bsd-3-clause
wasit7/cs402
randomForest_tutorials/_src_ncore_ntree/scdataset_spiral.py
1
3124
""" Created on Tue Oct 14 18:52:01 2014 @author: Wasit """ import numpy as np class dataset: def __init__(self): self.clmax=5 self.spc=100 self.dim_theta=2 self.size=self.clmax*self.spc #list of np.array self.I=np.zeros((2,self.size)) #samples first row is th...
mit
mspkvp/MiningOpinionTweets
src/lda_without_tf_idf_politics.py
1
3990
from __future__ import print_function from time import time import csv import sys import os from sklearn.feature_extraction.text import CountVectorizer import numpy as np import lda import logging logging.basicConfig(filename='lda_analyser.log', level=logging.DEBUG) entities = ['passos_coelho', 'jose_so...
mit
eramirem/astroML
book_figures/chapter10/fig_LINEAR_SVM.py
3
6143
""" SVM classification of LINEAR data --------------------------------- Figure 10.23 Supervised classification of periodic variable stars from the LINEAR data set using a support vector machines method. The training sample includes five input classes. The top row shows clusters derived using two attributes (g - i and ...
bsd-2-clause
lcharleux/compmod
doc/sandbox/awa/opti_compart_awa.py
1
7585
""" Compartimented optimization LC 13/05/2015 """ import numpy as np import matplotlib.pyplot as plt import compmod, abapy, platform from scipy import optimize, interpolate #------------------------------------------------------------------------------- # FUNCTIONS AND CLASSES def Saint_Venant(X): sy_mean = X[0] ...
gpl-2.0
nhejazi/scikit-learn
sklearn/mixture/dpgmm.py
5
35901
"""Bayesian Gaussian Mixture Models and Dirichlet Process Gaussian Mixture Models""" from __future__ import print_function # Author: Alexandre Passos (alexandre.tp@gmail.com) # Bertrand Thirion <bertrand.thirion@inria.fr> # # Based on mixture.py by: # Ron Weiss <ronweiss@gmail.com> # Fabian Ped...
bsd-3-clause
mjaquier/NestModelSimplification
modelfit.py
1
4674
import loading import numpy as np import cPickle as pickle from Experiment import * from GIF import * from AEC_Badel import * from AEC_Dummy import * from Filter_Rect_LinSpaced import * from Filter_Rect_LogSpaced import * from Filter_Exps import * from GIF_HT import * import seaborn class Fit(): def __init__(s...
mit
ryfeus/lambda-packs
Tensorflow_Pandas_Numpy/source3.6/pandas/io/packers.py
2
29027
""" Msgpack serializer support for reading and writing pandas data structures to disk portions of msgpack_numpy package, by Lev Givon were incorporated into this module (and tests_packers.py) License ======= Copyright (c) 2013, Lev Givon. All rights reserved. Redistribution and use in source and binary forms, with ...
mit
vigilv/scikit-learn
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_...
bsd-3-clause
jerryjiahaha/rts2
scripts/shiftfoc.py
3
3802
#!/usr/bin/python # # Autofocosing routines using shift-store. # # You will need: scipy matplotlib sextractor # This should work on Debian/ubuntu: # sudo apt-get install python-matplotlib python-scipy python-pyfits sextractor # # If you would like to see sextractor results, get DS9 and pyds9: # # http://hea-www.harvard...
lgpl-3.0
robin-lai/scikit-learn
examples/covariance/plot_mahalanobis_distances.py
348
6232
r""" ================================================================ Robust covariance estimation and Mahalanobis distances relevance ================================================================ An example to show covariance estimation with the Mahalanobis distances on Gaussian distributed data. For Gaussian dis...
bsd-3-clause
mlyundin/scikit-learn
sklearn/metrics/cluster/bicluster.py
359
2797
from __future__ import division import numpy as np from sklearn.utils.linear_assignment_ import linear_assignment from sklearn.utils.validation import check_consistent_length, check_array __all__ = ["consensus_score"] def _check_rows_and_columns(a, b): """Unpacks the row and column arrays and checks their shap...
bsd-3-clause
Universal-Model-Converter/UMC3.0a
data/Python/x86/Lib/site-packages/numpy/lib/function_base.py
3
115310
__docformat__ = "restructuredtext en" __all__ = ['select', 'piecewise', 'trim_zeros', 'copy', 'iterable', 'percentile', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfin...
mit
JosmanPS/scikit-learn
sklearn/linear_model/logistic.py
105
56686
""" Logistic Regression """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # Fabian Pedregosa <f@bianp.net> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Manoj Kumar <manojkumarsivaraj334@gmail.com> # Lars Buitinck # Simon Wu <s8wu@uwaterloo.ca> imp...
bsd-3-clause
rajul/mne-python
mne/tests/test_source_space.py
9
23354
from __future__ import print_function import os import os.path as op from nose.tools import assert_true, assert_raises from nose.plugins.skip import SkipTest import numpy as np from numpy.testing import assert_array_equal, assert_allclose, assert_equal import warnings from mne.datasets import testing from mne import ...
bsd-3-clause
Phil9l/cosmos
code/quantum_algorithms/grover's_algorithm/P1_grover_plot.py
2
2177
### Imports required for this solution import matplotlib.pyplot as plot import numpy as NP import hashlib from math import sqrt, pi from collections import OrderedDict from statistics import mean ############### ### PlotGraph(n, amplitude): Plots the graph for target value with the highest amplitude. def PlotGraph(...
gpl-3.0
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/pandas/tseries/tests/test_daterange.py
9
26349
from datetime import datetime from pandas.compat import range import nose import numpy as np from pandas.core.index import Index from pandas.tseries.index import DatetimeIndex from pandas import Timestamp from pandas.tseries.offsets import generate_range from pandas.tseries.index import cdate_range, bdate_range, date...
apache-2.0
girish946/plot-cat
setup.py
1
1808
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup description = ''' plot-cat is the python library for plotting live serial input. plotcat works on python 2.7 and later. plotcat comes handy when you want to plot live data that is coming form different sensors over the serial port, ...
gpl-3.0
cyrusmaher/mosaic
mosaic_example.py
1
7009
import sys import re import os import mosaic from Bio import AlignIO import pandas as pd def specfunc(name): specieslist_ca = [ ['(CCDS|hg19|Homo_sapiens)', 'Hom'], ['(ENSPTR|Pan|Pan_troglodytes)', 'Pan'], ['(ENSGGO|Gor|Gorilla_gorilla)', 'Gor'], ['(ENSPPY|Pon|Pongo_abelii)', 'Pon'...
mit
mikekestemont/tag
tag/tagger.py
1
35876
from __future__ import print_function import os import shutil import ConfigParser from operator import itemgetter import cPickle as pickle from sklearn.preprocessing import LabelEncoder import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! import matplotlib.pyplot as plt import...
mit
Adai0808/scikit-learn
examples/hetero_feature_union.py
288
6236
""" ============================================= Feature Union with Heterogeneous Data Sources ============================================= Datasets can often contain components of that require different feature extraction and processing pipelines. This scenario might occur when: 1. Your dataset consists of hetero...
bsd-3-clause
JeffreyFish/DocWebTool
DocTracking.py
2
9018
#!/usr/bin/env python # -*- Coding: UTF-8 -*- #------------------------------------ #--Author: Lychee Li #--CreationDate: 2017/10/18 #--RevisedDate: 2017/10/27 #--RevisedDate: 2018/03/12 #------------------------------------ import datetime import pyodbc import common import pandas as pd # 读取SQL代码 with...
gpl-3.0
lucval/dmm-ns-3.17
src/flow-monitor/examples/wifi-olsr-flowmon.py
108
7439
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
gpl-2.0
feilchenfeldt/pypopgen
modules/genotypemat.py
1
1245
import gc import numpy as np import pandas as pd def pairwise_diff_numpy(gen_arr): """Squared pairwise distances between all columns of 0,1,2 genotype array arr. This matrix based function is at least 10 times faster than iterating over columns. """ gen_arr = gen_arr.astype(np.float64)-1 ...
mit
echanna/EdxNotAFork
docs/en_us/developers/source/conf.py
10
6880
# -*- coding: utf-8 -*- # pylint: disable=C0103 # pylint: disable=W0622 # pylint: disable=W0212 # pylint: disable=W0613 import sys, os from path import path on_rtd = os.environ.get('READTHEDOCS', None) == 'True' sys.path.append('../../../../') from docs.shared.conf import * # Add any paths that contain template...
agpl-3.0
schmidtc/pysal
pysal/spreg/opt.py
8
2370
import copy def simport(modname): """ Safely import a module without raising an error. Parameters ----------- modname : str module name needed to import Returns -------- tuple of (True, Module) or (False, None) depending on whether the import succeeded. Not...
bsd-3-clause
idealabasu/code_pynamics
python/pynamics_examples/springy_pendulum.py
1
2902
# -*- coding: utf-8 -*- """ Written by Daniel M. Aukes Email: danaukes<at>gmail.com Please see LICENSE for full license. """ import pynamics pynamics.script_mode = False from pynamics.frame import Frame from pynamics.variable_types import Differentiable,Constant from pynamics.system import System from pynamics.body i...
mit
MJuddBooth/pandas
pandas/tests/frame/test_api.py
1
18686
# -*- coding: utf-8 -*- from __future__ import print_function # pylint: disable-msg=W0612,E1101 from copy import deepcopy import pydoc import numpy as np import pytest from pandas.compat import PY2, long, lrange, range import pandas as pd from pandas import ( Categorical, DataFrame, Series, SparseDataFrame, co...
bsd-3-clause
lifuhuang/critic
hotels/tf_demo.py
1
3255
# -*- coding: utf-8 -*- """ Created on Sat May 7 09:51:35 2016 @author: lifu """ import numpy as np import tensorflow as tf batch_size=50 X_train = np.random.randn(50, 200) y_train = np.random.randint(0, 3, 50) W = tf.Variable(tf.random_normal([200, 3]), name='weight') b = tf.Variable(tf.zeros([1, 3]), name='bias'...
gpl-3.0
SaganBolliger/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/table.py
69
16757
""" Place a table below the x-axis at location loc. The table consists of a grid of cells. The grid need not be rectangular and can have holes. Cells are added by specifying their row and column. For the purposes of positioning the cell at (0, 0) is assumed to be at the top left and the cell at (max_row, max_col) i...
agpl-3.0
patelrajnath/rnn4nlp
metrics/pos_eval.py
1
1915
from __future__ import division import codecs from sklearn.metrics import f1_score import logging, sys def read_tag_file(filename): with codecs.open(filename) as tagfile: tags_by_line = [l.strip().split() for l in tagfile] return tags_by_line def weighted_fmeasure(y_true, y_pred): return f1_score...
gpl-3.0
ueshin/apache-spark
python/pyspark/pandas/tests/test_series.py
9
118972
# # 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 us...
apache-2.0
theoryno3/scikit-learn
examples/applications/plot_tomography_l1_reconstruction.py
204
5442
""" ====================================================================== Compressive sensing: tomography reconstruction with L1 prior (Lasso) ====================================================================== This example shows the reconstruction of an image from a set of parallel projections, acquired along dif...
bsd-3-clause
bnaul/scikit-learn
examples/miscellaneous/plot_display_object_visualization.py
17
3676
""" =================================== Visualizations with Display Objects =================================== .. currentmodule:: sklearn.metrics In this example, we will construct display objects, :class:`ConfusionMatrixDisplay`, :class:`RocCurveDisplay`, and :class:`PrecisionRecallDisplay` directly from their resp...
bsd-3-clause
espiritocz/giSAR
remot_watch.py
1
23679
# -*- coding: utf-8 -*- """ /*************************************************************************** Remotwatch A QGIS plugin This plugin is for visualize and manipulate points from Stamps and SAR PROZ Processing ------------------- beg...
gpl-3.0
slundberg/shap
tests/explainers/test_sampling.py
1
1484
""" Unit tests for the Sampling explainer. """ # pylint: disable=missing-function-docstring import numpy as np import pytest import shap def test_null_model_small(): explainer = shap.SamplingExplainer(lambda x: np.zeros(x.shape[0]), np.ones((2, 4)), nsamples=100) shap_values = explainer.shap_values(np.ones(...
mit
abonaca/gary
docs/_code/examples.py
1
1060
import astropy.units as u import matplotlib.pyplot as plt from matplotlib import cm import numpy as np import gary.potential as sp import gary.integrate as si from gary.units import galactic # integrate & potential example v_c = (200*u.km/u.s).decompose(galactic).value potential = sp.SphericalNFWPotential(v_c=v_c, r_s...
mit
sergio2pi/NeuroDB
test/test5.py
1
2324
''' Created on Oct 21, 2014 @author: sergio ''' import numpy as np import ctypes import numpy.ctypeslib as npct import matplotlib.pyplot as plt #cfsfd = ctypes.cdll.LoadLibrary('/home/sergio/iibm/sandbox/t.so') #cfsfd.get_dc.restype = ctypes.c_float #dc = cfsfd.get_dc("dbname=demo host=192.168.2.2 user=postgres pass...
gpl-2.0
alvarofierroclavero/scikit-learn
sklearn/datasets/species_distributions.py
198
7923
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/pandas/tests/io/parser/header.py
6
9126
# -*- coding: utf-8 -*- """ Tests that the file header is properly handled or inferred during parsing for all of the parsers defined in parsers.py """ import pytest import numpy as np import pandas.util.testing as tm from pandas import DataFrame, Index, MultiIndex from pandas.compat import StringIO, lrange, u cla...
mit
sniemi/SamPy
sandbox/src1/examples/tex_demo.py
1
1036
#!/usr/bin/env python """ You can use TeX to render all of your matplotlib text if the rc parameter text.usetex is set. This works currently on the agg and ps backends, and requires that you have tex and the other dependencies described at http://matplotlib.sf.net/matplotlib.texmanager.html properly installed on your ...
bsd-2-clause
roxyboy/scikit-learn
examples/hetero_feature_union.py
288
6236
""" ============================================= Feature Union with Heterogeneous Data Sources ============================================= Datasets can often contain components of that require different feature extraction and processing pipelines. This scenario might occur when: 1. Your dataset consists of hetero...
bsd-3-clause
hyperion-rt/paper-galaxy-rt-model
scripts/groups.py
1
1230
from matplotlib.colors import ColorConverter def group(spectral_type): if 'AGB' in spectral_type: return 2 elif 'III' in spectral_type: return 3 elif 'V' in spectral_type: return 4 elif 'YOUNG OB' in spectral_type: return 4 elif 'TAURI' in spectral_type: re...
bsd-2-clause
fbagirov/scikit-learn
examples/neighbors/plot_classification.py
287
1790
""" ================================ Nearest Neighbors Classification ================================ Sample usage of Nearest Neighbors classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColorm...
bsd-3-clause
mitdrc/pronto
motion_estimate/scripts/republish_multisense_state.py
2
1128
#!/usr/bin/python # MIT uses hokuyo_joint # other teams use motor_joint, rename here import os,sys import lcm import time from lcm import LCM from math import * import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab from threading import Thread import threading home_dir =os.getenv("HOME")...
lgpl-2.1
brian-team/brian2cuda
dev/benchmarks/results_2017_11_30_cuba_stdp/cuba_stdp/run_speed_test_script.py
1
18566
import os import shutil import glob import subprocess import sys import socket # run tests without X-server import matplotlib matplotlib.use('Agg') # pretty plots import seaborn import time import datetime import cPickle as pickle from brian2 import * from brian2.tests.features import * from brian2.tests.features.b...
gpl-2.0
earlew/earlew.github.io
markdown_generator/publications.py
197
3887
# coding: utf-8 # # Publications markdown generator for academicpages # # Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook, with the core python code in publications.py. Run either from the `markdown_g...
mit
spallavolu/scikit-learn
examples/linear_model/plot_sgd_separating_hyperplane.py
260
1219
""" ========================================= SGD: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a linear Support Vector Machines classifier trained using SGD. """ print(__doc__) import numpy as n...
bsd-3-clause
JackKelly/neuralnilm_prototype
scripts/e241.py
2
5806
from __future__ import print_function, division import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import crossentropy, mse...
mit
abhishekgahlot/scikit-learn
sklearn/manifold/isomap.py
36
7119
"""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
jbest/digitization_tools
productivity/productivity.py
1
6643
""" Imaging productivity stats Jason Best - jbest@brit.org Generates a productivity report based on the creation timestamps of image files. Details of the imaging session are extracted from the folder name containing the images. Assumed folder name format is: YYYY-MM-DD_ImagerID_OtherInfo Usage: python productivity.p...
mit
clemkoa/scikit-learn
examples/plot_johnson_lindenstrauss_bound.py
39
7489
r""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected i...
bsd-3-clause
openeemeter/eemeter
tests/test_io.py
1
10485
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2014-2019 OpenEEmeter contributors 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/LIC...
apache-2.0
Obus/scikit-learn
examples/text/document_classification_20newsgroups.py
222
10500
""" ====================================================== 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
ethen8181/machine-learning
ga/tsp_solver/tspga.py
1
8343
import random import numpy as np import pandas as pd import matplotlib.pyplot as plt from collections import namedtuple from itertools import combinations class TSPGA(object): """ Travel Salesman Problem using Genetic Algorithm Parameters ---------- generation : int number of iteration to train the algorithm ...
mit
PatrickChrist/scikit-learn
examples/svm/plot_custom_kernel.py
171
1546
""" ====================== SVM with custom kernel ====================== Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface and the support vectors. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets # import some data...
bsd-3-clause
tomasreimers/tensorflow-emscripten
tensorflow/contrib/learn/python/learn/learn_io/__init__.py
37
2375
# 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
tioover/naprock
run.py
1
1993
import os import matplotlib.image as mpimg from lib import split_and_save, is_windows, remove from mark import marker from config import player_id, server, raw_problem_filename def main(problem_id): print("Get Problem...") problem_id = input("Input Problem ID (default %s): " % problem_id) or problem_id ...
gpl-2.0
toobaz/pandas
pandas/tests/tslibs/test_fields.py
1
1144
import numpy as np from pandas._libs.tslibs import fields import pandas.util.testing as tm def test_fields_readonly(): # https://github.com/vaexio/vaex/issues/357 # fields functions should't raise when we pass read-only data dtindex = np.arange(5, dtype=np.int64) * 10 ** 9 * 3600 * 24 * 32 dtindex....
bsd-3-clause
sampathweb/bayes_hack
bayes-hack-app/app/blueprints/pred_model.py
1
8726
from flask import g import sklearn.ensemble import sklearn as skl import numpy as np import pandas as pd import pylab as pl import cPickle def project_data(db_engine, fn='opendata_projects.csv'): return pd.read_csv(fn, parse_dates=['date_expiration','date_thank_you_packet_mailed', ...
mit
fedspendingtransparency/data-act-broker-backend
dataactvalidator/scripts/load_tas.py
1
12283
from collections import defaultdict import os import logging import argparse from datetime import datetime, timezone import json import pandas as pd import boto3 from dataactcore.config import CONFIG_BROKER from dataactcore.interfaces.db import GlobalDB from dataactcore.logging import configure_logging from dataactco...
cc0-1.0
Unidata/MetPy
v0.6/_downloads/Hodograph_Inset.py
1
2534
# Copyright (c) 2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Hodograph Inset =============== Layout a Skew-T plot with a hodograph inset into the plot. """ import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import...
bsd-3-clause
moosekaka/sweepython
tubule_het/plt_lineseries/Dist_DY_OneEdgeCell.py
1
4023
# -*- coding: utf-8 -*- """ Created on Sun Jul 05 22:14:07 2015 plot ONE EDGE of ONE CELL, run the commented lines below main block to generate the distributions first @author: sweel """ # pylint: disable=C0103 import matplotlib.pyplot as plt import seaborn as sns import numpy as np import cPickle as pickle sns.set_con...
mit
Naereen/notebooks
simus/Des_dates_qui_font_des_nombres_premiers.py
1
13116
# coding: utf-8 # # Des dates qui font des nombres premiers ? # # Ce petit [notebook Jupyter](https://www.jupyter.org/), écrit en [Python](https://www.python.org/), a pour but de résoudre la question suivante : # # > *"En 2017, combien de jours ont leur date qui est un nombre premier ?"* # # Par exemple, en 2017, ...
mit
anntzer/scikit-learn
examples/linear_model/plot_lasso_lars.py
23
1048
#!/usr/bin/env python """ ===================== Lasso path using LARS ===================== Computes Lasso Path along the regularization parameter using the LARS algorithm on the diabetes dataset. Each color represents a different feature of the coefficient vector, and this is displayed as a function of the regulariza...
bsd-3-clause
CSB-IG/non-coding-NGS
paired_linguistic_group_jaccard_indexes.py
1
1567
import matplotlib matplotlib.use('svg') matplotlib.rcParams.update({'font.size': 8}) from matplotlib import pyplot as plt import numpy as np from matplotlib_venn import venn2 from sample_code_file_maps import * from itertools import combinations # computes jacard index for two or mor sets def jaccard_index(first, *o...
gpl-3.0
lancezlin/ml_template_py
lib/python2.7/site-packages/sklearn/preprocessing/tests/test_label.py
40
18519
import numpy as np from scipy.sparse import issparse from scipy.sparse import coo_matrix from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import dok_matrix from scipy.sparse import lil_matrix from sklearn.utils.multiclass import type_of_target from sklearn.utils.testing impor...
mit
sinhrks/scikit-learn
sklearn/linear_model/tests/test_sgd.py
8
44274
import pickle import unittest import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing ...
bsd-3-clause
beiko-lab/gengis
bin/Lib/site-packages/mpl_toolkits/mplot3d/axis3d.py
6
16960
#!/usr/bin/python # axis3d.py, original mplot3d version by John Porter # Created: 23 Sep 2005 # Parts rewritten by Reinier Heeres <reinier@heeres.eu> import math import copy from matplotlib import lines as mlines, axis as maxis, \ patches as mpatches import art3d import proj3d import numpy as np def get_fli...
gpl-3.0
ilo10/scikit-learn
examples/decomposition/plot_pca_iris.py
253
1801
#!/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
saketkc/statsmodels
statsmodels/sandbox/tsa/garch.py
25
52178
'''general non-linear MLE for time series analysis idea for general version ------------------------ subclass defines geterrors(parameters) besides loglike,... and covariance matrix of parameter estimates (e.g. from hessian or outerproduct of jacobian) update: I don't really need geterrors directly, but get_h the con...
bsd-3-clause
droundy/deft
talks/colloquium/figs/sphere-energy.py
1
1500
#!/usr/bin/python # We need the following two lines in order for matplotlib to work # without access to an X server. from __future__ import division import matplotlib matplotlib.use('Agg') import pylab, numpy, sys mNpermeter = 6.4230498e-07 # in atomic units nm = 18.8972613 # in atomic units angstrom = 0.1*nm spced...
gpl-2.0
andersgs/kraken-trawl
kraken_trawl/kraken_trawl.py
1
19736
from __future__ import print_function ''' Expects a environmental variable called ASPERA_KEY ''' import click import os import subprocess import pandas as pd import re import shlex import gzip from Bio import SeqIO from Bio import Entrez import tempfile import sys import pkg_resources ### SOME CONSTANTS #############...
gpl-3.0