repo_name stringlengths 6 67 | path stringlengths 5 185 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 1.02k 962k | license stringclasses 15
values |
|---|---|---|---|---|---|
breedlun/clearplot | clearplot/custom_annotations.py | 1 | 12108 | # -*- coding: utf-8 -*-
#Created on Fri Oct 10 19:39:21 2014
#@author: Benjamin Reedlunn
import matplotlib as _mpl
import numpy as _np
##==============================================================================
## Circle Box
##==============================================================================
#
#cla... | mit |
detrout/debian-statsmodels | examples/python/generic_mle.py | 33 | 7532 |
## Maximum Likelihood Estimation (Generic models)
# This tutorial explains how to quickly implement new maximum likelihood models in `statsmodels`. We give two examples:
#
# 1. Probit model for binary dependent variables
# 2. Negative binomial model for count data
#
# The `GenericLikelihoodModel` class eases the p... | bsd-3-clause |
xhray/iislogs | iislogs/views.py | 1 | 1811 | # -*- coding: UTF-8 -*-
from django.shortcuts import render_to_response, render
from django.http import HttpResponseRedirect, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from models import iis_logs, hit_stats
from forms import HitStatQueryForm
from datetime import datetime
import matplotlib.pypl... | apache-2.0 |
inflector/opencog | opencog/python/spatiotemporal/temporal_events/relation_formulas.py | 33 | 19534 | from math import fabs, sqrt, floor
from numpy import convolve, NINF as NEGATIVE_INFINITY, PINF as POSITIVE_INFINITY
import numpy
from scipy.stats.distributions import uniform_gen
from spatiotemporal.temporal_events.util import calculate_bounds_of_probability_distribution
from spatiotemporal.temporal_interval_handling i... | agpl-3.0 |
vortex-ape/scikit-learn | sklearn/feature_extraction/tests/test_dict_vectorizer.py | 9 | 3600 | # Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from random import Random
import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_equal
import pytest
from sklearn.utils.testing import (assert_equal, assert_in,
... | bsd-3-clause |
boada/planckClusters | observing/mkObservingPlan_mosaic.py | 1 | 3578 | import astroplan
from astroplan import Observer, FixedTarget, ObservingBlock
from astroplan.constraints import AtNightConstraint, AirmassConstraint,\
TimeConstraint
from astroplan.scheduling import Transitioner, SequentialScheduler, Schedule,\
PriorityScheduler
from astropy.coord... | mit |
georgetown-analytics/bike-psychics | GitCapBikeFeatures.py | 1 | 3354 | # Author: Selma Gomez Orr <selmagomezorr@gmail.com> Copyright (C) May 2, 2015
##########################################################################
## Imports
##########################################################################
import os
import pandas as pd
import numpy as np
import xlrd
from sklearn.cross_... | mit |
chrsrds/scikit-learn | sklearn/cluster/spectral.py | 2 | 21118 | # -*- coding: utf-8 -*-
"""Algorithms for spectral clustering"""
# Author: Gael Varoquaux gael.varoquaux@normalesup.org
# Brian Cheung
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import check_rand... | bsd-3-clause |
weidel-p/nest-simulator | pynest/examples/repeated_stimulation.py | 2 | 4210 | # -*- coding: utf-8 -*-
#
# repeated_stimulation.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 Li... | gpl-2.0 |
TomAugspurger/pandas | pandas/tests/base/test_conversion.py | 1 | 14519 | import numpy as np
import pytest
from pandas.core.dtypes.common import is_datetime64_dtype, is_timedelta64_dtype
from pandas.core.dtypes.dtypes import DatetimeTZDtype
import pandas as pd
from pandas import CategoricalIndex, Series, Timedelta, Timestamp
import pandas._testing as tm
from pandas.core.arrays import (
... | bsd-3-clause |
lhirschfeld/JargonBot | jargonbot.py | 1 | 5805 | # Lior Hirschfeld
# JargonBot
# -- Imports --
import re
import pickle
import random
import praw
from custombot import RedditBot
from time import sleep
from define import getDefinition
from collections import Counter
from nltk.stem import *
from sklearn import linear_model
# -- Setup Variables --
jargonBot = RedditBo... | mit |
liangfok/controlit_demos | dreamer_controlit_demos/nodes/HandTap.py | 1 | 4435 | #!/usr/bin/env python
'''
Publishes goals to make Dreamer flap her right hand.
'''
import sys, getopt # for getting and parsing command line arguments
import time
import math
import threading
import rospy
from std_msgs.msg import Float64MultiArray, MultiArrayDimension
# import numpy as np
# from scipy.interpolat... | lgpl-2.1 |
cbmoore/statsmodels | statsmodels/datasets/copper/data.py | 28 | 2316 | """World Copper Prices 1951-1975 dataset."""
__docformat__ = 'restructuredtext'
COPYRIGHT = """Used with express permission from the original author,
who retains all rights."""
TITLE = "World Copper Market 1951-1975 Dataset"
SOURCE = """
Jeff Gill's `Generalized Linear Models: A Unified Approach`
http:/... | bsd-3-clause |
perryjohnson/biplaneblade | biplane_blade_lib/layer_plane_angles_stn24.py | 1 | 9805 | """Determine the layer plane angle of all the elements in a grid.
Author: Perry Roth-Johnson
Last modified: May 1, 2014
Usage:
1. Look through the mesh_stnXX.abq file and find all the element set names.
(Find all the lines that start with "*ELSET".)
2. Enter each of the element set names in one of the four... | gpl-3.0 |
sonnyhu/scikit-learn | sklearn/gaussian_process/tests/test_gpr.py | 11 | 11915 | """Testing for Gaussian process regression """
# Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from scipy.optimize import approx_fprime
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels \
import RBF, Constan... | bsd-3-clause |
mediagit2016/workcamp-maschinelles-lernen-grundlagen | 17-12-11-workcamp-ml/mglearn/datasets.py | 1 | 1909 | import numpy as np
import pandas as pd
import os
from scipy import signal
from sklearn.datasets import load_boston
from sklearn.preprocessing import MinMaxScaler, PolynomialFeatures
from .make_blobs import make_blobs
DATA_PATH = os.path.join(os.path.dirname(__file__), "..", "data")
def make_forge():
# a carefull... | gpl-3.0 |
amaggi/bda | chapter_03/ex_04.py | 1 | 1516 | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import uniform
from scipy.integrate import trapz
from sample_via_cdf import sample_via_cdf
N0 = 674
N0D = 39
N1 = 680
N1D = 22
NPTS = 100
NSAMP = 1000
# set the same uniform prior for the two cases
prior = uniform(0, 0.2)
p0 = np.linspace(prior.ppf... | gpl-2.0 |
solvebio/solvebio-python | solvebio/utils/tabulate.py | 1 | 20872 | # -*- coding: utf-8 -*-
#
# This file contains code from python-tabulate, modified for SolveBio
#
# Copyright © 2011-2013 Sergey Astanin
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software with... | mit |
RPGOne/Skynet | scikit-learn-0.18.1/examples/linear_model/plot_multi_task_lasso_support.py | 102 | 2319 | #!/usr/bin/env python
"""
=============================================
Joint feature selection with multi-task Lasso
=============================================
The multi-task lasso allows to fit multiple regression problems
jointly enforcing the selected features to be the same across
tasks. This example simulates... | bsd-3-clause |
mahak/spark | python/pyspark/sql/pandas/typehints.py | 26 | 6324 | #
# 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 |
sarahgrogan/scikit-learn | examples/linear_model/plot_sgd_penalties.py | 249 | 1563 | """
==============
SGD: Penalties
==============
Plot the contours of the three penalties.
All of the above are supported by
:class:`sklearn.linear_model.stochastic_gradient`.
"""
from __future__ import division
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
def l1(xs):
return np.array([np.... | bsd-3-clause |
hrjn/scikit-learn | examples/applications/topics_extraction_with_nmf_lda.py | 21 | 4784 | """
=======================================================================================
Topic extraction with Non-negative Matrix Factorization and Latent Dirichlet Allocation
=======================================================================================
This is an example of applying :class:`sklearn.deco... | bsd-3-clause |
Mistobaan/tensorflow | tensorflow/contrib/learn/python/learn/estimators/estimators_test.py | 9 | 6700 | # 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 |
ssanderson/dask | dask/dataframe/tests/test_rolling.py | 6 | 2485 | import pandas as pd
import pandas.util.testing as tm
import numpy as np
import dask.dataframe as dd
from dask.async import get_sync
from dask.utils import raises, ignoring
def eq(p, d):
if isinstance(d, dd.DataFrame):
tm.assert_frame_equal(p, d.compute(get=get_sync))
else:
tm.assert_series_eq... | bsd-3-clause |
yanchen036/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/pandas_io.py | 28 | 5024 | # 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 |
srio/Diffraction | correlation_lengths.py | 1 | 3847 | """
correlation_lengths.py: calculates
"""
import numpy
__author__ = "Manuel Sanchez del Rio"
__contact__ = "srio@esrf.eu"
__copyright = "ESRF, 2016"
def std0(x):
mu = 0.0 # x.mean()
return numpy.sqrt(numpy.mean(abs(x - mu)**2))
def coherence_length_longitudinal(lambda1,lambda2,lambda0=None):
delta... | gpl-2.0 |
tanmoy7989/idp | analyzeGo.py | 1 | 11444 | '''/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <tanmoy.7989@gmail.com> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, yo... | gpl-3.0 |
musically-ut/statsmodels | statsmodels/datasets/fertility/data.py | 26 | 2511 | #! /usr/bin/env python
"""World Bank Fertility Data."""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This data is distributed according to the World Bank terms of use. See SOURCE."""
TITLE = """World Bank Fertility Data"""
SOURCE = """
This data has been acquired from
The World Bank: Fertility rat... | bsd-3-clause |
RuthAngus/turnip | turnip/calc_completeness.py | 1 | 1492 | """
Ruth's version of Burke's test_comp_grid.py as a function.
"""
import numpy as np
import matplotlib.pyplot as plt
import KeplerPORTs_utils as kpu
def calc_comp(kepid, period, radius):
"""
Calculate the completeness at a given radius and period for a KIC star.
This includes the probability of transiti... | mit |
michigraber/scikit-learn | sklearn/feature_extraction/text.py | 24 | 50103 | # -*- coding: utf-8 -*-
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck <L.J.Buitinck@uva.nl>
# Robert Layton <robertlayton@gmail.com>
# Jochen Wersdörfer <jochen@wersdoerfer.de>
# Roman Sinayev <roman.sinayev@gma... | bsd-3-clause |
jpbarraca/dRonin | python/calibration/mag_calibration.py | 1 | 4547 | #!/usr/bin/env python
from numpy import *
from matplotlib.pylab import *
def mag_calibration(mag,gyros=None,LH=200,LV=500):
""" Calibrates the magnetometer data by fitting it to a sphere,
ideally when constantly turning to spread the data around that
sphere somewhat evenly (or at least in a ho... | gpl-3.0 |
macks22/gensim | gensim/sklearn_api/w2vmodel.py | 1 | 3341 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-lear... | lgpl-2.1 |
Haleyo/spark-tk | regression-tests/sparktkregtests/testcases/frames/frame_matrix_datatype_test.py | 11 | 8964 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | apache-2.0 |
moutai/scikit-learn | sklearn/model_selection/_validation.py | 2 | 36962 | """
The :mod:`sklearn.model_selection._validation` module includes classes and
functions to validate the model.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from __... | bsd-3-clause |
SyntaxVoid/PyFusionGUI | pyfusion/acquisition/MDSPlus/h1ds.py | 1 | 5339 | """Python module for the H1 data system.
This code works with python2 and python3.
It is assumed most users will be using python2, so the general
design pattern is
try:
python2 code
except (ImportError, etc):
python3 code
Dependencies: numpy
Optional: matplotlib (for plotting)
"""
try: # python2
from urlp... | gpl-3.0 |
mrshu/scikit-learn | examples/document_clustering.py | 1 | 3298 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
nmayorov/scikit-learn | sklearn/tests/test_kernel_approximation.py | 78 | 7586 | import numpy as np
from scipy.sparse import csr_matrix
from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true
from sklearn.utils.testing import assert_not_equal
from sklearn.utils.testing import assert_array_almost_equal, assert_raises
from sklearn.utils.testing import assert_less_equal
from ... | bsd-3-clause |
zutshi/S3CAMX | examples/dc_motor/dc_motor.py | 1 | 3624 | # Must satisfy the signature
# [t,X,D,P] = sim_function(T,X0,D0,P0,I0);
import numpy as np
from scipy.integrate import ode
#import matplotlib.pyplot as plt
J = 0.01
K = 0.01
L = 0.5
R = 1.0
b = 0.1
A = np.matrix([[-b/J, K/J], [-K/L, -R/L]])
B = np.matrix([[0.0, -1/J], [1/L, 0.0]])
C = np.matrix([1.0, 0.0])
D = np.m... | bsd-2-clause |
ECP-CANDLE/Benchmarks | common/darts/meters/epoch.py | 1 | 1196 | import os
import pandas as pd
from darts.meters.average import AverageMeter
from darts.meters.accuracy import MultitaskAccuracyMeter
class EpochMeter:
""" Track epoch loss and accuracy """
def __init__(self, tasks, name='train'):
self.name = name
self.loss_meter = AverageMeter(name)
... | mit |
yasirkhan380/Tutorials | notebooks/fig_code/helpers.py | 74 | 2301 | """
Small helpers for code that is not shown in the notebooks
"""
from sklearn import neighbors, datasets, linear_model
import pylab as pl
import numpy as np
from matplotlib.colors import ListedColormap
# Create color maps for 3-class classification problem, as with iris
cmap_light = ListedColormap(['#FFAAAA', '#AAFF... | bsd-3-clause |
niliafsari/KSP-SN | compileSN.py | 1 | 5339 | import urllib
import os
import glob
import subprocess
import commands
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from astropy.time import Time
from moon import *
import csv
import json
from pprint import pprint
import os.path
import sys
sys.path.insert(0, '/home/afsari/')
from SNAP2.Analysis... | bsd-3-clause |
SingTel-DataCo/incubator-superset | superset/sql_lab.py | 2 | 8487 | from time import sleep
from datetime import datetime
import json
import logging
import pandas as pd
import sqlalchemy
import uuid
from celery.exceptions import SoftTimeLimitExceeded
from sqlalchemy.pool import NullPool
from sqlalchemy.orm import sessionmaker
from superset import (
app, db, utils, dataframe, resul... | apache-2.0 |
tonysyu/mpltools | mpltools/style/core.py | 2 | 3069 | import os
import glob
import copy
import numpy as np
import matplotlib.pyplot as plt
from .. import _config
__all__ = ['use', 'available', 'lib', 'baselib']
def use(name=None, use_baselib=False):
"""Use matplotlib rc parameters from a pre-defined name or from a file.
Parameters
----------
name : ... | bsd-3-clause |
flightgong/scikit-learn | examples/feature_stacker.py | 14 | 1941 | """
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... | bsd-3-clause |
alimuldal/numpy | numpy/lib/function_base.py | 6 | 164887 | from __future__ import division, absolute_import, print_function
import collections
import operator
import re
import sys
import warnings
import numpy as np
import numpy.core.numeric as _nx
from numpy.core import linspace, atleast_1d, atleast_2d, transpose
from numpy.core.numeric import (
ones, zeros, arange, conc... | bsd-3-clause |
FrederichRiver/neutrino | applications/venus/venus/stock_flag.py | 1 | 2566 | #!/usr/bin/python3
from venus.stock_base import StockEventBase
class EventStockFlag(StockEventBase):
def flag_quit_stock(self, stock_code):
import datetime
import pandas as pd
from datetime import date
from dev_global.env import TIME_FMT
result = self.mysql.select_values(st... | bsd-3-clause |
elijah513/scikit-learn | sklearn/linear_model/tests/test_base.py | 120 | 10082 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.linear_model.... | bsd-3-clause |
xzh86/scikit-learn | sklearn/linear_model/tests/test_theil_sen.py | 234 | 9928 | """
Testing for Theil-Sen module (sklearn.linear_model.theil_sen)
"""
# Author: Florian Wilhelm <florian.wilhelm@gmail.com>
# License: BSD 3 clause
from __future__ import division, print_function, absolute_import
import os
import sys
from contextlib import contextmanager
import numpy as np
from numpy.testing import ... | bsd-3-clause |
jereze/scikit-learn | sklearn/neighbors/tests/test_neighbors.py | 76 | 45197 | from itertools import product
import pickle
import numpy as np
from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix,
dok_matrix, lil_matrix)
from sklearn import metrics
from sklearn.cross_validation import train_test_split, cross_val_score
from sklearn.utils.testing impor... | bsd-3-clause |
Frank-Wu/stratosphere-streaming | flink-streaming-connectors/src/test/resources/Performance/PerformanceTracker.py | 2 | 4050 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 30 15:40:17 2014
@author: gyfora
"""
import matplotlib.pyplot as plt
import pandas as pd
import os
import operator
linestyles = ['_', '-', '--', ':']
markers=['D','s', '|', '', 'x', '_', '^', ' ', 'd', 'h', '+', '*', ',', 'o', '.', '1', 'p', 'H', 'v', '>'];... | apache-2.0 |
schoolie/bokeh | bokeh/charts/builders/horizon_builder.py | 6 | 6668 | """This is the Bokeh charts interface. It gives you a high level API
to build complex plot is a simple way.
This is the Horizon class which lets you build your Horizon charts
just passing the arguments to the Chart class and calling the proper
functions.
"""
#-----------------------------------------------------------... | bsd-3-clause |
deepchem/deepchem | deepchem/data/data_loader.py | 2 | 47681 | """
Process an input dataset into a format suitable for machine learning.
"""
import os
import tempfile
import zipfile
import time
import logging
import warnings
from typing import List, Optional, Tuple, Any, Sequence, Union, Iterator
import pandas as pd
import numpy as np
from deepchem.utils.typing import OneOrMany
... | mit |
DistrictDataLabs/yellowbrick | tests/test_style/test_colors.py | 1 | 11606 | # tests.test_style.test_colors
# Tests for the color utilities and helpers module
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Thu Oct 06 09:30:49 2016 -0400
#
# Copyright (C) 2016 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: test_colors.py [c6aff34] benjam... | apache-2.0 |
scizen9/kpy | SEDMrph/flexure_test.py | 1 | 6205 | # -*- coding: utf-8 -*-
"""
Created on Mon May 9 12:25:51 2016
@author: nblago
"""
import matplotlib
matplotlib.use("Agg")
import sextractor
import glob, os
import numpy as np
from astropy.coordinates import SkyCoord
from matplotlib import pylab as plt
import argparse
from astropy.io import fits as pf
import fitsuti... | gpl-2.0 |
kdebrab/pandas | pandas/tests/indexing/test_categorical.py | 5 | 26870 | # -*- coding: utf-8 -*-
import pytest
import pandas as pd
import pandas.compat as compat
import numpy as np
from pandas import (Series, DataFrame, Timestamp, Categorical,
CategoricalIndex, Interval, Index)
from pandas.util.testing import assert_series_equal, assert_frame_equal
from pandas.util imp... | bsd-3-clause |
rudischilder/gr10_2 | sw/tools/tcp_aircraft_server/phoenix/__init__.py | 86 | 4470 | #Copyright 2014, Antoine Drouin
"""
Phoenix is a Python library for interacting with Paparazzi
"""
import math
"""
Unit convertions
"""
def rad_of_deg(d): return d/180.*math.pi
def deg_of_rad(r): return r*180./math.pi
def rps_of_rpm(r): return r*2.*math.pi/60.
def rpm_of_rps(r): return r/2./math.pi*60.
def m_of_i... | gpl-2.0 |
teonlamont/pyeparse | pyeparse/viz.py | 2 | 17741 | # Authors: Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import math
from collections import deque
from functools import partial
from .utils import create_chunks, fwhm_kernel_2d
from ._fixes import string_types
def plot_raw(raw, events=None, title='Raw', show=True):
"""... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/indexes/interval/test_construction.py | 2 | 16294 | from functools import partial
import numpy as np
import pytest
from pandas.core.dtypes.common import is_categorical_dtype
from pandas.core.dtypes.dtypes import IntervalDtype
from pandas import (
Categorical,
CategoricalIndex,
Float64Index,
Index,
Int64Index,
Interval,
IntervalIndex,
d... | apache-2.0 |
loli/semisupervisedforests | examples/svm/plot_weighted_samples.py | 69 | 1942 | """
=====================
SVM: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
The sample weighting rescales the C parameter, which means that the classifier
puts more emphasis on getting these points right. The effect might ... | bsd-3-clause |
beiko-lab/timeclust | ananke/_tabulate.py | 2 | 17275 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module provides functionality for tabulating sequence files (FASTA) into
an Ananke HDF5 file.
"""
import sys
import warnings
import hashlib
import pandas as pd
import numpy as np
from collections import defaultdict
from scipy.sparse import csr_matrix
from ._datab... | gpl-3.0 |
gwulfs/zipline | zipline/algorithm.py | 2 | 48191 | #
# Copyright 2014 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 |
huzq/scikit-learn | sklearn/decomposition/_incremental_pca.py | 2 | 14223 | """Incremental Principal Components Analysis."""
# Author: Kyle Kastner <kastnerkyle@gmail.com>
# Giorgio Patrini
# License: BSD 3 clause
import numpy as np
from scipy import linalg, sparse
from ._base import _BasePCA
from ..utils import check_array, gen_batches
from ..utils.extmath import svd_flip, _increme... | bsd-3-clause |
maheshakya/scikit-learn | examples/linear_model/plot_lasso_lars.py | 363 | 1080 | #!/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 |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/matplotlib/tests/test_axes.py | 1 | 20378 | import numpy as np
from numpy import ma
import matplotlib
from matplotlib.testing.decorators import image_comparison, knownfailureif
import matplotlib.pyplot as plt
@image_comparison(baseline_images=['formatter_ticker_001',
'formatter_ticker_002',
... | gpl-2.0 |
hitszxp/scikit-learn | examples/neighbors/plot_species_kde.py | 282 | 4059 | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric... | bsd-3-clause |
liam2/larray | setup.py | 1 | 1809 | from __future__ import print_function
import os
from setuptools import setup, find_packages
def readlocal(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
DISTNAME = 'larray'
VERSION = '0.32.1'
AUTHOR = 'Gaetan de Menten, Geert Bryon, Johan Duyck, Alix Damman'
AUTHOR_EMAIL = 'gdemente... | gpl-3.0 |
fengzhyuan/scikit-learn | sklearn/manifold/tests/test_locally_linear.py | 232 | 4761 | 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 |
cosmoharrigan/pylearn2 | pylearn2/train_extensions/plots.py | 34 | 9617 | """
Plot monitoring extensions while training.
"""
__authors__ = "Laurent Dinh"
__copyright__ = "Copyright 2014, Universite de Montreal"
__credits__ = ["Laurent Dinh"]
__license__ = "3-clause BSD"
__maintainer__ = "Laurent Dinh"
__email__ = "dinhlaur@iro"
import logging
import os
import os.path
import stat
import num... | bsd-3-clause |
untom/scikit-learn | sklearn/semi_supervised/label_propagation.py | 128 | 15312 | # coding=utf8
"""
Label propagation in the context of this module refers to a set of
semisupervised classification algorithms. In the high level, these algorithms
work by forming a fully-connected graph between all points given and solving
for the steady-state distribution of labels at each point.
These algorithms per... | bsd-3-clause |
McDermott-Group/LabRAD | LabRAD/Measurements/General/waveform.py | 1 | 22660 | # Copyright (C) 2015 Samuel Owen, Ivan Pechenezhskiy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program ... | gpl-2.0 |
sebchalmers/DynOPFlow | DynOPFlow.py | 1 | 55808 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 20:18:08 2012
@author:
Sebastien Gros
Assistant Professor
Department of Signals and Systems
Chalmers University of Technology
SE-412 96 Göteborg, SWEDEN
grosse@chalmers.se
Python/casADi Module:
NMPC for Dynamic Optimal Power Flow and Power Dispatch
Requires the in... | gpl-2.0 |
genialis/resolwe-bio | resolwe_bio/tools/plot_enhancers.py | 1 | 1984 | #!/usr/bin/env python3
"""Parse coordinates for the hockey-stick plot."""
import argparse
import json
import pandas as pd
from resolwe_runtime_utils import error, send_message
parser = argparse.ArgumentParser(
description="Parse coordinates for the hockey-stick plot."
)
parser.add_argument("input_data", help="Inp... | apache-2.0 |
smharper/psipy | psipy/read_data.py | 1 | 9005 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
class Viewer(object):
def __init__(self, df):
# Initialize data attribues.
self.df = df.copy()
self.energy_edges = np.array([])
self.azim_edges = np.array([])
self.coords = [0, 0, 0... | mit |
ioam/svn-history | topo/tests/__init__.py | 2 | 8892 | """
Unit tests for Topographica.
Use the 'run' function to run all the tests.
We use unittest and doctest to create tests. The run() function calls
tests in files in topo/tests/ that:
* have a name beginning with 'test' and ending with '.py', if the file
defines the 'suite' attribute;
* have a name beginning with '... | bsd-3-clause |
CDSFinance/zipline | tests/risk/answer_key.py | 39 | 11989 | #
# Copyright 2014 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 |
HeraclesHX/scikit-learn | examples/text/document_clustering.py | 230 | 8356 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
richardwolny/sms-tools | lectures/09-Sound-description/plots-code/knn.py | 25 | 1718 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import os, sys
from numpy import random
from scipy.stats import mode
def eucDist(vec1, vec2):
return np.sqrt(np.sum(np.power(np.array(vec1) - np.array(vec2), 2)))
n = 30
qn = 8
K = 3
class1 = np.transpose(np.array([np.random.norm... | agpl-3.0 |
yarikoptic/pystatsmodels | statsmodels/datasets/strikes/data.py | 3 | 1928 | #! /usr/bin/env python
"""U.S. Strike Duration Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
This is a subset of the data used in Kennan (1985). It was originally
published by the Bureau of Labor Statistics.
::
Kennan, J. 1985. "The... | bsd-3-clause |
yunlongliukm/chm1_scripts | GC_content_explore.py | 2 | 8819 | #!/usr/bin/env python
import pysam
import re
import matplotlib
import matplotlib.pyplot as plt
import numpy
from pbcore.io import CmpH5Reader
from pbcore.io import CmpH5Alignment
def IdentityFromCIGAR(cigar):
nMatch = 0
nIns = 0
nDel = 0
for cig in cigar:
if (cig[0] == 0):
nMat... | mit |
ogrisel/scipy | scipy/special/c_misc/struve_convergence.py | 76 | 3725 | """
Convergence regions of the expansions used in ``struve.c``
Note that for v >> z both functions tend rapidly to 0,
and for v << -z, they tend to infinity.
The floating-point functions over/underflow in the lower left and right
corners of the figure.
Figure legend
=============
Red region
Power series is clo... | bsd-3-clause |
aewhatley/scikit-learn | examples/datasets/plot_random_dataset.py | 348 | 2254 | """
==============================================
Plot randomly generated classification dataset
==============================================
Plot several randomly generated 2D classification datasets.
This example illustrates the :func:`datasets.make_classification`
:func:`datasets.make_blobs` and :func:`datasets.... | bsd-3-clause |
talitaof/pulp | doc/source/_static/plotter.py | 4 | 1267 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from matplotlib import rc
rc('text', usetex=True)
rc('font', family='serif')
def plot_interval(a,c,x_left, x_right,i, fbound):
lh = c*(1-a[0])
rh = c*(1+a[1])
x=arange(x_left, x_right+1)
y=0*x
arrow_r = Arrow(c,0, c*a[1],0,0.2)
arrow_l = Arrow(... | mit |
stggh/PyAbel | examples/example_hansenlaw.py | 2 | 3117 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import abel
import matplotlib.pylab as plt
import bz2
# Hansen and Law inverse Abel transform of velocity-map imaged electrons
# from O2- photodetachement at 454 nm.... | mit |
alexis-roche/nipy | examples/labs/bayesian_structural_analysis.py | 2 | 3988 | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function # Python 2/3 compatibility
__doc__ = """
This script generates a noisy multi-subject activation image dataset
and applies the Bayesian structural ... | bsd-3-clause |
jayflo/scikit-learn | sklearn/cluster/birch.py | 207 | 22706 | # Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Joel Nothman <joel.nothman@gmail.com>
# License: BSD 3 clause
from __future__ import division
import warnings
import numpy as np
from scipy import sparse
from math import sqrt
fro... | bsd-3-clause |
nal-epfl/line-sigcomm14 | plotting-scripts/plot-data.py | 1 | 36287 | #!/usr/bin/env python2
# Install dependencies:
# sudo apt-get install python-matplotlib dvipng
import colorsys
import getopt
import json
from nicePlot import nicePlot
import math
import numpy
import os
import pprint
import re
import subprocess
import sys
## Params
dataFile = 'data-plot1.txt'
latencyFile = 'latency.... | gpl-2.0 |
ichmonkey/graph | band.py | 1 | 3690 | """
You can use the proper typesetting unicode minus (see
http://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hypen
for minus, which some people prefer. The matplotlibrc param
ax1es.unicode_minus controls the default behavior.
The default is to use the unicode minus
"""
import numpy as np
import matplotlib... | gpl-2.0 |
tbpmig/mig-website | mig_main/demographics.py | 1 | 10847 | import numpy
from matplotlib import pyplot
from django.db.models import Count
from django.http import HttpResponse
from event_cal.models import CalendarEvent
from history.models import Distinction, Officer
from mig_main.models import (
MemberProfile,
Major,
S... | apache-2.0 |
chrisburr/scikit-learn | benchmarks/bench_plot_omp_lars.py | 266 | 4447 | """Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
regression (:ref:`least_angle_regression`)
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model impo... | bsd-3-clause |
fyffyt/scikit-learn | examples/cluster/plot_kmeans_digits.py | 230 | 4524 | """
===========================================================
A demo of K-Means clustering on the handwritten digits data
===========================================================
In this example we compare the various initialization strategies for
K-means in terms of runtime and quality of the results.
As the gr... | bsd-3-clause |
arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/audioSearch/scoreFollower.py | 1 | 22926 | # -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Name: audioSearch.scoreFollower.py
# Purpose: Detection of the position in the score in real time
#
#
# Authors: Jordi Bartolome
# Michael Scott Cuthbert
#
# Copyright: C... | mit |
chiahaoliu/pdf_lib | pdf_lib/qdamp_test.py | 1 | 1510 | import os
import time
import yaml
import json
import datetime
import numpy as np
import pandas as pd
from time import strftime
from pprint import pprint
import matplotlib.pyplot as plt
from diffpy.Structure import loadStructure
from diffpy.Structure import StructureFormatError
from diffpy.srreal.structureadapter impor... | mit |
vybstat/scikit-learn | sklearn/utils/tests/test_extmath.py | 70 | 16531 | # Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis Engemann <d.engemann@fz-juelich.de>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from scipy import linalg
from scipy import stats
from sklearn.utils.testing import assert_eq... | bsd-3-clause |
MicrosoftGenomics/FaST-LMM | fastlmm/association/single_snp_linreg.py | 1 | 8395 | from fastlmm.util.runner import *
import logging
import fastlmm.pyplink.plink as plink
from pysnptools.snpreader import Pheno
import pysnptools.util as pstutil
import fastlmm.util.util as flutil
import numpy as np
import scipy.stats as stats
from pysnptools.snpreader import Bed
from fastlmm.util.pickle_io import load, ... | apache-2.0 |
meteokid/python-rpn | share/examples/plot-irregular.py | 1 | 4140 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Kristjan Onu <Kristjan.Onu@canada.ca>
"""
Use Basemap to plot data from a RPN Standard File on an X grid-type
Usage:
# Define CMCGRIDF
. ssmuse-sh -d cmoi/base/20160901
plot-irregular.py
See Also:
https://basemaptutorial.readthedocs.org/en/latest/
"... | lgpl-2.1 |
kingtaurus/cs224d | assignment2/test_confusion.py | 1 | 1352 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow as tf
confusion = np.array([[42452, 27, 45, 175, 60],
[ 255, 1636, 12, 152, 39],
[ 317, 26, 863, 42, 20],
[ 598, 73, 31, 131... | mit |
woodscn/scipy | scipy/spatial/tests/test__plotutils.py | 55 | 1567 | from __future__ import division, print_function, absolute_import
from numpy.testing import dec, assert_, assert_array_equal
try:
import matplotlib
matplotlib.rcParams['backend'] = 'Agg'
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
has_matplotlib = True
except:
... | bsd-3-clause |
BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/core/categorical.py | 1 | 66886 | # pylint: disable=E1101,W0232
import numpy as np
from warnings import warn
import types
from pandas import compat, lib
from pandas.compat import u
from pandas.core.algorithms import factorize, take_1d
from pandas.core.base import (PandasObject, PandasDelegate,
NoNewAttributesMixin, _sha... | mit |
pprett/scikit-learn | examples/applications/wikipedia_principal_eigenvector.py | 50 | 7817 | """
===============================
Wikipedia principal eigenvector
===============================
A classical way to assert the relative importance of vertices in a
graph is to compute the principal eigenvector of the adjacency matrix
so as to assign to each vertex the values of the components of the first
eigenvect... | bsd-3-clause |
tawsifkhan/scikit-learn | examples/neighbors/plot_species_kde.py | 282 | 4059 | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.