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 |
|---|---|---|---|---|---|
joefutrelle/pyifcb | ifcb/data/identifiers.py | 1 | 13670 | """
Support for parsing IFCB permanent identifiers (a.k.a., pids).
"""
import re
from functools import lru_cache
import pandas as pd
### parsing
# supports time-like regexes e.g., IFCB9_yyyy_YYY_HHMMSS
@lru_cache()
def timestamp2regex(pattern):
"""
Convert a special "timestamp" expression into a regex patte... | mit |
evanbiederstedt/RRBSfun | scripts/methylation_normal_B3.py | 1 | 1941 |
import glob
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib
import os
os.chdir('/Users/evanbiederstedt/Downloads/RRBS_data_files')
# set glob subdirectory via cell batch
mcells = glob.glob("RRBS_NormalBCD19pCD27mcell*")
newdf1 = pd.DataFrame()
for filena... | mit |
ysasaki6023/NeuralNetworkStudy | bayes_opt/bayesian_optimization.py | 1 | 11287 | from __future__ import print_function
from __future__ import division
import numpy as np
from sklearn.gaussian_process import GaussianProcess
from scipy.optimize import minimize
from .helpers import UtilityFunction, unique_rows, PrintLog
__author__ = 'fmfn'
def acq_max(ac, gp, y_max, bounds):
"""
A function ... | mit |
humdings/pynance-legacy | pynance/settings.py | 1 | 3546 | # -*- coding: utf-8 -*-
#
#Copyright (c) 2014 David Edwards
#
#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 without restriction, including without limitation the rights
#to use, copy, modify, ... | mit |
scottpurdy/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/lines.py | 69 | 48233 | """
This module contains all the 2D line class which can draw with a
variety of line styles, markers and colors.
"""
# TODO: expose cap and join style attrs
from __future__ import division
import numpy as np
from numpy import ma
from matplotlib import verbose
import artist
from artist import Artist
from cbook import ... | agpl-3.0 |
dsysoev/fun-with-algorithms | dynamicprogramming/performance.py | 1 | 3715 | # coding: utf-8
from __future__ import print_function
import os
import timeit
import argparse
import tempfile
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('seaborn')
import pandas as pd
# noinspection PyUnresolvedReferences
from cut_rod import cut_rod
# noinspection ... | mit |
stylianos-kampakis/scikit-learn | sklearn/linear_model/tests/test_base.py | 101 | 12205 | # 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 |
cogmission/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/mlab.py | 69 | 104273 | """
Numerical python functions written for compatability with matlab(TM)
commands with the same names.
Matlab(TM) compatible functions
-------------------------------
:func:`cohere`
Coherence (normalized cross spectral density)
:func:`csd`
Cross spectral density uing Welch's average periodogram
:func:`detrend`... | agpl-3.0 |
facaiy/spark | python/pyspark/sql/context.py | 6 | 21895 | #
# 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 |
mhdella/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 |
NelisVerhoef/scikit-learn | sklearn/decomposition/tests/test_dict_learning.py | 69 | 8605 | 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 |
huwenboshi/hess | misc/estimate_lambdagc.py | 1 | 3831 | import numpy as np, numpy.linalg
import pandas as pd
import sys,argparse,os,gzip
eps = 10.0**-8
def main():
# get command line
args = get_command_line()
# load step 1 results
info, eig, prjsq = load_local_hsqg_step1(args.prefix)
# compute emprical and theoretical
nloci = info.shape[0]
... | gpl-3.0 |
arhik/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... | agpl-3.0 |
ycaihua/scikit-learn | examples/semi_supervised/plot_label_propagation_digits_active_learning.py | 294 | 3417 | """
========================================
Label Propagation digits active learning
========================================
Demonstrates an active learning technique to learn handwritten digits
using label propagation.
We start by training a label propagation model with only 10 labeled points,
then we select the t... | bsd-3-clause |
rirwin/sandbox | optimal-stakeout/stakeout_optimal.py | 1 | 2398 | import random
import os
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from find_house_values_dp import *
from find_house_values_optimal import *
import math
os.system("date")
# Install GNU Linear programming kit for
# checking of optimality. For ubuntu the
# software is obtainable by:
#
# ... | mit |
Heappl/scripts | git_stats.py | 1 | 2632 | #!/usr/bin/python2
import subprocess, re, os, sys, datetime
import matplotlib.pyplot as plt
def parse_commandline_options():
from optparse import OptionParser
parser = OptionParser()
parser.add_option("", "--author", dest="author", help="User name to search commits by.")
parser.add_option("", "--s... | gpl-2.0 |
tomevans/pyphotom | photom_checks.py | 1 | 20227 | from photom import photom_relative
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker
import os
import pdb
import pyfits
import itertools
def auxiliary_variables( obj, headerkws=None ):
"""
Extracts various auxiliary variables for each of the images contained
within the photom obj... | gpl-2.0 |
ajaybhat/scikit-image | doc/examples/features_detection/plot_censure.py | 8 | 1167 | """
========================
CENSURE feature detector
========================
The CENSURE feature detector is a scale-invariant center-surround detector
(CENSURE) that claims to outperform other detectors and is capable of real-time
implementation.
"""
from skimage import data
from skimage import transform as tf
fro... | bsd-3-clause |
fqez/JdeRobot | src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavgraph.py | 4 | 10326 | #!/usr/bin/env python
'''
graph a MAVLink log file
Andrew Tridgell August 2011
'''
import sys, struct, time, os, datetime
import math, re
import matplotlib
from math import *
try:
from pymavlink.mavextra import *
except:
print("WARNING: Numpy missing, mathematical notation will not be supported.")
# cope wit... | gpl-3.0 |
kashif/scikit-learn | sklearn/cluster/tests/test_k_means.py | 41 | 27789 | """Testing for K-means"""
import sys
import numpy as np
from scipy import sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing i... | bsd-3-clause |
bsipocz/astroML | astroML/linear_model/tests/test_linear_regression.py | 2 | 3652 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from sklearn.linear_model import LinearRegression as skLinearRegression
from astroML.linear_model import \
LinearRegression, PolynomialRegression, BasisFunctionRegression
try:
import pymc3 as pm # noqa: F401
HAS_PYMC3 = True
exce... | bsd-2-clause |
AnasGhrab/scikit-learn | benchmarks/bench_isotonic.py | 268 | 3046 | """
Benchmarks of isotonic regression performance.
We generate a synthetic dataset of size 10^n, for n in [min, max], and
examine the time taken to run isotonic regression over the dataset.
The timings are then output to stdout, or visualized on a log-log scale
with matplotlib.
This alows the scaling of the algorith... | bsd-3-clause |
ankurankan/scikit-learn | sklearn/cluster/tests/test_birch.py | 7 | 5610 | """
Tests for the birch clustering algorithm.
"""
from scipy import sparse
import numpy as np
from .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.linear_model import El... | bsd-3-clause |
bd-j/prospector | prospect/io/read_results.py | 3 | 20576 | import sys, os
from copy import deepcopy
import warnings
import pickle, json
import numpy as np
try:
import h5py
except:
pass
try:
from sedpy.observate import load_filters
except:
pass
"""Convenience functions for reading and reconstructing results from a fitting
run, including reconstruction of the m... | mit |
bhargav/scikit-learn | examples/linear_model/plot_logistic_multinomial.py | 24 | 2480 | """
====================================================
Plot multinomial and One-vs-Rest Logistic Regression
====================================================
Plot decision surface of multinomial and One-vs-Rest Logistic Regression.
The hyperplanes corresponding to the three One-vs-Rest (OVR) classifiers
are repre... | bsd-3-clause |
fyffyt/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
bavardage/statsmodels | statsmodels/datasets/template_data.py | 3 | 1650 | #! /usr/bin/env python
"""Name of dataset."""
__docformat__ = 'restructuredtext'
COPYRIGHT = """E.g., This is public domain."""
TITLE = """Title of the dataset"""
SOURCE = """
This section should provide a link to the original dataset if possible and
attribution and correspondance information for the da... | bsd-3-clause |
low-sky/cloudpca | pca_utils.py | 1 | 9842 | import numpy as np
import astropy.io.fits as fits
from spectral_cube import SpectralCube
import numpy.fft as fft
from scipy.interpolate import LSQUnivariateSpline,interp1d
from astropy.modeling import models, fitting
from scipy.signal import argrelmin
import pdb
import matplotlib.pyplot as plt
from matplotlib import _c... | gpl-2.0 |
bibsian/database-development | test/test_popler_3_recovery.py | 1 | 22775 | import pytest
from collections import OrderedDict
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import *
from sqlalchemy.dialects.postgresql import *
from sqlalchemy.orm import sessionmaker, load_only
import pandas as pd
import sys, os
# This is a unit test to check
# that once data is pushed... | mit |
SteerSuite/steersuite-rutgers | steerstats/tools/plotting/plot3ObjectiveCurve.py | 8 | 1861 |
import csv
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
import sys
import scipy
from scipy.interpolate import bisplrep
from scipy.interpolate import bisplev
import numpy as np
# filename = '../../data/optimization/sf/multiObjective/SteerStatsOpt2.csv'
filename = s... | gpl-3.0 |
cpcloud/pepdata | pepdata/tcga.py | 1 | 9120 | # 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 required by applicable law o... | apache-2.0 |
ARM-software/trappy | trappy/stats/Correlator.py | 1 | 6760 | # Copyright 2015-2017 ARM Limited
#
# 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 w... | apache-2.0 |
awanke/bokeh | sphinx/source/docs/tutorials/exercises/boxplot.py | 22 | 2576 | import numpy as np
import pandas as pd
from bokeh.plotting import figure, output_file, show
# Generate some synthetic time series for six different categories
cats = list("abcdef")
score = np.random.randn(2000)
g = np.random.choice(cats, 2000)
for i, l in enumerate(cats):
score[g == l] += i // 2
df = pd.DataFrame... | bsd-3-clause |
IndraVikas/scikit-learn | sklearn/tree/export.py | 75 | 15670 | """
This module defines export functions for decision trees.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Dawe <noel@dawe.me>
# Satrajit Gosh <satrajit.ghosh@gmail.com>
# Trevor... | bsd-3-clause |
liang42hao/bokeh | examples/interactions/interactive_bubble/data.py | 49 | 1265 | import numpy as np
from bokeh.palettes import Spectral6
def process_data():
from bokeh.sampledata.gapminder import fertility, life_expectancy, population, regions
# Make the column names ints not strings for handling
columns = list(fertility.columns)
years = list(range(int(columns[0]), int(columns[-... | bsd-3-clause |
ptkool/spark | python/pyspark/sql/functions.py | 1 | 114962 | #
# 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 |
WangWenjun559/Weiss | summary/sumy/sklearn/preprocessing/__init__.py | 3 | 1082 | """
The :mod:`sklearn.preprocessing` module includes scaling, centering,
normalization, binarization and imputation methods.
"""
from .data import Binarizer
from .data import KernelCenterer
from .data import MinMaxScaler
from .data import Normalizer
from .data import RobustScaler
from .data import StandardScaler
from ... | apache-2.0 |
rs2/pandas | pandas/tests/frame/methods/test_explode.py | 4 | 5615 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_error():
df = pd.DataFrame(
{"A": pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd")), "B": 1}
)
with pytest.raises(ValueError, match="column must be a scalar"):
df.explode(list("AA"))
... | bsd-3-clause |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/pandas/tests/series/test_internals.py | 17 | 12814 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import pytest
from datetime import datetime
from numpy import nan
import numpy as np
from pandas import Series
from pandas.core.indexes.datetimes import Timestamp
import pandas._libs.lib as lib
from pandas.util.testing import assert_series_equal
import pandas.util.t... | mit |
yaukwankiu/armor | tests/modifiedMexicanHatTest15_march2014wrf.py | 1 | 7794 | # modified mexican hat wavelet test.py
# spectral analysis for RADAR and WRF patterns
# NO plotting - just saving the results: LOG-response spectra for each sigma and max-LOG response numerical spectra
# pre-convolved with a gaussian filter of sigma=10
import os, shutil
import time, datetime
import pickle
imp... | cc0-1.0 |
jmschrei/scikit-learn | examples/cluster/plot_adjusted_for_chance_measures.py | 286 | 4353 | """
==========================================================
Adjustment for chance in clustering performance evaluation
==========================================================
The following plots demonstrate the impact of the number of clusters and
number of samples on various clustering performance evaluation me... | bsd-3-clause |
ldirer/scikit-learn | examples/calibration/plot_calibration.py | 66 | 4795 | """
======================================
Probability calibration of classifiers
======================================
When performing classification you often want to predict not only
the class label, but also the associated probability. This probability
gives you some kind of confidence on the prediction. However,... | bsd-3-clause |
stargaser/astropy | examples/io/plot_fits-image.py | 11 | 1898 | # -*- coding: utf-8 -*-
"""
=======================================
Read and plot an image from a FITS file
=======================================
This example opens an image stored in a FITS file and displays it to the screen.
This example uses `astropy.utils.data` to download the file, `astropy.io.fits` to open
th... | bsd-3-clause |
alexej520/steamturbinecalculation | test.py | 1 | 18894 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# import pandas as pd
from os import system
import numpy as np
from sympy import Point, Line, Segment
from iapws import IAPWS97 as IAPWS97_ORIG
import matplotlib.pyplot as plt
import matplotlib
import plots as diagram
from math import log10
from sympy import S, solve, symbols... | gpl-3.0 |
jeremiedecock/snippets | python/tkinter/python3/matplotlib_canvas_using_class_and_toolbar_and_keyboard_events.py | 1 | 3899 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# 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 without restriction, including witho... | mit |
USP/Flask | sphinx/conf.py | 2 | 6652 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# USP documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 18 15:22:33 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autoge... | agpl-3.0 |
henrykironde/scikit-learn | examples/model_selection/plot_validation_curve.py | 229 | 1823 | """
==========================
Plotting Validation Curves
==========================
In this plot you can see the training scores and validation scores of an SVM
for different values of the kernel parameter gamma. For very low values of
gamma, you can see that both the training score and the validation score are
low. ... | bsd-3-clause |
minhouse/python-lesson | code_for_review3.py | 1 | 57851 | import sys, os, codecs, shutil, re, math, csv
import datetime as dt
import xlsxwriter
import pandas as pd
import numpy as np
import collections
import openpyxl
import seaborn as sns
from openpyxl.drawing.image import Image
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
allmeter = 'ReadingPerf_202004... | mit |
ashhher3/scikit-learn | sklearn/linear_model/logistic.py | 6 | 55848 | """
Logistic Regression
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Fabian Pedregosa <f@bianp.net>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Lars Buitinck
# Simon Wu <s8wu@uwaterloo.ca>
imp... | bsd-3-clause |
ZENGXH/scikit-learn | sklearn/setup.py | 225 | 2856 | import os
from os.path import join
import warnings
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFoundError
import numpy
libraries = []
if os.name == 'posix':
libraries.appe... | bsd-3-clause |
bgyori/indra | indra/tests/test_virhostnet.py | 4 | 4470 | import pandas
from nose.plugins.attrib import attr
from indra.statements import Complex
from indra.sources import virhostnet
from indra.sources.virhostnet.api import data_columns
from indra.sources.virhostnet.processor import parse_psi_mi, parse_source_ids, \
parse_text_refs, get_agent_from_grounding, process_row
... | bsd-2-clause |
clemkoa/scikit-learn | sklearn/tree/tests/test_tree.py | 7 | 64736 | """
Testing for the tree module (sklearn.tree).
"""
import copy
import pickle
from functools import partial
from itertools import product
import struct
import numpy as np
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import coo_matrix
from sklearn.random_projection import s... | bsd-3-clause |
LohithBlaze/scikit-learn | doc/sphinxext/numpy_ext/docscrape_sphinx.py | 408 | 8061 | import re
import inspect
import textwrap
import pydoc
from .docscrape import NumpyDocString
from .docscrape import FunctionDoc
from .docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
self.use_plots... | bsd-3-clause |
MJuddBooth/pandas | pandas/tests/extension/base/dtype.py | 4 | 2875 | import warnings
import numpy as np
import pandas as pd
from .base import BaseExtensionTests
class BaseDtypeTests(BaseExtensionTests):
"""Base class for ExtensionDtype classes"""
def test_name(self, dtype):
assert isinstance(dtype.name, str)
def test_kind(self, dtype):
valid = set('biu... | bsd-3-clause |
corriander/vdd | vdd/common/tests/test_io.py | 1 | 4633 | import unittest
import mock
import pygsheets
import pandas as pd
from .. import io
@mock.patch.object(io.GSheetsFacade, '_sheet',
new_callable=mock.PropertyMock)
class TestGSheetsFacade(unittest.TestCase):
def setup_mock_sheet(self, mock_property):
mock_property.return_value = mock_s... | mit |
flightgong/scikit-learn | sklearn/hmm.py | 18 | 48579 | # Hidden Markov Models
#
# Author: Ron Weiss <ronweiss@gmail.com>
# and Shiqiao Du <lucidfrontier.45@gmail.com>
# API changes: Jaques Grobler <jaquesgrobler@gmail.com>
"""
The :mod:`sklearn.hmm` module implements hidden Markov models.
**Warning:** :mod:`sklearn.hmm` is orphaned, undocumented and has known
numerical s... | bsd-3-clause |
dtusar/coco | code-postprocessing/bbob_pproc/ppfig.py | 3 | 24220 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Generic routines for figure generation."""
from __future__ import absolute_import
import os
from collections import OrderedDict
from operator import itemgetter
from itertools import groupby
import warnings
import numpy as np
from matplotlib import pyplot as plt
import s... | bsd-3-clause |
themrmax/scikit-learn | examples/neural_networks/plot_rbm_logistic_classification.py | 99 | 4608 | """
==============================================================
Restricted Boltzmann Machine features for digit classification
==============================================================
For greyscale image data where pixel values can be interpreted as degrees of
blackness on a white background, like handwritten... | bsd-3-clause |
grlee77/pywt | doc/source/pyplots/plot_boundary_modes.py | 3 | 1472 | """A visual illustration of the various signal extension modes supported in
PyWavelets. For efficiency, in the C routines the array is not actually
extended as is done here. This is just a demo for easier visual explanation of
the behavior of the various boundary modes.
In practice, which signal extension mode is bene... | mit |
yonglehou/scikit-learn | sklearn/covariance/graph_lasso_.py | 127 | 25626 | """GraphLasso: sparse inverse covariance estimation with an l1-penalized
estimator.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
# Copyright: INRIA
import warnings
import operator
import sys
import time
import numpy as np
from scipy import linalg
from .empirical_covariance_ im... | bsd-3-clause |
gatieme/AderXCoding | language/python/networkx/banetwork.py | 1 | 3676 | #coding:utf-8#coding:utf-8
import networkx as nx
import matplotlib.pyplot as plt
from networkx.generators.classic import empty_graph, path_graph, complete_graph
#from networkx.random_graphs import *
import sys
import random
#
def _random_subset(seq,m):
""" Return m unique elements from seq.
This differs from r... | gpl-2.0 |
csgxy123/Dato-Core | src/unity/python/graphlab/test/test_sarray_sketch.py | 13 | 11788 | '''
Copyright (C) 2015 Dato, Inc.
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the DATO-PYTHON-LICENSE file for details.
'''
# from nose import with_setup
# -*- coding: utf-8 -*-
from graphlab.data_structures.sarray import SArray
import pandas as pd
import ... | agpl-3.0 |
LADOSSIFPB/nutrif-openface | nutrif-openface/alignDlib.py | 12 | 6566 | #!/usr/bin/env python2
#
# Copyright 2015-2016 Carnegie Mellon University
#
# 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... | gpl-3.0 |
datapythonista/pandas | pandas/tests/indexes/timedeltas/methods/test_insert.py | 3 | 4540 | from datetime import timedelta
import numpy as np
import pytest
from pandas._libs import lib
import pandas as pd
from pandas import (
Index,
Timedelta,
TimedeltaIndex,
timedelta_range,
)
import pandas._testing as tm
class TestTimedeltaIndexInsert:
def test_insert(self):
idx = Timedelta... | bsd-3-clause |
wzbozon/scikit-learn | examples/model_selection/randomized_search.py | 201 | 3214 | """
=========================================================================
Comparing randomized search and grid search for hyperparameter estimation
=========================================================================
Compare randomized search and grid search for optimizing hyperparameters of a
random forest.
... | bsd-3-clause |
StratsOn/zipline | zipline/finance/performance/position_tracker.py | 2 | 10236 | from __future__ import division
from operator import mul
import logbook
import numpy as np
import pandas as pd
from pandas.lib import checknull
try:
# optional cython based OrderedDict
from cyordereddict import OrderedDict
except ImportError:
from collections import OrderedDict
from six import iteritems
fr... | apache-2.0 |
datapythonista/pandas | pandas/tests/io/test_common.py | 1 | 18495 | """
Tests for the pandas.io.common functionalities
"""
import codecs
import errno
from functools import partial
from io import (
BytesIO,
StringIO,
)
import mmap
import os
from pathlib import Path
import tempfile
import pytest
from pandas.compat import is_platform_windows
import pandas.util._test_decorators a... | bsd-3-clause |
lux-jwang/goodoos | run_diffierence.py | 1 | 1566 | import sys
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib
import numpy as np
sys.path.append("./src")
from similarities import CosineSimilarity
from dataset import get_friends_data, get_user_item_matrix
from models.friendsmodel import FriendsModel
from evaluators import EsoricsSingleUs... | mit |
gfyoung/pandas | pandas/tests/series/methods/test_copy.py | 3 | 2166 | import numpy as np
import pytest
from pandas import Series, Timestamp
import pandas._testing as tm
class TestCopy:
@pytest.mark.parametrize("deep", [None, False, True])
def test_copy(self, deep):
ser = Series(np.arange(10), dtype="float64")
# default deep is True
if deep is None:
... | bsd-3-clause |
xguse/scikit-bio | skbio/stats/gradient.py | 8 | 32294 | r"""
Gradient analyses (:mod:`skbio.stats.gradient`)
===============================================
.. currentmodule:: skbio.stats.gradient
This module provides functionality for performing gradient analyses.
The algorithms included in this module mainly allows performing analysis of
volatility on time series data, ... | bsd-3-clause |
cbourjau/pyhistogram | docs/source/conf.py | 2 | 8538 | # -*- coding: utf-8 -*-
#
# pyhistogram documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 19 19:39:53 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | gpl-3.0 |
MaxParsons/amo-physics | liexperiment/raman/spectrum_vertical.py | 1 | 2638 | '''
Created on Jan 19, 2015
@author: Max
'''
import numpy as np
import matplotlib.pyplot as plt
import os.path
import amo.core.simulation
import liexperiment.traps
import amo.core.physicalconstants
import amo.quantum.trapstates
import amo.core.simulation
c = amo.core.physicalconstants.PhysicalConstantsSI
li = amo.core... | mit |
ssteo/moviepy | tests/test_ImageSequenceClip.py | 1 | 1193 | # -*- coding: utf-8 -*-
"""Image sequencing clip tests meant to be run with pytest."""
import os
import sys
import pytest
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
sys.path.append("tests")
import download_media
from test_helper import TMP_DIR
def test_download_media(capsys):
with capsys.di... | mit |
msunardi/blog | RL/Combination allo and ego/egoalloBasic.py | 6 | 9327 | import numpy as np
import sys
import random
import cellular
import qlearn
startCell = None
class Cell(cellular.Cell):
def __init__(self):
self.cliff = False
self.goal = False
self.wall = False
def colour(self):
if self.cliff:
return 'red'
... | gpl-3.0 |
felixcheung/vagrant-projects | Spark-IPython-Zeppelin-Lightning/ipython-pyspark.py | 4 | 3462 | #!/usr/bin/env python
# https://github.com/felixcheung/vagrant-projects
import getpass
import glob
import inspect
import os
import platform
import re
import subprocess
import sys
import time
#-----------------------
# PySpark
#
master = 'local[*]'
num_executors = 12 #24
executor_cores = 2
executor_memory = '1g'... | apache-2.0 |
Dalboz/PiFmRds | src/generate_waveforms.py | 15 | 2403 | #!/usr/bin/python
# PiFmRds - FM/RDS transmitter for the Raspberry Pi
# Copyright (C) 2014 Christophe Jacquet, F8FTK
#
# See https://github.com/ChristopheJacquet/PiFmRds
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... | gpl-3.0 |
rseubert/scikit-learn | sklearn/linear_model/randomized_l1.py | 8 | 23178 | """
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 |
pligor/predicting-future-product-prices | 01_imputation/my_fancy_imputation.py | 1 | 32532 | # -*- coding: UTF-8 -*-
from __future__ import division
import sys
import unirest
import json
from time import sleep
import pickle
import numpy as np
import pandas as pd
import time
from datetime import datetime, timedelta
import os
from fancyimpute import KNN, NuclearNormMinimization, SoftImpute, IterativeSVD, MICE, ... | agpl-3.0 |
ElDeveloper/scikit-learn | sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py | 65 | 5529 | """
Testing for the gradient boosting loss functions and initial estimators.
"""
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_equal
from nose.tools import assert_raises
from sklearn.utils import check_random_state
from ... | bsd-3-clause |
jm-begon/scikit-learn | sklearn/cluster/mean_shift_.py | 106 | 14056 | """Mean shift clustering algorithm.
Mean shift clustering aims to discover *blobs* in a smooth density of
samples. It is a centroid based algorithm, which works by updating candidates
for centroids to be the mean of the points within a given region. These
candidates are then filtered in a post-processing stage to elim... | bsd-3-clause |
amilcarsj/analytic | analytic/classify_all.py | 1 | 3695 | import math
import numpy as np
from collections import defaultdict
import json
from sklearn.naive_bayes import MultinomialNB, GaussianNB, BernoulliNB
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassi... | gpl-3.0 |
Caleydo/caleydo_data_hdf | phovea_data_hdf/hdf.py | 1 | 13715 | from __future__ import print_function
import os
import numpy as np
import tables
import phovea_server.range as ranges
import itertools
from phovea_server.dataset_def import ADataSetProvider, AColumn, AMatrix, AStratification, ATable, AVector
__author__ = 'sam'
def assign_ids(ids, idtype):
import phovea_server.plug... | bsd-3-clause |
HeraclesHX/scikit-learn | examples/decomposition/plot_kernel_pca.py | 353 | 2011 | """
==========
Kernel PCA
==========
This example shows that Kernel PCA is able to find a projection of the data
that makes data linearly separable.
"""
print(__doc__)
# Authors: Mathieu Blondel
# Andreas Mueller
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomp... | bsd-3-clause |
jwlawson/tensorflow | tensorflow/python/estimator/inputs/pandas_io_test.py | 89 | 8340 | # Copyright 2015 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 |
alanjschoen/hikkit | src/interactive_order.py | 1 | 3068 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 25 13:53:01 2016
@author: alanschoen
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 23 13:16:34 2016
@author: alanschoen
"""
import shapefile
import numpy as np
import matplotlib.pyplot as plt
import math
from readatc import CenterLine
# Calculate distance from t... | gpl-3.0 |
danielvdende/incubator-airflow | tests/contrib/operators/test_hive_to_dynamodb_operator.py | 10 | 5074 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
jereze/scikit-learn | examples/applications/topics_extraction_with_nmf_lda.py | 133 | 3517 | """
========================================================================================
Topics extraction with Non-Negative Matrix Factorization And Latent Dirichlet Allocation
========================================================================================
This is an example of applying Non Negative Matr... | bsd-3-clause |
fbagirov/scikit-learn | examples/decomposition/plot_ica_blind_source_separation.py | 349 | 2228 | """
=====================================
Blind source separation using FastICA
=====================================
An example of estimating sources from noisy data.
:ref:`ICA` is used to estimate sources given noisy measurements.
Imagine 3 instruments playing simultaneously and 3 microphones
recording the mixed si... | bsd-3-clause |
jreback/pandas | pandas/tests/io/test_date_converters.py | 7 | 1368 | from datetime import datetime
import numpy as np
import pandas._testing as tm
import pandas.io.date_converters as conv
def test_parse_date_time():
dates = np.array(["2007/1/3", "2008/2/4"], dtype=object)
times = np.array(["05:07:09", "06:08:00"], dtype=object)
expected = np.array([datetime(2007, 1, 3,... | bsd-3-clause |
matthew-tucker/mne-python | mne/surface.py | 1 | 39112 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os
from os import path as op
import sys
from struct import pack
from glob import glob
import numpy as... | bsd-3-clause |
mikofski/pvlib-python | pvlib/tests/test_snow.py | 1 | 4188 | import numpy as np
import pandas as pd
from conftest import assert_series_equal
from pvlib import snow
from pvlib.tools import sind
def test_fully_covered_nrel():
dt = pd.date_range(start="2019-1-1 12:00:00", end="2019-1-1 18:00:00",
freq='1h')
snowfall_data = pd.Series([1, 5, .6, 4, ... | bsd-3-clause |
louispotok/pandas | pandas/tests/plotting/test_misc.py | 1 | 12387 | # coding: utf-8
""" Test cases for misc plot functions """
import pytest
from pandas import DataFrame
from pandas.compat import lmap
import pandas.util.testing as tm
import pandas.util._test_decorators as td
import numpy as np
from numpy import random
from numpy.random import randn
import pandas.plotting as plotti... | bsd-3-clause |
yossitamarov/calc_local_library | polls/src/pycel/excelcompiler.py | 1 | 38529 |
# We will choose our wrapper with os compatibility
# ExcelComWrapper : Must be run on Windows as it requires a COM link to an Excel instance.
# ExcelOpxWrapper : Can be run anywhere but only with post 2010 Excel formats
try:
import win32com.client
import pythoncom
from pycel.excelwrapper import... | gpl-3.0 |
biocyberman/bcbio-nextgen | bcbio/rnaseq/sailfish.py | 1 | 7046 | import os
from collections import namedtuple
import pandas as pd
import bcbio.pipeline.datadict as dd
import bcbio.rnaseq.gtf as gtf
from bcbio.distributed.transaction import file_transaction
from bcbio.provenance import do
from bcbio.utils import (file_exists, safe_makedir, is_gzipped,
R_pack... | mit |
pypot/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 |
w2naf/pythonPropWeb | pyprop/voaAreaPlot.py | 1 | 27945 | #! /usr/bin/env python
#
# File: voaAreaPlot.py
#
# Copyright (c) 2008 J.Watson
#
# 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... | gpl-2.0 |
anntzer/scikit-learn | examples/applications/plot_species_distribution_modeling.py | 17 | 7971 | """
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... | bsd-3-clause |
michigraber/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 |
glennq/scikit-learn | sklearn/tests/test_random_projection.py | 141 | 14040 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from sklearn.metrics import euclidean_distances
from sklearn.random_projection import johnson_lindenstrauss_min_dim
from sklearn.random_projection import gaussian_random_matrix
from sklearn.random_projection import sparse_random_matrix
from... | bsd-3-clause |
michigraber/scikit-learn | examples/cluster/plot_segmentation_toy.py | 258 | 3336 | """
===========================================
Spectral clustering for image segmentation
===========================================
In this example, an image with connected circles is generated and
spectral clustering is used to separate the circles.
In these settings, the :ref:`spectral_clustering` approach solve... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.