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 |
|---|---|---|---|---|---|
tody411/InverseToon | inversetoon/core/light_estimation/light_estimation_lumo.py | 1 | 1797 | # -*- coding: utf-8 -*-
## @package inversetoon.core.light_estimation.light_estimation_lumo
#
# inversetoon.core.light_estimation.light_estimation_lumo utility package.
# @author tody
# @date 2015/10/04
import numpy as np
import matplotlib.pyplot as plt
from inversetoon.core.lumo import lumoNormal
from... | mit |
alishakiba/kaggle-ndsb | create_submission.py | 6 | 3548 | import os
import sys
import numpy as np
import pandas as pd
import data
if len(sys.argv) != 2:
sys.exit("Usage: create_submissions.py <predictions_path>")
predictions_path = sys.argv[1]
filename = os.path.splitext(os.path.basename(predictions_path))[0]
target_path = "submissions/%s.csv" % filename
header = "ac... | mit |
infilect/ml-course1 | deep-learning-tensorflow/week1/tensorflow-basics/examples/ex4_linear_regression_problem.py | 3 | 1648 | """
Simple linear regression example in TensorFlow
This program tries to predict the number of thefts from
the number of fire in the city of Chicago
"""
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import xlrd
DATA_FILE = 'data/fire_theft.xls'
# Phase 1: Assemble the graph
# Step 1: re... | mit |
wxchan/LightGBM | examples/python-guide/simple_example.py | 4 | 1416 | # coding: utf-8
# pylint: disable = invalid-name, C0111
import json
import lightgbm as lgb
import pandas as pd
from sklearn.metrics import mean_squared_error
# load or create your dataset
print('Load data...')
df_train = pd.read_csv('../regression/regression.train', header=None, sep='\t')
df_test = pd.read_csv('../re... | mit |
dclambert/Python-ELM | random_layer.py | 11 | 18828 | #-*- coding: utf8
# Author: David C. Lambert [dcl -at- panix -dot- com]
# Copyright(c) 2013
# License: Simple BSD
"""The :mod:`random_layer` module
implements Random Layer transformers.
Random layers are arrays of hidden unit activations that are
random functions of input activation values (dot products for simple
ac... | bsd-3-clause |
hitszxp/scikit-learn | sklearn/decomposition/tests/test_dict_learning.py | 40 | 7535 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises
... | bsd-3-clause |
dungvtdev/upsbayescpm | bayespy/demos/annealing.py | 5 | 3332 | ################################################################################
# Copyright (C) 2015 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
"""
Demonstration of deterministic annealing.
Deterministic annealing... | mit |
Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/site-packages/numpy/lib/npyio.py | 9 | 66535 | from __future__ import division, absolute_import, print_function
import sys
import os
import re
import itertools
import warnings
import weakref
from operator import itemgetter
import numpy as np
from . import format
from ._datasource import DataSource
from ._compiled_base import packbits, unpackbits
from ._iotools im... | gpl-3.0 |
kazemakase/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 |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/util/test_deprecate_kwarg.py | 2 | 2047 | import pytest
from pandas.util._decorators import deprecate_kwarg
import pandas.util.testing as tm
@deprecate_kwarg("old", "new")
def _f1(new=False):
return new
_f2_mappings = {"yes": True, "no": False}
@deprecate_kwarg("old", "new", _f2_mappings)
def _f2(new=False):
return new
def _f3_mapping(x):
... | apache-2.0 |
petosegan/scikit-learn | sklearn/svm/tests/test_sparse.py | 95 | 12156 | from nose.tools import assert_raises, assert_true, assert_false
import numpy as np
from scipy import sparse
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
from sklearn import datasets, svm, linear_model, base
from sklearn.datasets import make_classif... | bsd-3-clause |
mahak/spark | python/pyspark/pandas/tests/plot/test_frame_plot.py | 15 | 4733 | #
# 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 |
csrhau/sandpit | latex/enron_report/scripts/message_distribution.py | 1 | 1684 | #!/usr/bin/env python3
""" A simple parser for the Enron e-mail corpus """
import argparse
import json
import operator
import dateutil.parser
import itertools
import pandas as pd
from collections import Counter
def process_arguments():
""" Process command line arguments """
parser = argparse.ArgumentParser(d... | mit |
stephenhky/PyShortTextCategorization | shorttext/classifiers/bow/topic/SkLearnClassification.py | 1 | 17751 |
import os
import joblib
from shorttext.utils import textpreprocessing as textpreprocess
from shorttext.generators import load_autoencoder_topicmodel, load_gensimtopicmodel
from shorttext.generators import LDAModeler, LSIModeler, RPModeler, AutoencodingTopicModeler
import shorttext.utils.classification_exceptions as ... | mit |
Clyde-fare/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 |
gfrd/egfrd | samples/irreversible/plot.py | 3 | 2672 | #!/usr/bin/python
#
# Make sure that the egfrd system is added to your PYTHONPATH
# This means, in bash for example:
# $ export PYTHONPATH=$HOME/egfrd
#
# python plot.py irr.-2.out 0.000000125 irr.-1.out 0.00000125 irr.0.out 0.0000125 irr.1.out 0.000125 irr.2.out 0.00125 irr.3.out 0.0125
# irr.-3.out 0.0000000125... | gpl-2.0 |
Lyleo/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/scale.py | 69 | 13414 | import textwrap
import numpy as np
from numpy import ma
MaskedArray = ma.MaskedArray
from cbook import dedent
from ticker import NullFormatter, ScalarFormatter, LogFormatterMathtext, Formatter
from ticker import NullLocator, LogLocator, AutoLocator, SymmetricalLogLocator, FixedLocator
from transforms import Transform,... | gpl-3.0 |
herilalaina/scikit-learn | sklearn/gaussian_process/gpc.py | 13 | 32112 | """Gaussian processes classification."""
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import warnings
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve, solve
from scipy.optimize import fmin_l_bfgs_b
from scipy.special import erf... | bsd-3-clause |
sentinelsat/sentinelsat | sentinelsat/sentinel.py | 1 | 64772 | import concurrent.futures
import hashlib
import itertools
import logging
import re
import shutil
import threading
import warnings
import xml.etree.ElementTree as ET
from collections import OrderedDict, defaultdict, namedtuple
from datetime import date, datetime, timedelta
from pathlib import Path
from typing import Any... | gpl-3.0 |
costypetrisor/scikit-learn | sklearn/svm/setup.py | 321 | 3157 | import os
from os.path import join
import numpy
from sklearn._build_utils import get_blas_info
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('svm', parent_package, top_path)
config.add_subpackage('tests')
# Section L... | bsd-3-clause |
krez13/scikit-learn | sklearn/decomposition/tests/test_pca.py | 21 | 11810 | import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_rai... | bsd-3-clause |
sfepy/sfepy | examples/diffusion/poisson_parallel_interactive.py | 4 | 19203 | #!/usr/bin/env python
r"""
Parallel assembling and solving of a Poisson's equation, using commands for
interactive use.
Find :math:`u` such that:
.. math::
\int_{\Omega} \nabla v \cdot \nabla u
= \int_{\Omega} v f
\;, \quad \forall s \;.
Important Notes
---------------
- This example requires petsc4py, ... | bsd-3-clause |
bigdataelephants/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 |
JohnKendrick/PDielec | PDielec/GUI/FitterTab.py | 1 | 35877 | # -*- coding: utf8 -*-
import os.path
import numpy as np
import PDielec.Calculator as Calculator
from PyQt5.QtWidgets import QPushButton, QWidget
from PyQt5.QtWidgets import QComboBox, QLabel, QLineEdit, QDoubleSpinBox
from PyQt5.QtWidgets import QVBoxLayout, QHBoxLayout, QFormLayout
from PyQt5.QtWidgets imp... | mit |
judithfan/pix2svg | generative/tests/compare_test/sketch_unroll/train_sketch.py | 1 | 9476 | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import shutil
import numpy as np
from tqdm import tqdm
import torch
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from model_sketch impor... | mit |
hammerlab/immuno | immuno/maf.py | 1 | 2903 | #!/usr/bin/env python
# Copyright (c) 2014. Mount Sinai School of Medicine
#
# 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 requi... | apache-2.0 |
andrewnc/scikit-learn | sklearn/__init__.py | 59 | 3038 | """
Machine learning module for Python
==================================
sklearn is a Python module integrating classical machine
learning algorithms in the tightly-knit world of scientific Python
packages (numpy, scipy, matplotlib).
It aims to provide simple and efficient solutions to learning problems
that are acc... | bsd-3-clause |
alphacsc/alphacsc | alphacsc/other/sporco/sporco/tests/test_plot.py | 1 | 3328 | from __future__ import division
from builtins import object
import pytest
import matplotlib
matplotlib.use('Agg')
import numpy as np
from sporco import plot
from sporco import util
# Monkey patch in_ipython and in_notebook functions to allow testing of
# functions that depend on these tests
def in_ipython():
re... | bsd-3-clause |
zorojean/scikit-learn | examples/ensemble/plot_gradient_boosting_quantile.py | 392 | 2114 | """
=====================================================
Prediction Intervals for Gradient Boosting Regression
=====================================================
This example shows how quantile regression can be used
to create prediction intervals.
"""
import numpy as np
import matplotlib.pyplot as plt
from skle... | bsd-3-clause |
BhallaLab/moose-examples | tutorials/Electrophys/ephys5_channel_mixer.py | 2 | 10372 | ########################################################################
# This example demonstrates the behaviour of various voltage and calcium-
# gated channels.
# Copyright (C) Upinder S. Bhalla NCBS 2018
# Released under the terms of the GNU Public License V3.
######################################################... | gpl-2.0 |
vascotenner/holoviews | holoviews/plotting/mpl/tabular.py | 1 | 5312 | from collections import defaultdict
from matplotlib.font_manager import FontProperties
from matplotlib.table import Table as mpl_Table
import param
from .element import ElementPlot
from ...core.util import safe_unicode
class TablePlot(ElementPlot):
"""
A TablePlot can plot both TableViews and ViewMaps which... | bsd-3-clause |
COMBINE-lab/piquant | piquant/assemble_quantification_data.py | 1 | 5070 | #!/usr/bin/env python
"""Usage:
assemble_quantification_data [{log_option_spec}] --method=<quantification-method> --out=<output-file> <pro-file> <transcript-count-file> <unique-sequence-file>
{help_option_spec} {help_option_description}
{ver_option_spec} {ver_option_description}... | mit |
kylerbrown/scikit-learn | sklearn/linear_model/randomized_l1.py | 95 | 23365 | """
Randomized Lasso/Logistic: feature selection based on Lasso and
sparse Logistic Regression
"""
# Author: Gael Varoquaux, Alexandre Gramfort
#
# License: BSD 3 clause
import itertools
from abc import ABCMeta, abstractmethod
import warnings
import numpy as np
from scipy.sparse import issparse
from scipy import spar... | bsd-3-clause |
OpenPHDGuiding/phd2 | contributions/MPI_IS_gaussian_process/tools/plot_gp_data.py | 1 | 1589 | #!/usr/bin/env python
from numpy import genfromtxt
import matplotlib.pyplot as plt
def read_data():
measurement_data = genfromtxt('measurement_data.csv', delimiter=',') # read GP data from csv
measurement_data = measurement_data[1:,:] # strip first line to remove header text
location = measure... | bsd-3-clause |
mhue/scikit-learn | sklearn/metrics/cluster/__init__.py | 312 | 1322 | """
The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for
cluster analysis results. There are two forms of evaluation:
- supervised, which uses a ground truth class values for each sample.
- unsupervised, which does not and measures the 'quality' of the model itself.
"""
from .supervised import ... | bsd-3-clause |
fspaolo/scikit-learn | examples/neighbors/plot_classification.py | 8 | 1769 | """
================================
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 pylab as pl
from matplotlib.colors import ListedColormap
from sklea... | bsd-3-clause |
anntzer/scikit-learn | sklearn/manifold/_locally_linear.py | 2 | 27264 | """Locally Linear Embedding"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) INRIA 2011
import numpy as np
from scipy.linalg import eigh, svd, qr, solve
from scipy.sparse import eye, csr_matrix
from scipy.sparse.li... | bsd-3-clause |
midnightradio/gensim | gensim/sklearn_api/tfidf.py | 3 | 6995 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Scikit-learn interface for :class:`~gensim.models.tfidfmodel.TfidfModel`.
Follows scikit-learn API conventions to facilitate using g... | gpl-3.0 |
ursk/sparco | sparco/sptools.py | 1 | 5818 | """
some random tools, slow code.
"""
import collections
import imp
import os
import time
import types
import numpy as np
import scipy.signal as signal
import sparco.mpi as mpi
###################################
########### OBJECTIVE
###################################
# TODO give more generic names, move
def obj... | gpl-2.0 |
giorgiop/scikit-learn | sklearn/datasets/mlcomp.py | 289 | 3855 | # Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
"""Glue code to load http://mlcomp.org data as a scikit.learn dataset"""
import os
import numbers
from sklearn.datasets.base import load_files
def _load_document_classification(dataset_path, metadata, set_=None, **kwargs):
if ... | bsd-3-clause |
RomainBrault/scikit-learn | doc/sphinxext/sphinx_gallery/gen_rst.py | 23 | 20990 | # -*- coding: utf-8 -*-
# Author: Óscar Nájera
# License: 3-clause BSD
"""
==================
RST file generator
==================
Generate the rst files for the examples by iterating over the python
example files.
Files that generate images should start with 'plot'
"""
# Don't use unicode_literals here (be explici... | bsd-3-clause |
airbnb/superset | superset/utils/pandas_postprocessing.py | 1 | 26283 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
rwth-ti/gr-ofdm | apps/benchmarking/plot_results.py | 1 | 4850 | #!/usr/bin/env python
import numpy
import re
import cPickle as pickle
import operator
import matplotlib.pyplot as plt
from argparse import ArgumentParser
width = 0.4
def add_argparser():
parser = ArgumentParser(description='Benchmarking tool for GR flowgraphs')
parser.add_argument('-f', '--file', type=str, d... | gpl-3.0 |
RayMick/scikit-learn | sklearn/metrics/tests/test_regression.py | 272 | 6066 | from __future__ import division, print_function
import numpy as np
from itertools import product
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.... | bsd-3-clause |
asoliveira/NumShip | scripts/plot/leme-velo-v-cg-plt.py | 1 | 2018 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#É adimensional?
adi = False
#É para salvar as figuras(True|False)?
save = True
#Caso seja para salvar, qual é o formato desejado?
formato = 'jpg'
#Caso seja para salvar, qual é o diretório que devo salvar?
dircg = 'fig-sen'
#Caso seja para salvar, qual é o nome do arquivo... | gpl-3.0 |
stulp/dmpbbo | python/dmp_bbo/tasks/TaskViapoint.py | 1 | 7006 | # This file is part of DmpBbo, a set of libraries and programs for the
# black-box optimization of dynamical movement primitives.
# Copyright (C) 2018 Freek Stulp
#
# DmpBbo is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free... | lgpl-2.1 |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_decoding_csp_space.py | 9 | 3982 | """
====================================================================
Decoding in sensor space data using the Common Spatial Pattern (CSP)
====================================================================
Decoding applied to MEG data in sensor space decomposed using CSP.
Here the classifier is applied to feature... | bsd-3-clause |
phdowling/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 244 | 9986 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
cklb/PyMoskito | pymoskito/examples/ballbeam/lagrange.py | 1 | 2538 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 04 20:28:06 2014
Lagrange formalism
@author: Topher
"""
import sympy as sp
from sympy import sin,cos,Function
t = sp.Symbol('t')
params = sp.symbols('M , G , J , J_ball , R')
M , G , J , J_ball , R = params
# ball position r
r_t = Function('r')(t)
d_r_t = r_t.diff(t)
... | bsd-3-clause |
jco44/UdacityDataAnalysis | dataworkflow/visualize.py | 1 | 9301 | import pandas as pd
from matplotlib.pyplot import ylabel
def freq1_display(series):
'''Displays freq tables for analyzing a categorical feature
returns
-----------
1. Freq table w/ Counts
2. Freq table w/ vals as a percent of total'''
table = pd.crosstab(index=series,
c... | mit |
kelseyoo14/Wander | venv_2_7/lib/python2.7/site-packages/pandas/tests/test_panel.py | 9 | 92205 | # -*- coding: utf-8 -*-
# pylint: disable=W0612,E1101
from datetime import datetime
from inspect import getargspec
import operator
import nose
from functools import wraps
import numpy as np
import pandas as pd
from pandas import Series, DataFrame, Index, isnull, notnull, pivot, MultiIndex
from pandas.core.datetools ... | artistic-2.0 |
65apps/omim | search/search_quality/scoring_model.py | 2 | 5521 | #!/usr/bin/env python3
from math import exp, log
from sklearn import cross_validation, grid_search, svm
import argparse
import collections
import itertools
import numpy as np
import pandas as pd
import sys
FEATURES = ['DistanceToPivot', 'Rank', 'NameScore', 'NameCoverage', 'SearchType']
MAX_DISTANCE_METERS = 2e7
MAX... | apache-2.0 |
jamesp/Isca | src/extra/python/scripts/vert_coord_options.py | 4 | 3719 | import numpy as np
import matplotlib.pyplot as plt
def even_sigma_calc(num_levels):
"The even sigma calculation just divides the atmosphere up into equal sigma increments between 1 and 0. So the height of the model is really set by your number of levels, as the higher the number of levels you have, the smaller your... | gpl-3.0 |
wdurhamh/statsmodels | statsmodels/sandbox/survival2.py | 35 | 17924 | #Kaplan-Meier Estimator
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
from scipy import stats
from statsmodels.iolib.table import SimpleTable
class KaplanMeier(object):
"""
KaplanMeier(...)
KaplanMeier(data, endog, exog=None, censoring=None)
Create an object of... | bsd-3-clause |
gasabr/AtoD | atod/tests/test_hero.py | 1 | 3082 | #!/usr/bin/env python3
import unittest
import pandas as pd
from atod.models.hero import camel2python
from atod import Hero
class TestHero(unittest.TestCase):
def setUp(self):
''' Creates 2 Shadow Fiends to test methods. '''
self.sf_1 = Hero(11)
self.sf_10 = Hero(11, 10)
def test_in... | mit |
arabenjamin/scikit-learn | sklearn/feature_selection/__init__.py | 244 | 1088 | """
The :mod:`sklearn.feature_selection` module implements feature selection
algorithms. It currently includes univariate filter selection methods and the
recursive feature elimination algorithm.
"""
from .univariate_selection import chi2
from .univariate_selection import f_classif
from .univariate_selection import f_... | bsd-3-clause |
nanophotonics/nplab | nplab/analysis/SERS_Fitting/peaks_and_bg_fitting.py | 1 | 34967 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 15 11:50:45 2019
@author: Eoin Elliott -ee306
The fullfit class is the main thing here - sample use:
from nplab.analysis.peaks_and_bg_fitting import fullfit
>>>ff = fullfit(
spec,
shifts,
lineshape = 'L',
... | gpl-3.0 |
karolciba/playground | eucliderer/planar.py | 1 | 6760 | #!/usr/bin/env python
import operator
class Camera:
def __init__(self, position=(0,0), size=(100,100), field=(1,1)):
self.position = position
self.size = size
self.field = field
self._calc_boundaries()
def move(self, position):
self.position = position
self._cal... | unlicense |
jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/matplotlib/tests/test_quiver.py | 4 | 2866 | from __future__ import print_function
import os
import tempfile
import numpy as np
import sys
from matplotlib import pyplot as plt
from matplotlib.testing.decorators import cleanup
from matplotlib.testing.decorators import image_comparison
def draw_quiver(ax, **kw):
X, Y = np.meshgrid(np.arange(0, 2 * np.pi, 1),
... | mit |
kyleabeauchamp/HMCNotes | code/old/test_xhmc.py | 1 | 2490 | import lb_loader
import simtk.openmm.app as app
import numpy as np
import pandas as pd
import simtk.openmm as mm
from simtk import unit as u
from openmmtools import hmc_integrators, testsystems
pd.set_option('display.width', 1000)
n_steps = 3000
temperature = 300. * u.kelvin
#testsystem = testsystems.LennardJonesFlui... | gpl-2.0 |
marcocaccin/scikit-learn | sklearn/tests/test_isotonic.py | 230 | 11087 | import numpy as np
import pickle
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert_equal,
... | bsd-3-clause |
hammerlab/immuno_research | Feb1_majority_label.py | 1 | 1984 | import numpy as np
import sklearn
import sklearn.cross_validation
import sklearn.ensemble
import sklearn.linear_model
from epitopes import iedb
import eval_dataset
"""
Instead of dropping or keeping the noisy labels, started
trying to just the majority vote. This is saner and became the default
"""
print
print "-... | gpl-2.0 |
anne-urai/RT_RDK | graphicalModels/examples/recursive.py | 7 | 1623 | """
Recursively generated graph
===========================
**Daft** is Python, so you can do anything Python can do. This graph is
generated by recursive code.
"""
from matplotlib import rc
rc("font", family="serif", size=12)
rc("text", usetex=True)
import daft
def recurse(pgm, nodename, level, c):
if level ... | mit |
harterj/moose | modules/geochemistry/test/tests/time_dependent_reactions/add_feldspar.py | 9 | 1470 | #!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | lgpl-2.1 |
wittawatj/fsic-test | fsic/data.py | 1 | 23442 | __author__ = 'wittawat'
from abc import ABCMeta, abstractmethod
import math
import matplotlib.pyplot as plt
import numpy as np
import fsic.util as util
import matplotlib.pyplot as plt
import scipy.stats as stats
class PairedData(object):
"""Class representing paired data for independence testing
properties:
... | mit |
bigdataelephants/scikit-learn | sklearn/kernel_ridge.py | 1 | 6521 | """Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <mathieu@mblondel.org>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from .utils import check_X_y
from sklearn.base import BaseEstimator, RegressorMixin
fr... | bsd-3-clause |
jakevdp/scipy | scipy/signal/waveforms.py | 19 | 21039 | # Author: Travis Oliphant
# 2003
#
# Feb. 2010: Updated by Warren Weckesser:
# Rewrote much of chirp()
# Added sweep_poly()
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \
exp, cos, sin, polyval, po... | bsd-3-clause |
sknepneklab/SAMoS | FormerAnalysis/nematic_analysis.py | 1 | 23784 | # ################################################################
#
# Active Particles on Curved Spaces (APCS)
#
# Author: Silke Henkes
#
# ICSMB, Department of Physics
# University of Aberdeen
#
# Author: Rastko Sknepnek
#
# Division of Physics
# School of Engineering, Physics and Math... | gpl-3.0 |
ankurankan/pgmpy | pgmpy/tests/test_factors/test_continuous/test_Linear_Gaussain_CPD.py | 2 | 3451 | import unittest
import numpy.testing as np_test
import pandas as pd
import numpy as np
from pgmpy.factors.continuous import LinearGaussianCPD
class TestLGCPD(unittest.TestCase):
# @unittest.skip("TODO")
def test_class_init(self):
mu = np.array([7, 13])
sigma = np.array([[4, 3], [3, 6]])
... | mit |
rexshihaoren/scikit-learn | examples/calibration/plot_calibration_curve.py | 225 | 5903 | """
==============================
Probability Calibration curves
==============================
When performing classification one often wants to predict not only the class
label, but also the associated probability. This probability gives some
kind of confidence on the prediction. This example demonstrates how to di... | bsd-3-clause |
ZhiangChen/deep_learning | auto_recognition2/src/save_cropped_image.py | 1 | 2209 | #!/usr/bin/env python2
# MIT License
#
# Copyright (c) 2016 Zhiang Chen
'''
Receive the cropped image from "cropped_depth_image", and shift it and save the shifted images.
'''
from __future__ import print_function
import rospy
import roslib
import cv2
from sensor_msgs.msg import Image
from std_msgs.msg import String
... | mit |
walterreade/scikit-learn | sklearn/svm/tests/test_bounds.py | 280 | 2541 | import nose
from nose.tools import assert_equal, assert_true
from sklearn.utils.testing import clean_warning_registry
import warnings
import numpy as np
from scipy import sparse as sp
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from sklearn.linear_model.logistic import LogisticRegression... | bsd-3-clause |
ishank08/scikit-learn | benchmarks/bench_plot_randomized_svd.py | 57 | 17557 | """
Benchmarks on the power iterations phase in randomized SVD.
We test on various synthetic and real datasets the effect of increasing
the number of power iterations in terms of quality of approximation
and running time. A number greater than 0 should help with noisy matrices,
which are characterized by a slow spectr... | bsd-3-clause |
ycaihua/scikit-learn | sklearn/utils/arpack.py | 265 | 64837 | """
This contains a copy of the future version of
scipy.sparse.linalg.eigen.arpack.eigsh
It's an upgraded wrapper of the ARPACK library which
allows the use of shift-invert mode for symmetric matrices.
Find a few eigenvectors and eigenvalues of a matrix.
Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/
"""
#... | bsd-3-clause |
jlegendary/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/__init__.py | 72 | 2225 |
import matplotlib
import inspect
import warnings
# ipython relies on interactive_bk being defined here
from matplotlib.rcsetup import interactive_bk
__all__ = ['backend','show','draw_if_interactive',
'new_figure_manager', 'backend_version']
backend = matplotlib.get_backend() # validates, to match all_bac... | gpl-3.0 |
Odingod/mne-python | mne/coreg.py | 4 | 38830 | """Coregistration between different coordinate frames"""
# Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD (3-clause)
from .externals.six.moves import configparser
import fnmatch
from glob import glob, iglob
import os
import stat
import sys
import re
import shutil
from warnings import warn
i... | bsd-3-clause |
alberto-antonietti/nest-simulator | pynest/examples/BrodyHopfield.py | 3 | 4199 | # -*- coding: utf-8 -*-
#
# BrodyHopfield.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, ... | gpl-2.0 |
jay-johnson/datanode | bins/ml/predictors/predict-from-cache-iris-regressor.py | 1 | 18941 | #!/usr/bin/env python
# Load common imports and system envs to build the core object
import sys, os
# For running inside the docker container use:
#import matplotlib
#matplotlib.use('Agg')
# Load the Environment:
os.environ["ENV_DEPLOYMENT_TYPE"] = "JustRedis"
from src.common.inits_for_python import *
###########... | apache-2.0 |
massmutual/scikit-learn | sklearn/neighbors/approximate.py | 71 | 22357 | """Approximate nearest neighbor search"""
# Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk>
# Joel Nothman <joel.nothman@gmail.com>
import numpy as np
import warnings
from scipy import sparse
from .base import KNeighborsMixin, RadiusNeighborsMixin
from ..base import BaseEstimator
from ..utils.va... | bsd-3-clause |
prashanti/similarity-experiment | src/compute_allscores_similarity.py | 1 | 13495 | from __future__ import division
def getmicaic(term1,term2,ancestors,icdict):
micaic=0
mica=""
commonancestors=set.intersection(ancestors[term1],ancestors[term2])
lcslist=[icdict[anc] for anc in commonancestors]
if len(lcslist)>0:
micaic=np.max(lcslist)
return micaic
... | mit |
marshallmcdonnell/journals | etc/old/journal-create.py | 1 | 9168 | #!/usr/bin/env python
import numpy as np
import pandas as pd
import os, sys, re, argparse, datetime
import error_handler
import scanClass
import utils
sys.path.append('/opt/Mantid/bin')
from mantid.simpleapi import LoadEventNexus
_supported_formats = ['csv', 'hdf']
def pair(arg):
return [str(x) for x in a... | mit |
dnjohnstone/hyperspy | hyperspy/drawing/signal1d.py | 1 | 17319 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | gpl-3.0 |
kyleabeauchamp/mdtraj | mdtraj/tests/test_topology.py | 1 | 7086 | ##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2014 Stanford University and the Authors
#
# Authors: Kyle A. Beauchamp
# Contributors: Robert McGibbon, Matthew Har... | lgpl-2.1 |
EDRN/labcas-backend | common/src/main/python/gov/nasa/jpl/edrn/labcas/preprocess/coh_make_metadata.py | 1 | 1938 | # Script that creates dataset metadata for the City Of Hope data collection
#
import os
import re
import pandas
from datetime import datetime
from utils import write_dataset_metadata
# parameters
data_dir = os.path.join(os.environ['LABCAS_ARCHIVE'], 'City_Of_Hope')
pattern = '.*\/(Du\d+)Breastmri(\d+)\/.*'
csv_filep... | apache-2.0 |
SEL-Columbia/bamboo | bamboo/controllers/datasets.py | 2 | 26617 | import urllib2
from external import bearcart
from pandas import concat
import vincent
from bamboo.controllers.abstract_controller import AbstractController
from bamboo.core.aggregations import AGGREGATIONS
from bamboo.core.frame import df_to_csv_string, NonUniqueJoinError
from bamboo.core.merge import merge_dataset_i... | bsd-3-clause |
lifei96/Medium_Crawler | User_Crawler/medium_posts_data_reader.py | 2 | 1184 | # -*- coding: utf-8 -*-
import pandas as pd
import json
import datetime
import os
def read_posts():
posts = list()
file_in = open('./post_list.txt', 'r')
post_list = str(file_in.read()).split(' ')
file_in.close()
num = 0
for post_id in post_list:
if not post_id:
continue
... | mit |
ankurankan/scikit-learn | 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 |
unicef/rhizome | rhizome/api/resources/campaign_doc_results.py | 1 | 2871 | from pandas import DataFrame
from rhizome.api.resources.base_model import BaseModelResource
from rhizome.models.campaign_models import DataPointComputed
from rhizome.models.document_models import SourceObjectMap, \
DocumentSourceObjectMap
from rhizome.models.location_models import LocationTree
from rhizome.models.... | agpl-3.0 |
sanja7s/CI_urban_rural | CI_urban_rural/test/plot_map_from_file_data.py | 1 | 6064 | '''
Created on Jun 11, 2014
@author: sscepano
'''
import networkx as nx
from collections import defaultdict
def map_commutes(G):
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import matplotlib as mpl
mpl.rcParams['font.size'] = 10.
mp... | mit |
henridwyer/scikit-learn | benchmarks/bench_multilabel_metrics.py | 86 | 7286 | #!/usr/bin/env python
"""
A comparison of multilabel target formats and metrics over them
"""
from __future__ import division
from __future__ import print_function
from timeit import timeit
from functools import partial
import itertools
import argparse
import sys
import matplotlib.pyplot as plt
import scipy.sparse as... | bsd-3-clause |
chubbymaggie/datasketch | benchmark/b_bit_minhash_benchmark.py | 3 | 2774 | '''
Benchmarking the performance and accuracy of b-bi MinHash.
'''
import time, logging, random
logging.basicConfig(level=logging.INFO)
import pyhash
import numpy as np
from datasketch.minhash import MinHash
from datasketch.b_bit_minhash import bBitMinHash
from similarity_benchmark import _get_exact, _gen_data,\
... | mit |
maurov/xraysloth | sloth/inst/dthetaxz_plot.py | 1 | 11739 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""plots related to dthetaxz"""
import sys, os
import copy
import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.gridspec as gridspec
from matplotlib.ticker import MaxNLocator, AutoLocator, MultipleLocator
f... | bsd-3-clause |
quantopian/zipline | zipline/algorithm.py | 1 | 85906 | #
# Copyright 2015 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
tillschumann/nest-simulator | topology/examples/test_3d_gauss.py | 13 | 2924 | # -*- coding: utf-8 -*-
#
# test_3d_gauss.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, ... | gpl-2.0 |
ephes/scikit-learn | examples/bicluster/bicluster_newsgroups.py | 162 | 7103 | """
================================================================
Biclustering documents with the Spectral Co-clustering algorithm
================================================================
This example demonstrates the Spectral Co-clustering algorithm on the
twenty newsgroups dataset. The 'comp.os.ms-windows... | bsd-3-clause |
larsmans/scikit-learn | sklearn/manifold/tests/test_locally_linear.py | 41 | 4827 | from itertools import product
from nose.tools import assert_true
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from scipy import linalg
from sklearn import neighbors, manifold
from sklearn.manifold.locally_linear import barycenter_kneighbors_graph
from sklearn.utils.testi... | bsd-3-clause |
petosegan/scikit-learn | examples/classification/plot_classifier_comparison.py | 181 | 4699 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | bsd-3-clause |
junbochen/pylearn2 | pylearn2/scripts/plot_monitor.py | 37 | 10204 | #!/usr/bin/env python
"""
usage:
plot_monitor.py model_1.pkl model_2.pkl ... model_n.pkl
Loads any number of .pkl files produced by train.py. Extracts
all of their monitoring channels and prompts the user to select
a subset of them to be plotted.
"""
from __future__ import print_function
__authors__ = "Ian Goodfell... | bsd-3-clause |
JackKelly/neuralnilm_prototype | scripts/e565.py | 2 | 33432 | from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource)
from neuralnilm.source import (standardise, discretize, fdiff, power_and_fdiff,
... | mit |
18padx08/PPTex | PPTexEnv_x86_64/lib/python2.7/site-packages/sympy/plotting/tests/test_plot_implicit.py | 17 | 2600 | import warnings
from sympy import (plot_implicit, cos, Symbol, Eq, sin, re, And, Or, exp, I,
tan, pi)
from sympy.plotting.plot import unset_show
from tempfile import NamedTemporaryFile
from sympy.utilities.pytest import skip
from sympy.external import import_module
#Set plots not to show
unset_show(... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.