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 |
|---|---|---|---|---|---|
amaurywalbert/twitter | graphs/n3/n7_co_likes_creating_network_with_v1.3.py | 1 | 11313 | # -*- coding: latin1 -*-
################################################################################################
#
#
import datetime, sys, time, json, os, os.path, shutil, time, struct, random
import networkx as nx
import matplotlib.pyplot as plt
from math import*
reload(sys)
sys.setdefaultencoding('utf-8')
... | gpl-3.0 |
drammock/mne-python | examples/connectivity/mixed_source_space_connectivity.py | 6 | 7054 | """
===============================================================================
Compute mixed source space connectivity and visualize it using a circular graph
===============================================================================
This example computes the all-to-all connectivity between 75 regions in a
m... | bsd-3-clause |
eg-zhang/scikit-learn | sklearn/tests/test_dummy.py | 186 | 17778 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from sklearn.base import clone
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_eq... | bsd-3-clause |
janscience/thunderfish | setup.py | 3 | 2124 | from setuptools import setup, find_packages
exec(open('thunderfish/version.py').read())
long_description = """
# ThunderFish
Algorithms and programs for analysing electric field recordings of
weakly electric fish.
[Documentation](https://bendalab.github.io/thunderfish) |
[API Reference](https://bendalab.github.io/t... | gpl-3.0 |
kaiserroll14/301finalproject | main/pandas/io/tests/test_pytables.py | 9 | 194218 | import nose
import sys
import os
import warnings
import tempfile
from contextlib import contextmanager
import datetime
import numpy as np
import pandas
import pandas as pd
from pandas import (Series, DataFrame, Panel, MultiIndex, Categorical, bdate_range,
date_range, timedelta_range, Index, Dateti... | gpl-3.0 |
jonas-hagen/meteo-logger-server | meteo/server.py | 1 | 5429 | #!/usr/bin/env python3
from datetime import datetime, timedelta
from io import StringIO
import os
import matplotlib
import yaml
from dicttoxml import dicttoxml
from flask import Flask, jsonify, request, Response, abort, render_template
from flask_caching import Cache
import meteo
from meteo import data as md
matplot... | bsd-2-clause |
potash/scikit-learn | examples/linear_model/plot_sgd_weighted_samples.py | 344 | 1458 | """
=====================
SGD: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
# we create 20 points
np.random.seed(0)
X ... | bsd-3-clause |
DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/examples/linear_model/plot_omp.py | 1 | 2263 | """
===========================
Orthogonal Matching Pursuit
===========================
Using orthogonal matching pursuit for recovering a sparse signal from a noisy
measurement encoded with a dictionary
"""
print(__doc__)
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_sparse_cod... | mit |
drammock/expyfun | examples/experiments/tracker_dealer.py | 2 | 4874 | # -*- coding: utf-8 -*-
"""
==========================================================================
Adaptive tracking for two trial types and tracker reconstruction from .tab
==========================================================================
This file shows how to interleave multiple Tracker objects u... | bsd-3-clause |
hollabaq86/haikuna-matata | env/lib/python2.7/site-packages/nltk/probability.py | 5 | 87595 | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Probability and Statistics
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (additions)
# Trevor Cohn <tacohn@cs.mu.oz.au> (additions)
# Peter Ljunglöf <peter.ljunglof@hea... | mit |
rohanp/scikit-learn | sklearn/kernel_ridge.py | 37 | 6556 | """Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <mathieu@mblondel.org>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from .base import BaseEstimator, RegressorMixin
from .metrics.pairwise import pairwise... | bsd-3-clause |
breznak/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/projections/polar.py | 69 | 20981 | import math
import numpy as npy
import matplotlib
rcParams = matplotlib.rcParams
from matplotlib.artist import kwdocd
from matplotlib.axes import Axes
from matplotlib import cbook
from matplotlib.patches import Circle
from matplotlib.path import Path
from matplotlib.ticker import Formatter, Locator
from matplotlib.tr... | agpl-3.0 |
h2oai/h2o-3 | h2o-py/tests/testdir_sklearn/pyunit_sklearn_classification_all_estimators.py | 2 | 5915 | from __future__ import print_function
from collections import defaultdict
from functools import partial
import gc, inspect, os, sys
import numpy as np
from sklearn.datasets import make_classification
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
import h2o
from h2o.sk... | apache-2.0 |
ray-project/ray | python/ray/tune/examples/pbt_dcgan_mnist/common.py | 1 | 7734 | import ray
import os
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as vutils
import numpy as np
from torch.autograd import Variable
from torch.nn import functional as F
from s... | apache-2.0 |
lily-zhangying/find_best_mall | recomendation system/ensemble.py | 3 | 8346 | __author__ = 'John'
import numpy as np
from sklearn.decomposition import ProjectedGradientNMF
import recsys
import evaluate
import similarity
from nmf_analysis import mall_latent_helper as nmf_helper
from sklearn import decomposition
from sklearn import cross_validation
from sklearn.linear_model import LinearRegression... | mit |
santiagolopezg/MODS_ConvNet | old code/cifar10_v6.py | 1 | 7409 | # -*- coding: utf-8 -*-
'''
Created on Mon Sep 5 13:50:34 2016
cifar clone with bigger net
"""
'''
from __future__ import print_function
import keras
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.lay... | mit |
luzhijun/Optimization | cma-es/cma&mse&quad&pow/draw.py | 1 | 2539 | #!usr/bin/env python
#encoding: utf-8
'''
用cma方法优化二次多项式函数与指数函数,g1,g2分别对应y垂直和百分比残差函数
最后绘制曲线
'''
__author__="luzhijun"
import Ss
import funcs
import cma
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(12345)
np.set_printoptions(precision=4)
def cmaUser(dataSet,residualFunc,dim=3)... | apache-2.0 |
marcsans/cnn-physics-perception | phy/lib/python2.7/site-packages/sklearn/metrics/cluster/tests/test_bicluster.py | 394 | 1770 | """Testing for bicluster metrics module"""
import numpy as np
from sklearn.utils.testing import assert_equal, assert_almost_equal
from sklearn.metrics.cluster.bicluster import _jaccard
from sklearn.metrics import consensus_score
def test_jaccard():
a1 = np.array([True, True, False, False])
a2 = np.array([T... | mit |
cbertinato/pandas | pandas/io/html.py | 1 | 35090 | """:mod:`pandas.io.html` is a module containing functionality for dealing with
HTML IO.
"""
from collections import abc
from distutils.version import LooseVersion
import numbers
import os
import re
from pandas.compat import raise_with_traceback
from pandas.compat._optional import import_optional_dependency
from pand... | bsd-3-clause |
Knewton/lentil | lentil/models.py | 2 | 33643 | """
Module for skill models
@author Siddharth Reddy <sgr45@cornell.edu>
"""
from __future__ import division
from abc import abstractmethod
import math
import logging
import numpy as np
from scipy import sparse
from sklearn import cross_validation
from sklearn.linear_model import LogisticRegression
from . import da... | apache-2.0 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/scipy/signal/windows.py | 19 | 58294 | """The suite of window functions."""
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy import fftpack, linalg, special
from scipy._lib.six import string_types
__all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall',
'blackmanhar... | mit |
witcxc/scipy | scipy/signal/waveforms.py | 12 | 14814 | # Author: Travis Oliphant
# 2003
#
# Feb. 2010: Updated by Warren Weckesser:
# Rewrote much of chirp()
# Added sweep_poly()
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \
exp, cos, sin, polyval, po... | bsd-3-clause |
kgullikson88/gullikson-scripts | kglib/cross_correlation/CCF_Systematics.py | 1 | 37521 | from __future__ import print_function, division, absolute_import
import os
import re
from collections import defaultdict
from operator import itemgetter
import logging
import sys
from scipy.interpolate import InterpolatedUnivariateSpline as spline
from scipy.integrate import quad
from scipy.optimize import minimize_s... | mit |
trankmichael/scikit-learn | sklearn/utils/testing.py | 84 | 24860 | """Testing utilities."""
# Copyright (c) 2011, 2012
# Authors: Pietro Berkes,
# Andreas Muller
# Mathieu Blondel
# Olivier Grisel
# Arnaud Joly
# Denis Engemann
# License: BSD 3 clause
import os
import inspect
import pkgutil
import warnings
import sys
import re
import platf... | bsd-3-clause |
syazdan25/SE17-Project | Pform2.py | 1 | 3771 | from flask import Flask, render_template, flash, request
from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField
import nltk
import numpy
from nltk.classify import SklearnClassifier
from sklearn.naive_bayes import BernoulliNB
from sklearn.svm import SVC
import webbrowser
# ... | gpl-3.0 |
ldirer/scikit-learn | sklearn/metrics/tests/test_regression.py | 49 | 8058 | from __future__ import division, print_function
import numpy as np
from itertools import product
from sklearn.utils.testing import assert_raises, assert_raises_regex
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equa... | bsd-3-clause |
Adai0808/scikit-learn | sklearn/manifold/locally_linear.py | 206 | 25061 | """Locally Linear Embedding"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) INRIA 2011
import numpy as np
from scipy.linalg import eigh, svd, qr, solve
from scipy.sparse import eye, csr_matrix
from ..base import B... | bsd-3-clause |
ngoix/OCRF | sklearn/linear_model/tests/test_logistic.py | 24 | 39507 | import numpy as np
import scipy.sparse as sp
from scipy import linalg, optimize, sparse
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.util... | bsd-3-clause |
capocchi/DEVSimPy-plugin-activity-tracking | activity-tracking.py | 1 | 45971 | # -*- coding: utf-8 -*-
"""
Authors: L. Capocchi (capocchi@univ-corse.fr),
J.F. Santucci (santucci@univ-corse.fr)
Date: 12/09/2013
Description:
Activity tracking for DEVSimPy
We add dynamically a 'activity' attribute to the Block at the GUI level and 'texec'
(which is dico like {'fnc':[(t1,t1'),(t2,t2'),..... | lgpl-3.0 |
jburos/survivalstan | test/test_weibull_survival_model.py | 1 | 1764 |
import matplotlib as mpl
mpl.use('Agg')
import survivalstan
from stancache import stancache
import numpy as np
from functools import partial
from nose.tools import ok_
num_iter = 500
from .test_datasets import load_test_dataset
model_code = survivalstan.models.weibull_survival_model
make_inits = survivalstan.make_wei... | apache-2.0 |
fabianp/scikit-learn | sklearn/utils/tests/test_random.py | 230 | 7344 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.misc import comb as combinations
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import sample_without_replacement
from sklearn.utils.random import random_choice_csc
from sklearn.utils.testing import ... | bsd-3-clause |
laughingman7743/PyAthena | pyathena/connection.py | 1 | 8829 | # -*- coding: utf-8 -*-
import logging
import os
import time
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type
from boto3.session import Session
from pyathena.common import BaseCursor
from pyathena.converter import (
Converter,
DefaultPandasTypeConverter,
DefaultTypeConverter,
)
from pyath... | mit |
CSC380Team8/rr-lyrae-categories | scripts/scatter.py | 1 | 2108 | from __future__ import print_function
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import sys
def main():
# Get graph info
if len(sys.argv) == 5:
title = sys.argv[1]
x_axis = sys.argv[2]
y_axis = sys.argv[3]
output_file = sys.argv[4]
... | gpl-3.0 |
mfjb/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 128 | 4761 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
xuanyuanking/spark | python/pyspark/pandas/tests/data_type_ops/test_num_ops.py | 3 | 19076 | #
# 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 |
mhvk/numpy | doc/example.py | 17 | 3514 | """This is the docstring for the example.py module. Modules names should
have short, all-lowercase names. The module name may have underscores if
this improves readability.
Every module should have a docstring at the very top of the file. The
module's docstring may extend over multiple lines. If your docstring doe... | bsd-3-clause |
neerajhirani/BDA_py_demos | demos_ch2/demo2_4.py | 19 | 2780 | """Bayesian Data Analysis, 3rd ed
Chapter 2, demo 4
Calculate the posterior distribution on a discrete grid of points by
multiplying the likelihood and a non-conjugate prior at each point, and
normalizing over the points. Simulate samples from the resulting non-standard
posterior distribution using inverse cdf usin... | gpl-3.0 |
gfyoung/pandas | pandas/core/describe.py | 1 | 12252 | """
Module responsible for execution of NDFrame.describe() method.
Method NDFrame.describe() delegates actual execution to function describe_ndframe().
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Callable, List, Optional, Sequence, Union, cast
import wa... | bsd-3-clause |
mohibb/Flappy | FlappyBot.py | 1 | 7969 | import json
import logging
from collections import defaultdict
from itertools import chain
import matplotlib.pyplot as plt
import numpy as np
class FlappyBot():
""" AI for playing Flappy bird. """
def __init__(self, mode='UCB'):
if mode.lower() not in ['ucb', 'greedy', 'dumb']:
logging.w... | mit |
webmasterraj/FogOrNot | flask/lib/python2.7/site-packages/pandas/computation/align.py | 6 | 5632 | """Core eval alignment algorithms
"""
import warnings
from functools import partial, wraps
from pandas.compat import zip, range
import numpy as np
import pandas as pd
from pandas import compat
import pandas.core.common as com
from pandas.computation.common import _result_type_many
def _align_core_single_unary_op(t... | gpl-2.0 |
rhambach/EELcalc | multilayer/examples/1_LEG_plasmon_bands_in_MLG.py | 1 | 3665 | """
Plot plasmon dispersion for N-layer graphene using the
hydrodynamic model of [1] for the dielectric response of
graphene. The plasmon dispersion is evaluated analytically
in the limit of vanishing broadening. Reproduces Fig. 2a in [2].
REFERENCES:
[1] Jovanovic, Radovic, Borka, and Miskovic,... | mit |
MBARIMike/stoqs | stoqs/contrib/parquet/parquet2csv.py | 2 | 1105 | #!/usr/bin/env python
'''
Convert STOQS Measured Parameter Data Access .parquet output to CSV format.
'''
import argparse
import pandas as pd
import sys
instructions = f'''
Can be run in an Anaconda environment thusly...
First time - install necessary packages:
conda create --name stoqs-parquet python=3.8... | gpl-3.0 |
massmutual/scikit-learn | examples/gaussian_process/gp_diabetes_dataset.py | 223 | 1976 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
========================================================================
Gaussian Processes regression: goodness-of-fit on the 'diabetes' dataset
========================================================================
In this example, we fit a Gaussian Process model onto... | bsd-3-clause |
hlin117/scikit-learn | sklearn/ensemble/tests/test_base.py | 33 | 5168 | """
Testing for the base module (sklearn.ensemble.base).
"""
# Authors: Gilles Louppe
# License: BSD 3 clause
import numpy as np
from numpy.testing import assert_equal
from sklearn.utils.testing import assert_raise_message
from sklearn.utils.testing import assert_not_equal
from sklearn.utils.testing import assert_tr... | bsd-3-clause |
rowanc1/Seismogram | syntheticSeismogram.py | 2 | 14041 | import numpy as np
import matplotlib.pyplot as plt
import scipy.io
def getPlotLog(d,log,dmax=200):
d = np.array(d, dtype=float)
log = np.array(log, dtype=float)
dplot = np.kron(d,np.ones(2))
logplot = np.kron(log,np.ones(2))
# dplot = dplot[1:]
dplot = np.append(dplot[1:],dmax)
ret... | mit |
endolith/scipy | scipy/stats/kde.py | 5 | 21517 | #-------------------------------------------------------------------------------
#
# Define classes for (uni/multi)-variate kernel density estimation.
#
# Currently, only Gaussian kernels are implemented.
#
# Written by: Robert Kern
#
# Date: 2004-08-09
#
# Modified: 2005-02-10 by Robert Kern.
# Contr... | bsd-3-clause |
notmatthancock/notmatthancock.github.io | code/py/boundary-preserving-pca.py | 1 | 1797 | ## Author: Matt Hancock
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
n_dim = 10
n_samples = 150
variance = 0.5**2
rs = np.random.RandomState(1234)
true_w = rs.randn(n_dim); true_w /= np.linalg.norm(true_w)
true_t = rs.rand()*5
true_Q = np.c_[true_w, np.zeros((n_dim,n_dim-1))]
true_Q,R = ... | mit |
jorge2703/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 |
treycausey/scikit-learn | examples/svm/plot_svm_regression.py | 4 | 1429 | """
===================================================================
Support Vector Regression (SVR) using linear and non-linear kernels
===================================================================
Toy example of 1D regression using linear, polynomial and RBF kernels.
"""
print(__doc__)
###################... | bsd-3-clause |
ozak/BoundedConsumption | scripts/LearnHOT.py | 1 | 16184 | #!/usr/bin/env python
# coding: utf-8
'''
======================================================
Author: Ömer Özak, 2013--2014 (ozak at smu.edu)
Website: http://omerozak.com
GitHub: https://github.com/ozak/BoundedConsumption
======================================================
# This code generates the dynamics of ... | gpl-3.0 |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/sklearn/__check_build/__init__.py | 30 | 1669 | """ Module to give helpful messages to the user that did not
compile the scikit properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.""... | bsd-3-clause |
poryfly/scikit-learn | examples/manifold/plot_lle_digits.py | 181 | 8510 | """
=============================================================================
Manifold learning on handwritten digits: Locally Linear Embedding, Isomap...
=============================================================================
An illustration of various embeddings on the digits dataset.
The RandomTreesEmbed... | bsd-3-clause |
emmanuelol/RDS_Project | Python Codes/testFreqDemod.py | 1 | 1643 | from freqdemod import Signal
#matplotlib inline
import numpy as np
import matplotlib.pylab as plt
font = {'family' : 'serif',
'weight' : 'normal',
'size' : 20}
plt.rc('font', **font)
plt.rcParams['figure.figsize'] = 8, 6
fd = 50.0e3 # digitization frequency
f0 = 2.00e3 # signal frequency
nt =... | gpl-3.0 |
466152112/scikit-learn | examples/mixture/plot_gmm.py | 248 | 2817 | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two Gaussians with EM
and variational Dirichlet process.
Both models have access to five components with which to fit the
data. Note that the EM model will necessari... | bsd-3-clause |
cbertinato/pandas | pandas/tests/resample/test_period_index.py | 1 | 34149 | from datetime import datetime, timedelta
import dateutil
import numpy as np
import pytest
import pytz
from pandas._libs.tslibs.ccalendar import DAYS, MONTHS
from pandas._libs.tslibs.period import IncompatibleFrequency
import pandas as pd
from pandas import DataFrame, Series, Timestamp
from pandas.core.indexes.base i... | bsd-3-clause |
xyguo/scikit-learn | sklearn/feature_extraction/dict_vectorizer.py | 37 | 12559 | # Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from array import array
from collections import Mapping
from operator import itemgetter
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..ext... | bsd-3-clause |
synthicity/activitysim | activitysim/core/test/test_logit.py | 2 | 4350 | # ActivitySim
# See full license in LICENSE.txt.
import os.path
import numpy as np
import pandas as pd
import pandas.util.testing as pdt
import pytest
from ..simulate import eval_variables
from .. import logit
from .. import inject
@pytest.fixture(scope='module')
def data_dir():
return os.path.join(os.path.di... | agpl-3.0 |
TimBizeps/BachelorAP | V406_Beugung am Spalt/Auswertung1.py | 1 | 1358 | import matplotlib as mpl
mpl.use('pgf')
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from uncertainties import ufloat
import uncertainties.unumpy as unp
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
mpl.rcParams.update({
'font.family': 'serif'... | gpl-3.0 |
jadhavhninad/-CSE_515_MWD_Analytics- | Phase 2/Complete_Team_project/mwd_proj/scripts_p2/Arun/ppr.py | 2 | 3240 | import os
import sys
import math
from numpy.linalg import inv
import numpy
import pandas
# Generalized matrix operations:
def __extractNodes(matrix):
nodes = set()
for colKey in matrix:
nodes.add(colKey)
for rowKey in matrix.T:
nodes.add(rowKey)
return nodes
def __makeSquare(matrix, k... | gpl-3.0 |
annikaliebgott/ImFEATbox | features_python/ImFEATbox/LocalFeatures/Line/_LineProfileF.py | 1 | 7535 | import numpy as np
import warnings
from scipy.stats import moment
from skimage.measure import profile_line
def LineProfileF(I, typeflag=None, plotflag=False, returnShape=False):
"""
Input: - I: A 2D image
- typeflag: Struct of logicals to permit extracting features
based on desired c... | apache-2.0 |
elkingtonmcb/shogun | applications/tapkee/swissroll_embedding.py | 26 | 2686 | import numpy
numpy.random.seed(40)
tt = numpy.genfromtxt('../../data/toy/swissroll_color.dat',unpack=True).T
X = numpy.genfromtxt('../../data/toy/swissroll.dat',unpack=True).T
N = X.shape[1]
converters = []
from shogun.Converter import LocallyLinearEmbedding
lle = LocallyLinearEmbedding()
lle.set_k(9)
converters.appen... | gpl-3.0 |
lin-credible/scikit-learn | sklearn/utils/validation.py | 66 | 23629 | """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 |
zuku1985/scikit-learn | sklearn/covariance/robust_covariance.py | 105 | 29653 | """
Robust location and covariance estimators.
Here are implemented estimators that are resistant to outliers.
"""
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import linalg
from scipy.stats import chi2
from . import empir... | bsd-3-clause |
chaluemwut/fbserver | venv/lib/python2.7/site-packages/sklearn/preprocessing/__init__.py | 3 | 1041 | """
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 StandardScaler
from .data import add_dummy_feature
... | apache-2.0 |
Srisai85/scipy | scipy/stats/stats.py | 18 | 169352 | # Copyright (c) Gary Strangman. All rights reserved
#
# Disclaimer
#
# This software is provided "as-is". There are no expressed or implied
# warranties of any kind, including, but not limited to, the warranties
# of merchantability and fitness for a given application. In no event
# shall Gary Strangman be liable fo... | bsd-3-clause |
VirusTotal/msticpy | tests/data/uploaders/test_splunk_uploader.py | 1 | 3046 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Tests f... | mit |
yyjiang/scikit-learn | sklearn/metrics/cluster/unsupervised.py | 230 | 8281 | """ Unsupervised evaluation metrics. """
# Authors: Robert Layton <robertlayton@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from ...utils import check_random_state
from ..pairwise import pairwise_distances
def silhouette_score(X, labels, metric='euclidean', sample_size=None,
random... | bsd-3-clause |
MatthieuBizien/scikit-learn | examples/ensemble/plot_voting_decision_regions.py | 86 | 2386 | """
==================================================
Plot the decision boundaries of a VotingClassifier
==================================================
Plot the decision boundaries of a `VotingClassifier` for
two features of the Iris dataset.
Plot the class probabilities of the first sample in a toy dataset
pred... | bsd-3-clause |
ruymanengithub/vison | vison/dark/BIAS0X.py | 1 | 33806 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
TEST: BIAS0X
Bias-structure/RON analysis script
Created on Tue Aug 29 16:53:40 2017
:author: Ruyman Azzollini
"""
# IMPORT STUFF
import numpy as np
from pdb import set_trace as stop
import os
import copy
from collections import OrderedDict
import unittest
from ma... | gpl-3.0 |
Koheron/zynq-sdk | examples/alpha250/fft/python/test_distortion_adc_only.py | 1 | 1347 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Measure the harmonic distortion (HD2 and HD3) of the ADC only
A series of Minicircuits PLP low-pass filters are used to reject the DAC harmonics
'''
import numpy as np
import os
import time
import matplotlib.pyplot as plt
from fft import FFT
from koheron import conne... | mit |
tosolveit/scikit-learn | examples/ensemble/plot_ensemble_oob.py | 259 | 3265 | """
=============================
OOB Errors for Random Forests
=============================
The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where
each new tree is fit from a bootstrap sample of the training observations
:math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er... | bsd-3-clause |
mjvakili/gambly | code/tests/xigm.py | 1 | 2536 | import numpy as np
from matplotlib import lines as mlines
from matplotlib import pyplot as plt
import numpy as np
from halotools.empirical_models import PrebuiltHodModelFactory
from scipy import interpolate
###Constants necessary in calculation of Sigma(R)###
Omegam = 0.315
rho_crit = 2.77536627 * 1.e11 #units h^2... | mit |
musically-ut/statsmodels | statsmodels/tools/tests/test_grouputils.py | 31 | 11494 | import numpy as np
import pandas as pd
from statsmodels.tools.grouputils import Grouping
from statsmodels.tools.tools import categorical
from statsmodels.datasets import grunfeld, anes96
from pandas.util import testing as ptesting
class CheckGrouping(object):
def test_reindex(self):
# smoke test
... | bsd-3-clause |
ciffcesarhernandez/prueba13062016 | prusontchm/stepwisesontchm.py | 1 | 1852 | def stepwise():
import numpy
import pandas as pd
from math import sqrt
from sklearn.linear_model import LinearRegression
from sklearn.cross_validation import train_test_split
# Importación de los datos
wine = pd.read_csv('winequality-white.csv', sep = ';')
# Separación de la variable objetivo y las explicativ... | gpl-3.0 |
yingchi/fastai-notes | deeplearning1/nbs/utils.py | 3 | 7888 | from __future__ import division,print_function
import math, os, json, sys, re
import _pickle as pickle
from glob import glob
import numpy as np
from matplotlib import pyplot as plt
from operator import itemgetter, attrgetter, methodcaller
from collections import OrderedDict
import itertools
from itertools import chain
... | apache-2.0 |
drummonds/remittance | tests/test_ais.py | 1 | 3277 | """Unit tests for AIS
Aim to excercise both p and remittance docu
"""
from decimal import Decimal, InvalidOperation
import numpy as np
import os
import pandas as pd
from pandas.util.testing import assert_series_equal
from unittest import TestCase, main
from unipath import Path
from remittance import AISRemittanceDoc... | mit |
stevenweaver/idepi | idepi/feature_extraction/_msavectorizerregex.py | 3 | 2845 |
from numpy import zeros
from sklearn.base import BaseEstimator, TransformerMixin
from idepi.constants import GAPS
from idepi.labeledmsa import LabeledMSA
__all__ = ['MSAVectorizerRegex']
class MSAVectorizerRegex(BaseEstimator, TransformerMixin):
def __init__(self, regex, regex_length=-1, name=''):
s... | gpl-3.0 |
toobaz/pandas | pandas/tests/io/parser/test_na_values.py | 2 | 14446 | """
Tests that NA values are properly handled during
parsing for all of the parsers defined in parsers.py
"""
from io import StringIO
import numpy as np
import pytest
from pandas import DataFrame, Index, MultiIndex
import pandas.util.testing as tm
import pandas.io.common as com
def test_string_nas(all_parsers):
... | bsd-3-clause |
xray/xray | xarray/core/duck_array_ops.py | 1 | 20885 | """Compatibility module defining operations on duck numpy-arrays.
Currently, this means Dask or NumPy arrays. None of these functions should
accept or return xarray objects.
"""
import contextlib
import datetime
import inspect
import warnings
from distutils.version import LooseVersion
from functools import partial
im... | apache-2.0 |
mattilyra/scikit-learn | benchmarks/bench_20newsgroups.py | 377 | 3555 | from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... | bsd-3-clause |
tjhei/burnman-original | burnman/geotherm.py | 1 | 5375 | # BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
import numpy as np
import matplotlib.pyplot as pyplot
import scipy.integrate as integrate
import os, sys
if not os.path.exists('burnman') and os.path.exists('../burnman'... | gpl-2.0 |
iABC2XYZ/abc | DM_Twiss/TwissTrain5.py | 1 | 2320 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 20 13:37:16 2017
Author: Peiyong Jiang : jiangpeiyong@impcas.ac.cn
Function:
Check that the Distribution generation method is right.
"""
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
plt.close('all')
emitX=1
al... | gpl-3.0 |
pompiduskus/scikit-learn | examples/ensemble/plot_voting_decision_regions.py | 230 | 2386 | """
==================================================
Plot the decision boundaries of a VotingClassifier
==================================================
Plot the decision boundaries of a `VotingClassifier` for
two features of the Iris dataset.
Plot the class probabilities of the first sample in a toy dataset
pred... | bsd-3-clause |
svohara/proximityforest | proximityforest/clustering/Connectivity.py | 2 | 9762 | '''
Created on Feb 13, 2012
@author: Stephen O'Hara
This module supports the generation of connectivity graphs from
a proximity forest structure, and methods for using the graph to
identify clusters and exemplars.
Copyright (C) 2012 Stephen O'Hara
This program is free software: you can redistribute it and/or modify ... | gpl-3.0 |
csae1152/seizure-prediction | seizure_prediction/cross_validation/legacy_strategy.py | 3 | 1468 | import numpy as np
import sklearn.cross_validation
from seizure_prediction.cross_validation.sequences import collect_sequence_ranges_from_meta
class LegacyStrategy:
"""
Hand-picked random folds maintaining sequence integrity with 80% train/cv split.
See k_fold_strategy for docs on each method.
"""
... | mit |
yutiansut/QUANTAXIS | QUANTAXIS/QAFactor/process.py | 2 | 16069 | import re
from typing import List, Tuple, Union
import numpy as np
import pandas as pd
from QUANTAXIS.QAFactor import utils
from QUANTAXIS.QAFactor import preprocess
from QUANTAXIS.QAFactor.utils import get_forward_returns_columns
def get_clean_factor_and_forward_returns(
factor: Union[pd.Series, pd.DataFra... | mit |
RachitKansal/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 |
gertingold/scipy | scipy/stats/kde.py | 5 | 21807 | #-------------------------------------------------------------------------------
#
# Define classes for (uni/multi)-variate kernel density estimation.
#
# Currently, only Gaussian kernels are implemented.
#
# Written by: Robert Kern
#
# Date: 2004-08-09
#
# Modified: 2005-02-10 by Robert Kern.
# Contr... | bsd-3-clause |
gnu-sandhi/sandhi | modules/gr36/gr-sandhi_plot/python/Bode.py | 3 | 3927 | import numpy
import numpy as np
import scipy as sp
from gnuradio import gr
import matplotlib
from control import *
from control.freqplot import default_frequency_range
from numpy import pi
import os
import wx
import gnuradio.grc.gui
import pylab
import scipy
import control.config
from control.ctrlutil import unwrap
fro... | gpl-3.0 |
imperial-genomics-facility/data-management-python | test/dbadaptor/projectadaptor_test.py | 1 | 6564 | import os, unittest
import pandas as pd
from sqlalchemy import create_engine
from igf_data.igfdb.igfTables import Base, Project, Project_attribute, Sample
from igf_data.igfdb.baseadaptor import BaseAdaptor
from igf_data.igfdb.projectadaptor import ProjectAdaptor
from igf_data.igfdb.useradaptor import UserAdaptor
from i... | apache-2.0 |
napsternxg/pyLDAvis | pyLDAvis/sklearn.py | 1 | 2919 | """
pyLDAvis sklearn
===============
Helper functions to visualize sklearn's LatentDirichletAllocation models
"""
import funcy as fp
import pyLDAvis
def _get_doc_lengths(dtm):
return dtm.sum(axis=1).getA1()
def _get_term_freqs(dtm):
return dtm.sum(axis=0).getA1()
def _get_vocab(vectorizer):
return ve... | bsd-3-clause |
mdeff/ntds_2017 | projects/reports/movie_network/python/costs_function_parallelized.py | 1 | 2617 | import numpy as np
import pandas as pd
from multiprocessing import Pool
from multiprocessing import Pool, cpu_count
from tqdm import tqdm
def cost(x):
costs = np.zeros(Movies.shape[0])
current_film = Movies.iloc[x]
genres_current = get_genres(current_film)
kw_current = get_keywords(current_film)
fo... | mit |
amaurywalbert/twitter | communities_detection/infomap/hashmap_infomap_method_with_ego_without_weight_v1.0.py | 1 | 6669 | # -*- coding: latin1 -*-
################################################################################################
import snap,datetime, sys, time, json, os, os.path, shutil, time, struct, random
import subprocess
import networkx as nx
import matplotlib.pyplot as plt
reload(sys)
sys.setdefaultencoding('utf-8')... | gpl-3.0 |
allenlavoie/tensorflow | tensorflow/python/estimator/inputs/queues/feeding_functions.py | 9 | 19123 | # 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 |
NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/io/formats/format.py | 1 | 90130 | # -*- coding: utf-8 -*-
"""
Internal module for formatting output data in csv, html,
and latex files. This module also applies to display formatting.
"""
from __future__ import print_function
from distutils.version import LooseVersion
# pylint: disable=W0141
from textwrap import dedent
from pandas.core.dtypes.missin... | apache-2.0 |
mjudsp/Tsallis | sklearn/svm/tests/test_svm.py | 29 | 31448 | """
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import numpy as np
import itertools
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.testing import assert_almost_equal
from scipy import sparse
from nose.tools im... | bsd-3-clause |
jupito/dwilib | dwi/tools/check_mask_overlap.py | 2 | 3001 | #!/usr/bin/python3
"""Check if there are voxels in the 'other' mask (e.g. lesion) that don't
overlap the 'container' mask (e.g. prostate).
"""
import argparse
import numpy as np
import matplotlib.pyplot as plt
import dwi.files
import dwi.mask
import dwi.util
def parse_args():
"""Parse command-line arguments."... | mit |
stylianos-kampakis/scikit-learn | examples/model_selection/plot_learning_curve.py | 250 | 4171 | """
========================
Plotting Learning Curves
========================
On the left side the learning curve of a naive Bayes classifier is shown for
the digits dataset. Note that the training score and the cross-validation score
are both not very good at the end. However, the shape of the curve can be found
in ... | bsd-3-clause |
Pantynopants/pyGraph | models.py | 1 | 9095 | # -*- coding=utf-8 -*-
from collections import Mapping
import numpy as np
import pandas as pd
import utils
# from collections.abc import Mapping
__all__ = ['ALGraph', 'VNode', 'ArcNode', 'EdgesetArray']
class ALGraph(Mapping):
"""ALGraph
same operation as dict
using
-------
```
... | mit |
asnorkin/sentiment_analysis | site/lib/python2.7/site-packages/sklearn/discriminant_analysis.py | 7 | 28643 | """
Linear Discriminant Analysis and Quadratic Discriminant Analysis
"""
# Authors: Clemens Brunner
# Martin Billinger
# Matthieu Perrot
# Mathieu Blondel
# License: BSD 3-Clause
from __future__ import print_function
import warnings
import numpy as np
from scipy import linalg
from .extern... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.