repo_name stringlengths 6 96 | path stringlengths 4 191 | copies stringclasses 322
values | size stringlengths 4 6 | content stringlengths 762 753k | license stringclasses 15
values |
|---|---|---|---|---|---|
cuiwei0322/cost_analysis | tall_building_zero_attack_angle_cost_analysis/Result/peak_ng.py | 1 | 2728 | import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
from matplotlib import cm
from matplotlib import pyplot as plt
from itertools import product, combinations
from matplotlib import rc
from matplotlib.font_manager import FontProperties
font_size = 8
rc('font',**{'family':'serif','serif':['Times... | apache-2.0 |
vybstat/scikit-learn | sklearn/utils/validation.py | 30 | 24618 | """Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from ..externals i... | bsd-3-clause |
michigraber/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_scalability.py | 225 | 5719 | """
============================================
Scalability of Approximate Nearest Neighbors
============================================
This example studies the scalability profile of approximate 10-neighbors
queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200``
when varying the number of sa... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/groupby/aggregate/test_cython.py | 2 | 6848 | """
test cython .agg behavior
"""
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Index, NaT, Series, Timedelta, Timestamp, bdate_range
from pandas.core.groupby.groupby import DataError
import pandas.util.testing as tm
@pytest.mark.parametrize(
"op_name",
[
"count"... | apache-2.0 |
indigowhale33/Digit-Recognizer | mnist992.py | 1 | 1289 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 8 12:34:27 2016
@author: Steve Cho
"""
import pandas as pd
df_wine= pd.read_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data', header = None)
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import ... | gpl-3.0 |
pford68/nupic.research | union_pooling/union_pooling/activation/excite_functions/excite_functions_all.py | 2 | 3781 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | gpl-3.0 |
OshynSong/scikit-learn | examples/feature_selection/plot_feature_selection.py | 249 | 2827 | """
===============================
Univariate Feature Selection
===============================
An example showing univariate feature selection.
Noisy (non informative) features are added to the iris data and
univariate feature selection is applied. For each feature, we plot the
p-values for the univariate feature s... | bsd-3-clause |
mblue9/tools-iuc | tools/vsnp/vsnp_add_zero_coverage.py | 2 | 8655 | #!/usr/bin/env python
import argparse
import multiprocessing
import os
import queue
import re
import shutil
import pandas
import pysam
from Bio import SeqIO
INPUT_BAM_DIR = 'input_bam_dir'
INPUT_VCF_DIR = 'input_vcf_dir'
OUTPUT_VCF_DIR = 'output_vcf_dir'
OUTPUT_METRICS_DIR = 'output_metrics_dir'
def get_base_file_... | mit |
almarklein/scikit-image | viewer_examples/plugins/watershed_demo.py | 4 | 1276 | import matplotlib.pyplot as plt
from skimage import data
from skimage import filter
from skimage import morphology
from skimage.viewer import ImageViewer
from skimage.viewer.widgets import history
from skimage.viewer.plugins.labelplugin import LabelPainter
class OKCancelButtons(history.OKCancelButtons):
def upd... | bsd-3-clause |
sandipde/bokehplot | plot-server/main.py | 1 | 4359 | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from copy import copy
from bokeh.core.properties import field
from bokeh.io import curdoc
from bokeh.layouts import layout,column,row
from bokeh.models.layouts import HBox
from bokeh.models import (
ColumnDataSource, HoverTool, SingleIntervalTicker, Sli... | mit |
yukke42/machine-learning | 2/p30.py | 1 | 2222 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
def plot_decision_regions(X, y, classifier, resolution=0.02):
markers = ('s', 'x', 'o', '^', 'v')
colors = ('red', 'blue', 'lightgreen', 'gray', 'cyan')
cmap = ListedColormap(colors[:len(np.... | mit |
mixturemodel-flow/tensorflow | tensorflow/contrib/timeseries/examples/predict_test.py | 80 | 2487 | # 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 |
kveeramah/aDNA_GenoCaller | aDNA_GenoCaller.py | 1 | 25225 | #!/usr/bin/env python
# -*- coding: ASCII -*-
###This program calls genotypes from bam files at positions/regions specified in a bed file while taking into account post mortem damage as estimate by MapDamage.
###Otherwise the algorithm is the same as GATK Unified Genotype for diploid calls
###This version of the progr... | gpl-3.0 |
djgagne/scikit-learn | sklearn/datasets/tests/test_base.py | 205 | 5878 | import os
import shutil
import tempfile
import warnings
import nose
import numpy
from pickle import loads
from pickle import dumps
from sklearn.datasets import get_data_home
from sklearn.datasets import clear_data_home
from sklearn.datasets import load_files
from sklearn.datasets import load_sample_images
from sklearn... | bsd-3-clause |
christobal54/aei-grad-school | bin/ebv-scales-growth-hist.py | 1 | 3965 | #!/usr/bin/python
#####
# plots distributions of growth EBV variables
#####
import aei
import gdal
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap as lsc
from matplotlib.colors import ColorConverter as cc
from scipy.stats import gaussian_kde
... | mit |
vybstat/scikit-learn | examples/covariance/plot_robust_vs_empirical_covariance.py | 248 | 6359 | r"""
=======================================
Robust vs Empirical covariance estimate
=======================================
The usual covariance maximum likelihood estimate is very sensitive to the
presence of outliers in the data set. In such a case, it would be better to
use a robust estimator of covariance to guar... | bsd-3-clause |
YihaoLu/statsmodels | docs/sphinxext/numpy_ext/docscrape_sphinx.py | 62 | 7703 | import re, inspect, textwrap, pydoc
import sphinx
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config={}):
self.use_plots = config.get('use_plots', False)
NumpyDocString.__init__(self, docstring, config=config)
... | bsd-3-clause |
katstalk/android_external_chromium_org | chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py | 26 | 11131 | #!/usr/bin/python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Do all the steps required to build and test against nacl."""
import optparse
import os.path
import re
import shutil
import subproc... | bsd-3-clause |
endolith/scikit-image | doc/examples/segmentation/plot_rag.py | 25 | 2139 | """
=======================
Region Adjacency Graphs
=======================
This example demonstrates the use of the `merge_nodes` function of a Region
Adjacency Graph (RAG). The `RAG` class represents a undirected weighted graph
which inherits from `networkx.graph` class. When a new node is formed by
merging two node... | bsd-3-clause |
genehughes/trading-with-python | nautilus/nautilus.py | 77 | 5403 | '''
Created on 26 dec. 2011
Copyright: Jev Kuznetsov
License: BSD
'''
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from ib.ext.Contract import Contract
from ib.opt import ibConnection
from ib.ext.Order import Order
import tradingWithPython.lib.logger as logger
from tradingWithPython.lib.eve... | bsd-3-clause |
ua-snap/downscale | snap_scripts/epscor_sc/testing_deltadownscale_deficiency_tasmin_tasmax_epscor_sc_CLIMtest.py | 1 | 7419 | # SLICE YEARS AND CROP TO THE BASE EXTENT OF AKCAN IN WGS84 PCLL
def transform_from_latlon( lat, lon ):
''' simple way to make an affine transform from lats and lons coords '''
from affine import Affine
lat = np.asarray( lat )
lon = np.asarray( lon )
trans = Affine.translation(lon[0], lat[0])
scale = Affine.scale... | mit |
brodoll/sms-tools | lectures/06-Harmonic-model/plots-code/f0Twm-piano.py | 19 | 1261 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackman
import math
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import dftModel as DFT
import utilFunctions as UF
import stft as STFT... | agpl-3.0 |
smcantab/pele | pele/gui/graph_viewer.py | 5 | 13967 | import networkx as nx
import numpy as np
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QWidget
from pele.gui.ui.graph_view_ui import Ui_Form
from pele.utils.events import Signal
from pele.utils.disconnectivity_graph import database2graph
from pele.gui.ui.dgraph_dlg import minimum_energy_path, check_thermodyn... | gpl-3.0 |
iiSeymour/pandashells | pandashells/lib/plot_lib.py | 1 | 3883 | #! /usr/bin/env python
import sys
import re
from dateutil.parser import parse
import matplotlib as mpl
import pylab as pl
import seaborn as sns
import mpld3
def show(args):
# if figure saving requested
if hasattr(args, 'savefig') and args.savefig:
# save html if requested
rex_html = re.compi... | bsd-2-clause |
pypot/scikit-learn | sklearn/preprocessing/tests/test_imputation.py | 213 | 11911 | import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.preprocessing.imputa... | bsd-3-clause |
mraspaud/dask | dask/dataframe/tests/test_ufunc.py | 5 | 9888 | from __future__ import absolute_import, division, print_function
import pytest
pd = pytest.importorskip('pandas')
import pandas.util.testing as tm
import numpy as np
import dask.array as da
import dask.dataframe as dd
from dask.dataframe.utils import assert_eq
_BASE_UFUNCS = ['conj', 'exp', 'log', 'log2', 'log10',... | bsd-3-clause |
Jimmy-Morzaria/scikit-learn | examples/decomposition/plot_pca_3d.py | 354 | 2432 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Principal components analysis (PCA)
=========================================================
These figures aid in illustrating how a point cloud
can be very flat in one direction--which is where PCA
comes in to ch... | bsd-3-clause |
MSeifert04/numpy | numpy/lib/histograms.py | 4 | 39639 | """
Histogram-related functions
"""
from __future__ import division, absolute_import, print_function
import contextlib
import functools
import operator
import warnings
import numpy as np
from numpy.compat.py3k import basestring
from numpy.core import overrides
__all__ = ['histogram', 'histogramdd', 'histogram_bin_ed... | bsd-3-clause |
alvarofierroclavero/scikit-learn | sklearn/datasets/tests/test_rcv1.py | 322 | 2414 | """Test the rcv1 loader.
Skipped if rcv1 is not already downloaded to data_home.
"""
import errno
import scipy.sparse as sp
import numpy as np
from sklearn.datasets import fetch_rcv1
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing i... | bsd-3-clause |
yuanagain/seniorthesis | venv/lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py | 4 | 7031 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
import numpy as np
from .axes_divider import make_axes_locatable, Size, locatable_axes_factory
import sys
from .mpl_axes import Axes
def make_rgb_axes(ax, pad=0.01, axes_... | mit |
hbp-unibi/cypress | scripts/decode_function.py | 2 | 2112 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Cypress -- C++ Spiking Neural Network Simulation Framework
# Copyright (C) 2016 Andreas Stöckel
#
# 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 Found... | gpl-3.0 |
wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/GeneralisedEigen/NoBC/MHDallatonce.py | 4 | 9242 | import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import numpy as np
from dolfin import tic, toc
import HiptmairSetup
import PETScIO as IO
import scipy.sparse as sp
import matplotlib.pylab as plt
import MatrixOperations as MO
class BaseMyPC(object):
def setup(self, pc):
pass
... | mit |
pschella/scipy | doc/source/tutorial/examples/normdiscr_plot1.py | 84 | 1547 | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
npoints = 20 # number of integer support points of the distribution minus 1
npointsh = npoints / 2
npointsf = float(npoints)
nbound = 4 #bounds for the truncated normal
normbound = (1 + 1 / npointsf) * nbound #actual bounds of truncated normal
... | bsd-3-clause |
weissercn/MLTools | Dalitz_simplified/classifier_eval_simplified_example.py | 1 | 4731 | print(__doc__)
import p_value_scoring_object
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import load_iris
from sklearn.cross_validation import StratifiedShuffleSplit
from s... | mit |
s3h10r/avaon | django-avaon/acore/views/visualize.py | 1 | 6406 | """
statistics - heatmaps of impacts
"""
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import loader,Context,RequestContext
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
# --... | gpl-2.0 |
ZenDevelopmentSystems/scikit-learn | examples/linear_model/plot_logistic.py | 312 | 1426 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Logit function
=========================================================
Show in the plot is how the logistic regression would, in this
synthetic dataset, classify values as either 0 or 1,
i.e. class one or two, u... | bsd-3-clause |
zorroblue/scikit-learn | sklearn/feature_selection/tests/test_feature_select.py | 21 | 26665 | """
Todo: cross-check the F-value with stats model
"""
from __future__ import division
import itertools
import warnings
import numpy as np
from scipy import stats, sparse
from numpy.testing import run_module_suite
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from... | bsd-3-clause |
LukeWoodSMU/Mushroom-Classification | visualizations/comparative_plots.py | 1 | 1980 | import sys
import os
import numpy as np
import matplotlib.pyplot as plt
sys.path.append(os.path.abspath('..'))
from preprocessing import shroom_dealer
def data(attribute):
df = shroom_dealer.get_data_frame()
attribute_values = shroom_dealer.get_attribute_dictionary()[attribute]
poisonous_data = {}
e... | gpl-3.0 |
erramuzpe/NeuroVault | neurovault/api/serializers.py | 3 | 11559 | import os
import json
import pandas as pd
from django.contrib.auth.models import User
from django.forms.utils import ErrorDict, ErrorList
from django.utils.http import urlquote
from rest_framework import serializers
from rest_framework.relations import PrimaryKeyRelatedField, StringRelatedField
from neurovault.apps.st... | mit |
mschmidt87/nest-simulator | pynest/examples/hh_phaseplane.py | 9 | 4973 | # -*- coding: utf-8 -*-
#
# hh_phaseplane.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 |
ryfeus/lambda-packs | LightGBM_sklearn_scipy_numpy/source/sklearn/manifold/t_sne.py | 3 | 35089 | # Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de>
# Author: Christopher Moody <chrisemoody@gmail.com>
# Author: Nick Travers <nickt@squareup.com>
# License: BSD 3 clause (C) 2014
# This is the exact and Barnes-Hut t-SNE implementation. There are other
# modifications of the algorithm:
# * Fast Optimi... | mit |
TsinghuaX/ease | ease/util_functions.py | 3 | 16740 | #Collection of misc functions needed to support essay_set.py and feature_extractor.py.
#Requires aspell to be installed and added to the path
from fisher import pvalue
aspell_path = "aspell"
import re
import os
from sklearn.feature_extraction.text import CountVectorizer
import numpy
from itertools import chain
import ... | agpl-3.0 |
trichter/sito | bin/console/plotspec.py | 1 | 2764 | #!/usr/bin/env python
# by TR
import argparse
from obspy.core import UTCDateTime as UTC
import logging
from obspy.core.utcdatetime import UTCDateTime
logging.basicConfig()
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('file_station',
help='file to plot o... | mit |
rollend/trading-with-python | lib/qtpandas.py | 77 | 7937 | '''
Easy integration of DataFrame into pyqt framework
Copyright: Jev Kuznetsov
Licence: BSD
'''
from PyQt4.QtCore import (QAbstractTableModel,Qt,QVariant,QModelIndex,SIGNAL)
from PyQt4.QtGui import (QApplication,QDialog,QVBoxLayout, QHBoxLayout, QTableView, QPushButton,
QWidget,QTabl... | bsd-3-clause |
srinathv/bokeh | examples/plotting/server/boxplot.py | 42 | 2372 | # The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
import numpy as np
import pandas as pd
from bokeh.plotting import figure, show, output_server
# Generate some synthetic time series for six different categories
cats = list("abcdef")
data = np.random.randn(2000)
g = np.random.cho... | bsd-3-clause |
oscarlazoarjona/quantum_memories | examples/hyperfine_orca/doppler_dephasing/plot_data_rb.py | 1 | 14036 | # -*- coding: utf-8 -*-
# Copyright (C) 2017 Oscar Gerardo Lazo Arjona
# mailto: oscar.lazoarjona@physics.ox.ac.uk
r"""This is a template."""
import numpy as np
from scipy.optimize import curve_fit
import pandas as pd
from matplotlib import pyplot as plt
from scipy.constants import physical_constants
from tabulate imp... | gpl-3.0 |
doubaoatthu/UWRoutingSystem | server/dt.py | 1 | 2276 | from sklearn import tree
from sklearn.externals.six import StringIO
from IPython.display import Image
from sklearn.neighbors import KNeighborsClassifier
import os
import pydot
import numpy
import math
import random
preference = []
label = []
with open("../data/survey.txt") as f:
contents = f.readlines()
for content ... | mit |
rachel3834/mulens_modeler | trunk/scripts/gen_mag_error_relation.py | 1 | 2082 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 20 00:28:47 2016
@author: robouser
"""
import mulens_class
from astropy.time import Time, TimeDelta
import numpy as np
from astropy import constants
import matplotlib.pyplot as plt
def generate_mag_err_relations():
"""Function to generate datafiles of the magnitude ... | gpl-2.0 |
joshbohde/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 2 | 7884 | import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_almost_equal, assert_array_almost_equal, \
assert_equal, assert_array_equal
from sklearn import datasets
from sklearn.metrics import mean_square_error
from sklearn.linear_model.base import LinearRegression
from s... | bsd-3-clause |
quheng/scikit-learn | examples/neighbors/plot_nearest_centroid.py | 264 | 1804 | """
===============================
Nearest Centroid Classification
===============================
Sample usage of Nearest Centroid 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 ListedColormap
f... | bsd-3-clause |
tkarna/cofs | test/pressure_grad/test_int_pg_mes.py | 1 | 7608 | """
Unit tests for computing the internal pressure gradient
Runs MES convergence tests against a non-trivial analytical solution in a
deformed geometry.
P1DGxP2 space yields 1st order convergence. For second order convergence both
the scalar fields and its gradient must be in P2DGxP2 space.
"""
from thetis import *
f... | mit |
michaelpacer/scikit-image | doc/examples/plot_multiblock_local_binary_pattern.py | 22 | 2498 | """
===========================================================
Multi-Block Local Binary Pattern for texture classification
===========================================================
This example shows how to compute multi-block local binary pattern (MB-LBP)
features as well as how to visualize them.
The features ar... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/indexes/period/test_ops.py | 2 | 13093 | import numpy as np
import pytest
import pandas as pd
from pandas import DatetimeIndex, Index, NaT, PeriodIndex, Series
from pandas.core.arrays import PeriodArray
from pandas.tests.test_base import Ops
import pandas.util.testing as tm
class TestPeriodIndexOps(Ops):
def setup_method(self, method):
super().... | apache-2.0 |
joernhees/scikit-learn | sklearn/tests/test_metaestimators.py | 52 | 4990 | """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 |
Caranarq/01_Dmine | 01_Agua/P0106/P0106.py | 1 | 2761 | # -*- coding: utf-8 -*-
"""
Started on wed, thu 17th, 2018
@author: carlos.arana
"""
# Librerias utilizadas
import pandas as pd
import sys
module_path = r'D:\PCCS\01_Dmine\Scripts'
if module_path not in sys.path:
sys.path.append(module_path)
from VarInt.VarInt import VarInt
from classes.Meta import Meta
from Comp... | gpl-3.0 |
toobaz/pandas | pandas/tests/series/test_analytics.py | 1 | 56686 | from itertools import product
import operator
import numpy as np
from numpy import nan
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
Series,
date_range,
isna,
notna,
)
from pandas.api.types import... | bsd-3-clause |
joelgrus/data-science-from-scratch | first-edition/code-python3/neural_networks.py | 8 | 6417 | from collections import Counter
from functools import partial
from linear_algebra import dot
import math, random
import matplotlib
import matplotlib.pyplot as plt
def step_function(x):
return 1 if x >= 0 else 0
def perceptron_output(weights, bias, x):
"""returns 1 if the perceptron 'fires', 0 if not"""
re... | mit |
deepchem/deepchem | contrib/DiabeticRetinopathy/model.py | 5 | 8069 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 10 06:12:10 2018
@author: zqwu
"""
import numpy as np
import tensorflow as tf
from deepchem.data import NumpyDataset, pad_features
from deepchem.metrics import to_one_hot
from deepchem.models.tensorgraph.layers import Layer, Dense, SoftMax, Reshap... | mit |
thaole16/Boids | boids/boids.py | 1 | 4866 | """
A refactored implementation of Boids from a deliberately bad implementation of
[Boids](http://dl.acm.org/citation.cfm?doid=37401.37406): an exercise for class.
"""
from matplotlib import pyplot as plt
from matplotlib import animation
import numpy as np
class Boids(object):
def __init__(self,
... | mit |
gregreen/bayestar | scripts/resample_los.py | 1 | 19922 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# resample_los.py
#
# Copyright 2013 Greg Green <greg@greg-UX31A>
#
# 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 t... | gpl-2.0 |
davidcdupuis/psf | DeepLearning/model-example-2/nn.py | 1 | 11179 | # coding: utf-8
# # San Francisco Crime prediction
# # Based on 2 layer neural net and count featurizer
# In[1]:
import pandas as pd
import numpy as np
from datetime import datetime
from sklearn.cross_validation import train_test_split
from sklearn.grid_search import GridSearchCV
import matplotlib.pylab as plt
from... | apache-2.0 |
mwv/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 130 | 22974 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
ugaliguy/Intro-to-NLP | Assignment3/A.py | 1 | 2989 | from main import replace_accented
from sklearn import svm
from sklearn import neighbors
# don't change the window size
window_size = 10
# A.1
def build_s(data):
'''
Compute the context vector for each lexelt
:param data: dic with the following structure:
{
lexelt: [(instance_id, left_context, h... | mit |
posterior/treecat | treecat/e2e_test.py | 1 | 3047 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from warnings import warn
import matplotlib
import pytest
from treecat.format import guess_schema
from treecat.format import load_data
from treecat.format import load_schema
from treecat.serving imp... | apache-2.0 |
laddng/LiPlate | modules/Plate.py | 1 | 5432 | import cv2;
import numpy as np;
import logging;
import pytesseract as tes;
from PIL import Image;
from modules.TrainingCharacter import *;
from matplotlib import pyplot as plt;
from copy import deepcopy, copy;
from logging.config import fileConfig;
# logger setup
fileConfig("logging_config.ini");
logger = logging.getL... | mit |
h2educ/scikit-learn | sklearn/cluster/tests/test_birch.py | 342 | 5603 | """
Tests for the birch clustering algorithm.
"""
from scipy import sparse
import numpy as np
from sklearn.cluster.tests.common import generate_clustered_data
from sklearn.cluster.birch import Birch
from sklearn.cluster.hierarchical import AgglomerativeClustering
from sklearn.datasets import make_blobs
from sklearn.l... | bsd-3-clause |
michaelaye/scikit-image | doc/examples/plot_ssim.py | 15 | 2238 | """
===========================
Structural similarity index
===========================
When comparing images, the mean squared error (MSE)--while simple to
implement--is not highly indicative of perceived similarity. Structural
similarity aims to address this shortcoming by taking texture into account
[1]_, [2]_.
T... | bsd-3-clause |
terkkila/scikit-learn | sklearn/tree/tests/test_export.py | 76 | 9318 | """
Testing for export functions of decision trees (sklearn.tree.export).
"""
from numpy.testing import assert_equal
from nose.tools import assert_raises
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn.tree import export_graphviz
from sklearn.externals.six import StringIO
# toy sa... | bsd-3-clause |
ucloud/uai-sdk | examples/mxnet/insightface/train/code/train_softmax_dist.py | 1 | 26097 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import math
import random
import logging
import pickle
import numpy as np
from image_iter import FaceImageIter
from image_iter import FaceImageIterList
import mxnet as mx
from mxnet import ... | apache-2.0 |
arjoly/scikit-learn | sklearn/linear_model/ridge.py | 6 | 46528 | """
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... | bsd-3-clause |
desihub/desisim | py/desisim/scripts/quickgalaxies.py | 1 | 13799 | """
desisim.scripts.quickgalaxies
=============================
"""
from __future__ import absolute_import, division, print_function
import healpy as hp
import numpy as np
import os
from datetime import datetime
from abc import abstractmethod, ABCMeta
from argparse import Action, ArgumentParser
from astropy.table i... | bsd-3-clause |
jrbitt/gamesresearch | tools/experimen1.py | 1 | 4311 |
import numpy as np
from scipy import stats
import pandas as pd
def loadSaveBase(loadfile,savefile):
#Ler toda a base oficial
#base = np.genfromtxt(loadfile,usecols=[0,1,2,3,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],delimiter=",",skip_header=1, names= ['goid','code','year','platform... | apache-2.0 |
aitoralmeida/dl_activity_recognition | lstm/stateful-lstm.py | 1 | 11443 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 25 16:16:52 2016
@author: gazkune
"""
from collections import Counter
import json
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
from keras.models import Sequential
from keras.models import model_from_json
from k... | gpl-3.0 |
jameshensman/pymc3 | pymc3/tests/test_plots.py | 13 | 1721 | import matplotlib
matplotlib.use('Agg', warn=False)
import numpy as np
from .checks import close_to
import pymc3.plots
from pymc3.plots import *
from pymc3 import Slice, Metropolis, find_hessian, sample
def test_plots():
# Test single trace
from pymc3.examples import arbitrary_stochastic as asmod
with... | apache-2.0 |
gwaygenomics/pancancer | scripts/copy_burden_merge.py | 1 | 1259 | """
Gregory Way 2017
PanCancer Classifier
scripts/copy_burden_merge.py
Merge per sample classifier scores with segment based scores
Usage: Run in command line with required command argument:
python scripts/copy_burden_merge.py --classifier_folder
classifier_folder is a string pointing to the location of the... | bsd-3-clause |
waynenilsen/statsmodels | statsmodels/sandbox/nonparametric/tests/ex_gam_new.py | 34 | 3845 | # -*- coding: utf-8 -*-
"""Example for GAM with Poisson Model and PolynomialSmoother
This example was written as a test case.
The data generating process is chosen so the parameters are well identified
and estimated.
Created on Fri Nov 04 13:45:43 2011
Author: Josef Perktold
"""
from __future__ import print_function... | bsd-3-clause |
victorbergelin/scikit-learn | examples/svm/plot_separating_hyperplane.py | 294 | 1273 | """
=========================================
SVM: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a Support Vector Machine classifier with
linear kernel.
"""
print(__doc__)
import numpy as np
impor... | bsd-3-clause |
louispotok/pandas | pandas/tests/series/test_rank.py | 3 | 18837 | # -*- coding: utf-8 -*-
from pandas import compat, Timestamp
import pytest
from distutils.version import LooseVersion
from numpy import nan
import numpy as np
from pandas import Series, date_range, NaT
from pandas.api.types import CategoricalDtype
from pandas.compat import product
from pandas.util.testing import as... | bsd-3-clause |
peterfpeterson/mantid | scripts/HFIR_4Circle_Reduction/mplgraphicsview3d.py | 3 | 10025 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#pyl... | gpl-3.0 |
femtotrader/pyfolio | pyfolio/capacity.py | 1 | 9548 | from __future__ import division
import pandas as pd
import numpy as np
from . import pos
import empyrical
def daily_txns_with_bar_data(transactions, market_data):
"""
Sums the absolute value of shares traded in each name on each day.
Adds columns containing the closing price and total daily volume for
... | apache-2.0 |
tudo-astroparticlephysics/pydisteval | disteval/visualization/comparison_plotter/functions/legend_entries.py | 1 | 3779 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
class DataObject(object):
def __init__(self, fc_t='w', ec_t='k', fc_c='w', ec_c='k', lw=1.):
self.fc_t = fc_t
... | mit |
jguhlin/nn-replicon-identification | replicon_identification_cnn.py | 1 | 17393 | # Next step is to add filename processed to text summary
import tensorflow as tf
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.sparse import csr_matrix
from collections import Counter
import collections
import random
from six.moves import urllib
from six.moves import xrange # ... | epl-1.0 |
dgasmith/EEX_scratch | tests/test_amber_reference.py | 1 | 1942 | """
Tests to compare EEX energies to reference energies computed by amber
"""
import os
import eex
import numpy as np
import pandas as pd
import pytest
import eex_find_files
import glob
import eex_build_dl
# Build out file list
_test_directories = ["alkanes", "alcohols", "cyclic"]
_test_systems = []
for test_dir in ... | bsd-3-clause |
hrjn/scikit-learn | sklearn/linear_model/ransac.py | 16 | 19158 | # coding: utf-8
# Author: Johannes Schönberger
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
from ..utils import check_random_state, check_array, check_consistent_length
from ..utils.random import sample_without_replacement
fr... | bsd-3-clause |
vivekmishra1991/scikit-learn | examples/cluster/plot_affinity_propagation.py | 349 | 2304 | """
=================================================
Demo of affinity propagation clustering algorithm
=================================================
Reference:
Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages
Between Data Points", Science Feb. 2007
"""
print(__doc__)
from sklearn.cluster impor... | bsd-3-clause |
CodeMonkeyJan/hyperspy | hyperspy/drawing/utils.py | 1 | 47617 | # -*- coding: utf-8 -*-
# Copyright 2007-2016 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 |
antiface/mne-python | examples/visualization/plot_topo_compare_conditions.py | 7 | 2375 | """
=================================================
Compare evoked responses for different conditions
=================================================
In this example, an Epochs object for visual and
auditory responses is created. Both conditions
are then accessed by their respective names to
create a sensor layout... | bsd-3-clause |
nathancfox/autocatalytic-modeling | BurstBasicExperiment/BURST_Analysis.py | 1 | 5129 | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.lines as lines
pathprefix = 'AnalysisFigures/'
ts = pd.read_csv('BURST_testStatistics.csv', header=0)
e_mean = plt.figure(figsize=(32,18))
em_ax = e_mean.add_subplot(111)
em_ax.plot(ts['Burst'], ts['EMean'], 'ro', label='Enzyme Mean')
em_ax.set_x... | mit |
yousrabk/mne-python | examples/preprocessing/plot_eog_artifact_histogram.py | 11 | 1465 | """
========================
Show EOG artifact timing
========================
Compute the distribution of timing for EOG artifacts.
"""
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets im... | bsd-3-clause |
tongwang01/tensorflow | tensorflow/contrib/learn/python/learn/estimators/classifier_test.py | 16 | 5175 | # 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 |
cbertinato/pandas | pandas/compat/numpy/function.py | 1 | 14392 | """
For compatibility with numpy libraries, pandas functions or
methods have to accept '*args' and '**kwargs' parameters to
accommodate numpy arguments that are not actually used or
respected in the pandas implementation.
To ensure that users do not abuse these parameters, validation
is performed in 'validators.py' to... | bsd-3-clause |
harish-garg/Machine-Learning | udacity/evaluation_metrics/evaluate_accuracy.py | 1 | 1541 | #
# In this and the following exercises, you'll be adding train test splits to the data
# to see how it changes the performance of each classifier
#
# The code provided will load the Titanic dataset like you did in project 0, then train
# a decision tree (the method you used in your project) and a Bayesian classifier (... | mit |
prasadtalasila/MailingListParser | test/integration_test/lib/analysis/author/test_curve_fiting.py | 1 | 5027 | from lib.analysis.author.curve_fitting import *
import unittest
import mock
def test_inv_func():
x = 5
a = 10
b = 25
c = 7
assert inv_func(x, a, b, c) == 10
def test_generate_crt_dist():
csv_filename = './test/integration_test/data/conversation_refresh_times.csv'
req_re_times = ([106.01... | gpl-3.0 |
kmike/scikit-learn | examples/covariance/plot_sparse_cov.py | 4 | 5035 | """
======================================
Sparse inverse covariance estimation
======================================
Using the GraphLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matrix, t... | bsd-3-clause |
sureshthalamati/spark | examples/src/main/python/sql/arrow.py | 13 | 3997 | #
# 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 |
telecombcn-dl/2017-cfis | sessions/utils.py | 1 | 2978 | import matplotlib.pyplot as plt
import numpy as np
import itertools
import keras.backend as K
def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
"""
This function prints and plots th... | mit |
pyrrho314/recipesystem | trunk/gempy/scripts/zp_histogram.py | 1 | 3432 | #!/usr/bin/env python
# This tool plots some useful plots for seeing what's going on with zeropoint
# estimates from the QAP.
#
# This was developed as a quick analysis tool to asess QAP ZP and CC numbers
# and to understand comparisons with certain people's skygazing results, but I'm sure
# it would be useful for the... | mpl-2.0 |
pprett/scikit-learn | benchmarks/bench_random_projections.py | 397 | 8900 | """
===========================
Random projection benchmark
===========================
Benchmarks for random projections.
"""
from __future__ import division
from __future__ import print_function
import gc
import sys
import optparse
from datetime import datetime
import collections
import numpy as np
import scipy.s... | bsd-3-clause |
lmcinnes/hdbscan | hdbscan/plots.py | 1 | 32608 | # -*- coding: utf-8 -*-
# Author: Leland McInnes <leland.mcinnes@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from scipy.cluster.hierarchy import dendrogram
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from sklearn.metrics import pairwise_distances
from warnings import warn
from ... | bsd-3-clause |
idekerlab/graph-services | services/ig_community/service/test/myservice.py | 1 | 1621 | import cxmate
import logging
import seaborn as sns
from Adapter import IgraphAdapter
from handlers import CommunityDetectionHandlers
logging.basicConfig(level=logging.DEBUG)
# Label for CXmate output
OUTPUT_LABEL = 'out_net'
# Community detection algorithm name
ALGORITHM_TYPE = 'type'
# Palette name
PALETTE_NAME =... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.