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 |
|---|---|---|---|---|---|
JsNoNo/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 |
simon-pepin/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 |
GPlates/Portal | Utils/EMAG2.py | 1 | 2287 | # coding: utf-8
import struct, math, gzip, os
import numpy
from osgeo import gdal
from gdalconst import *
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.colors import LinearSegmentedColormap
import histeq, shading
%matplotlib inline
#fig... | gpl-2.0 |
ljschumacher/tierpsy-tracker | tierpsy/analysis/wcon_export/exportWCON.py | 1 | 9522 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 15 20:55:19 2016
@author: ajaver
"""
import json
import os
from collections import OrderedDict
import zipfile
import numpy as np
import pandas as pd
import tables
from tierpsy.helper.misc import print_flush
from tierpsy.analysis.feat_create.obtainFeaturesHelper import ... | mit |
dsm054/pandas | pandas/tests/indexes/timedeltas/test_formats.py | 9 | 3573 | # -*- coding: utf-8 -*-
import pytest
import pandas as pd
from pandas import TimedeltaIndex
class TestTimedeltaIndexRendering(object):
@pytest.mark.parametrize('method', ['__repr__', '__unicode__', '__str__'])
def test_representation(self, method):
idx1 = TimedeltaIndex([], freq='D')
idx2 = ... | bsd-3-clause |
McIntyre-Lab/papers | nanni_maize_2021/scripts/evaluate_htseq_counts.py | 1 | 5064 | #!/usr/bin/env python
import argparse
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def getOptions():
# Parse command line arguments
parser = argparse.ArgumentParser(description="Evaluate expression from flag on off file")
# Input data
parser.add_argument("-f", "--flag", des... | lgpl-3.0 |
weegreenblobbie/nsound | src/examples/bebot-disp.py | 1 | 12315 | """
$Id: bebot-disp.py 912 2015-07-26 00:50:29Z weegreenblobbie $
Nsound is a C++ library and Python module for audio synthesis featuring
dynamic digital filters. Nsound lets you easily shape waveforms and write
to disk or plot them. Nsound aims to be as powerful as Csound but easy to
use.
Copyright (c) 200... | gpl-2.0 |
teonlamont/mne-python | mne/io/proj.py | 2 | 33757 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Denis Engemann <denis.engemann@gmail.com>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
from copy import deepcopy
from itertools import count
from math i... | bsd-3-clause |
FernanOrtega/DAT210x | Module4/assignment4.py | 1 | 3509 | import pandas as pd
import numpy as np
import scipy.io
import random, math
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def Plot2D(T, title, x, y, num_to_plot=40):
# This method picks a bunch of random samples (images in your case)
# to plot onto the chart:
fig = plt.figure()
ax = f... | mit |
procoder317/scikit-learn | sklearn/decomposition/tests/test_fastica.py | 272 | 7798 | """
Test the fastica algorithm.
"""
import itertools
import warnings
import numpy as np
from scipy import stats
from nose.tools import assert_raises
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from skl... | bsd-3-clause |
BorisJeremic/Real-ESSI-Examples | analytic_solution/test_cases/Contact/Stress_Based_Contact_Verification/HardContact_NonLinHardShear/Normal_Load/Sigma_n_1e9/Normal_Stress_Plot.py | 72 | 2800 | #!/usr/bin/python
import h5py
import matplotlib.pylab as plt
import matplotlib as mpl
import sys
import numpy as np;
import matplotlib;
import math;
from matplotlib.ticker import MaxNLocator
plt.rcParams.update({'font.size': 28})
# set tick width
mpl.rcParams['xtick.major.size'] = 10
mpl.rcParams['xtick.major.width']... | cc0-1.0 |
NikNitro/Python-iBeacon-Scan | sympy/plotting/plot_implicit.py | 83 | 14400 | """Implicit plotting module for SymPy
The module implements a data series called ImplicitSeries which is used by
``Plot`` class to plot implicit plots for different backends. The module,
by default, implements plotting using interval arithmetic. It switches to a
fall back algorithm if the expression cannot be plotted ... | gpl-3.0 |
koverholt/bayes-fire | Example_Cases/Evac_Stairs/Scripts/run_evac_alphabeta_model.py | 1 | 6411 | #!/usr/bin/env python
"""
PyMC Bayesian Inference on Evacuation Data
Model 1: preevac_mu vs theta[0] + theta[1]*occupants + theta[2]*type
Model 2: exit_mu vs theta[0] + theta[1]*occupants + theta[2]*exit_distance + theta[3]*type
Model 3: traveltime_mu vs theta[0] + theta[1]*exit_distance + theta[2]*type
"""
import ma... | bsd-3-clause |
stylianos-kampakis/scikit-learn | examples/manifold/plot_swissroll.py | 330 | 1446 | """
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# License: BSD 3 clause (C) INRIA 2011
print(__doc__)
import matplotlib.pyplot... | bsd-3-clause |
maciekcc/tensorflow | tensorflow/contrib/timeseries/examples/predict.py | 69 | 5579 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
alolou/adr | src/maxent_we.py | 1 | 1944 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from gensim.models import Word2Vec
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import scale
# from TextUtility import TextUtility
def makeFeatureVec(words, model, num_features):
featureVe... | gpl-2.0 |
sanketloke/scikit-learn | examples/linear_model/plot_logistic_multinomial.py | 8 | 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 |
Bleyddyn/malpi | dk/scripts/vae_generator.py | 1 | 4487 | from sklearn.utils import shuffle
import numpy as np
from donkeycar.parts.augment import augment_image
from donkeycar.parts.datastore import Tub
from donkeycar.utils import load_scaled_image_arr
import keras
def vae_generator(cfg, data, batch_size, isTrainSet=True, min_records_to_train=1000, aug=False, aux=None, pilot... | mit |
jjx02230808/project0223 | sklearn/tests/test_multiclass.py | 5 | 21409 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing ... | bsd-3-clause |
jasonost/clinicaltrials | nlp/MeSHprediction_parallel.py | 1 | 5584 | import nltk, codecs, string, random, math, cPickle as pickle, re, multiprocessing
from collections import Counter
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
import numpy as np
from sklearn.metrics.pairwise import linear_kernel
from __future__ import... | mit |
ehashman/oh-mainline | vendor/packages/mechanize/test/test_performance.py | 22 | 2573 | import os
import time
import sys
import unittest
import mechanize
from mechanize._testcase import TestCase, TempDirMaker
from mechanize._rfc3986 import urljoin
KB = 1024
MB = 1024**2
GB = 1024**3
def time_it(operation):
t = time.time()
operation()
return time.time() - t
def write_data(filename, nr_byt... | agpl-3.0 |
puavo-org/puavo-os | parts/wlan/mapper/setup.py | 1 | 1692 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Opinsys Oy
#
# 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 |
jbernhard/qm2017 | qm/plots.py | 1 | 33231 | """ plots / visualizations / figures """
import colorsys
import itertools
import logging
from pathlib import Path
import subprocess
import tempfile
import warnings
import h5py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import lines
from matplotlib import patches
from matplotlib import ticker
f... | mit |
466152112/scikit-learn | examples/applications/plot_model_complexity_influence.py | 323 | 6372 | """
==========================
Model Complexity Influence
==========================
Demonstrate how model complexity influences both prediction accuracy and
computational performance.
The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for
regression (resp. classification).
For each class of models we m... | bsd-3-clause |
poryfly/scikit-learn | examples/svm/plot_svm_scale_c.py | 223 | 5375 | """
==============================================
Scaling the regularization parameter for SVCs
==============================================
The following example illustrates the effect of scaling the
regularization parameter when using :ref:`svm` for
:ref:`classification <svm_classification>`.
For SVC classificati... | bsd-3-clause |
jmetzen/scikit-learn | sklearn/ensemble/tests/test_bagging.py | 18 | 25692 | """
Testing for the bagging ensemble module (sklearn.ensemble.bagging).
"""
# Author: Gilles Louppe
# License: BSD 3 clause
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.te... | bsd-3-clause |
ChenglongChen/Kaggle_HomeDepot | Code/Igor&Kostia/text_processing_wo_google.py | 1 | 63882 | # -*- coding: utf-8 -*-
"""
Initial text preprocessing.
Although text processing can be technically done within feature generation functions,
we found it to be very efficient to make all preprocessing first and only then move to
feature generation. It is because the same processed text is used as an input to
generate... | mit |
github4ry/pathomx | pathomx/plugins/spectra/spectra_peakadj.py | 2 | 3454 | import nmrglue as ng
import numpy as np
import pandas as pd
# Get the target region from the spectra (will be using this for all calculations;
# then applying the result to the original data)
if type(input_data.columns) in [pd.Index, pd.Float64Index]:
scale = input_data.columns.values
elif type(input_data.columns... | gpl-3.0 |
marcotcr/lime | lime/explanation.py | 1 | 11881 | """
Explanation class, with visualization functions.
"""
from io import open
import os
import os.path
import json
import string
import numpy as np
from .exceptions import LimeError
from sklearn.utils import check_random_state
def id_generator(size=15, random_state=None):
"""Helper function to generate random di... | bsd-2-clause |
DailyActie/Surrogate-Model | examples/iris.py | 1 | 1597 | # MIT License
#
# Copyright (c) 2016 Daily Actie
#
# 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, merge, ... | mit |
chrisburr/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 |
rustychris/stompy | stompy/model/delft/dflow_model.py | 1 | 51105 | """
Automate parts of setting up a DFlow hydro model.
TODO:
allow for setting grid bathy from the model instance
"""
import os,shutil,glob,inspect
import six
import logging
log=logging.getLogger('DFlowModel')
import copy
import numpy as np
import xarray as xr
import pandas as pd
from shapely import geometry
import... | mit |
aosingh/Regularization | Lp/MSE_Lp.py | 1 | 1938 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from sklearn.datasets.samples_generator import make_regression
from LpTester import start_lp_regression
from mpl_toolkits.mplot3d import Axes3D
# Define synthetic data-set constants. Change this to experim... | mit |
antiface/ThinkStats2 | code/brfss.py | 69 | 4708 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import math
import sys
import pandas
import numpy as np
import thinkstats2
impo... | gpl-3.0 |
glennq/scikit-learn | sklearn/feature_selection/tests/test_mutual_info.py | 56 | 6268 | from __future__ import division
import numpy as np
from numpy.testing import run_module_suite
from scipy.sparse import csr_matrix
from sklearn.utils.testing import (assert_array_equal, assert_almost_equal,
assert_false, assert_raises, assert_equal)
from sklearn.feature_selection.mut... | bsd-3-clause |
poryfly/scikit-learn | sklearn/__check_build/__init__.py | 345 | 1671 | """ 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 |
dhaase-de/dh-python-dh | dh/thirdparty/tqdm/_tqdm.py | 1 | 43483 | """
Customisable progressbar decorator for iterators.
Includes a default (x)range iterator printing to stderr.
Usage:
>>> from tqdm import trange[, tqdm]
>>> for i in trange(10): #same as: for i in tqdm(xrange(10))
... ...
"""
from __future__ import absolute_import
# integer division / : float, // : int
from... | mit |
linebp/pandas | pandas/tests/series/test_period.py | 7 | 8836 | import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pandas.core.indexes.period as period
from pandas import Series, period_range, DataFrame, Period
def _permute(obj):
return obj.take(np.random.permutation(len(obj)))
class TestSeriesPeriod(object):
def setup_method(self, method):... | bsd-3-clause |
google/audio-to-tactile | extras/python/phonetics/phone_model.py | 1 | 22911 | # Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
sem-geologist/hyperspy | hyperspy/tests/io/test_emd.py | 3 | 26144 | # -*- coding: utf-8 -*-
# Copyright 2007-2015 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | gpl-3.0 |
Leberwurscht/Python-Guitar-Transcription-Aid | Analyze.py | 1 | 1678 | #!/usr/bin/env python
import gtk, numpy, scipy.ndimage
import matplotlib
import matplotlib.backends.backend_gtkcairo as mpl_backend
def get_power(data):
# apply window
window = numpy.hanning(len(data))
data *= window
# fft
power = numpy.abs(numpy.fft.rfft(data))**2.
return power
def smooth(array, window=3)... | gpl-3.0 |
ChanderG/scikit-learn | examples/semi_supervised/plot_label_propagation_digits.py | 268 | 2723 | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | bsd-3-clause |
kylerbrown/scikit-learn | sklearn/neighbors/tests/test_nearest_centroid.py | 305 | 4121 | """
Testing for the nearest centroid module.
"""
import numpy as np
from scipy import sparse as sp
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal
from sklearn.neighbors import NearestCentroid
from sklearn import datasets
from sklearn.metrics.pairwise import pairwise_distances
# t... | bsd-3-clause |
zuku1985/scikit-learn | examples/mixture/plot_gmm.py | 122 | 3265 | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two Gaussians
obtained with Expectation Maximisation (``GaussianMixture`` class) and
Variational Inference (``BayesianGaussianMixture`` class models with
a Dirichlet ... | bsd-3-clause |
RomainBrault/scikit-learn | examples/cluster/plot_face_segmentation.py | 71 | 2839 | """
===================================================
Segmenting the picture of a raccoon face in regions
===================================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to break this image into multiple
partly-homogeneous... | bsd-3-clause |
cmdunkers/DeeperMind | PythonEnv/lib/python2.7/site-packages/scipy/integrate/quadrature.py | 25 | 27849 | from __future__ import division, print_function, absolute_import
__all__ = ['fixed_quad','quadrature','romberg','trapz','simps','romb',
'cumtrapz','newton_cotes']
from scipy.special.orthogonal import p_roots
from scipy.special import gammaln
from numpy import sum, ones, add, diff, isinf, isscalar, \
a... | bsd-3-clause |
wrshoemaker/ffpopsim | examples/mutation_selection_balance_highd.py | 2 | 3699 | '''
author: Richard Neher, Fabio Zanini
date: 11/07/12
content: Example on the steady state distribution of allele frequency in a
balance between mutation and genetic drift using haploid_highd.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the... | gpl-3.0 |
mikelum/pyspeckit | examples/interactive_example_hr2421.py | 8 | 11287 | import pyspeckit
# neet matplotlib so we can make mouse-click events from the script
import matplotlib
import os
# list of annotations so we can clear them
annotations = []
excesslines = []
# get the data from http://cdsarc.u-strasbg.fr/ftp/cats/II/179/sp/hr2421.fit
import urllib2
url = urllib2.urlopen('http://cdsarc... | mit |
piyueh/PetIBM | examples/ibpm/cylinder2dRe550/scripts/plotVorticity.py | 6 | 1402 | """
Computes, plots, and saves the 2D vorticity field from a PetIBM simulation
after 1200 time steps (3 non-dimensional time-units).
"""
import pathlib
import h5py
import numpy
from matplotlib import pyplot
simu_dir = pathlib.Path(__file__).absolute().parents[1]
data_dir = simu_dir / 'output'
# Read vorticity field... | bsd-3-clause |
adamgreenhall/scikit-learn | sklearn/ensemble/__init__.py | 217 | 1307 | """
The :mod:`sklearn.ensemble` module includes ensemble-based methods for
classification and regression.
"""
from .base import BaseEnsemble
from .forest import RandomForestClassifier
from .forest import RandomForestRegressor
from .forest import RandomTreesEmbedding
from .forest import ExtraTreesClassifier
from .fores... | bsd-3-clause |
samuel1208/scikit-learn | sklearn/ensemble/partial_dependence.py | 251 | 15097 | """Partial dependence plots for tree ensembles. """
# Authors: Peter Prettenhofer
# License: BSD 3 clause
from itertools import count
import numbers
import numpy as np
from scipy.stats.mstats import mquantiles
from ..utils.extmath import cartesian
from ..externals.joblib import Parallel, delayed
from ..externals im... | bsd-3-clause |
skidzo/sympy | sympy/plotting/tests/test_plot.py | 6 | 9933 | from sympy import (pi, sin, cos, Symbol, Integral, Sum, sqrt, log,
oo, LambertW, I, meijerg, exp_polar, Max, Piecewise)
from sympy.plotting import (plot, plot_parametric, plot3d_parametric_line,
plot3d, plot3d_parametric_surface)
from sympy.plotting.plot import unset_show
... | bsd-3-clause |
SAGES-UCSC/Photometry | calcZeropoint.py | 1 | 3896 | import sys
import os
from subprocess import call
import numpy as np
import matplotlib.pyplot as plt
from astroquery.vizier import Vizier
import astropy.units as u
import makeRegionFile
import Quadtree as Q
import Sources as S
import phot_utils
import geom_utils
def associate(table, tree2):
dist = 0.000014
ma... | mit |
xuq/lightfm | tests/utils.py | 11 | 2205 | import numpy as np
from sklearn.metrics import roc_auc_score
def precision_at_k(model, ground_truth, k, user_features=None, item_features=None):
"""
Measure precision at k for model and ground truth.
Arguments:
- lightFM instance model
- sparse matrix ground_truth (no_users, no_items)
- int ... | apache-2.0 |
huzq/scikit-learn | examples/linear_model/plot_sgd_early_stopping.py | 17 | 5651 | """
=============================================
Early stopping of Stochastic Gradient Descent
=============================================
Stochastic Gradient Descent is an optimization technique which minimizes a loss
function in a stochastic fashion, performing a gradient descent step sample by
sample. In particu... | bsd-3-clause |
metamx/spark | python/pyspark/sql/dataframe.py | 10 | 64367 | #
# 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 |
petosegan/scikit-learn | examples/decomposition/plot_pca_vs_lda.py | 182 | 1743 | """
=======================================================
Comparison of LDA and PCA 2D projection of Iris dataset
=======================================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
a... | bsd-3-clause |
Lawrence-Liu/scikit-learn | doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py | 256 | 2406 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | bsd-3-clause |
codrut3/tensorflow | tensorflow/examples/learn/iris_run_config.py | 76 | 2565 | # 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 appl... | apache-2.0 |
s20121035/rk3288_android5.1_repo | cts/suite/audio_quality/test_description/processing/check_spectrum.py | 5 | 5840 | #!/usr/bin/python
# Copyright (C) 2012 The Android Open Source Project
#
# 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 |
aigamedev/scikit-neuralnetwork | sknn/tests/test_classifier.py | 3 | 6807 | import unittest
from nose.tools import (assert_is_not_none, assert_true, assert_raises,
assert_in, assert_equal, assert_less_equal)
import numpy
from sklearn.base import clone
from sknn.mlp import Classifier as MLPC
from sknn.mlp import Layer as L, Convolution as C
class TestClassifierFuncti... | bsd-3-clause |
RPGOne/Skynet | scikit-learn-0.18.1/sklearn/utils/tests/test_shortest_path.py | 303 | 2841 | from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | bsd-3-clause |
rikima/spark | python/pyspark/sql/types.py | 2 | 65691 | #
# 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 |
binarybana/samcnet | exps/mpm.py | 1 | 10095 | import os
import sys
import tempfile
import yaml
import zlib
import numpy as np
import simplejson as js
import subprocess as sb
from time import time,sleep
from os import path
from scipy.stats.mstats import mquantiles
try:
from sklearn.lda import LDA
from sklearn.svm import SVC
from sklearn.neighbors impor... | mit |
o0neup/ibis | ibis/util.py | 5 | 4572 | # Copyright 2014 Cloudera 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 writing, so... | apache-2.0 |
pravsripad/jumeg | jumeg/decompose/ica.py | 2 | 35344 | # ICA functions
'''
authors:
Juergen Dammers
Lukas Breuer
email: j.dammers@fz-juelich.de
Change history:
21.01.2020: - changes in ica_array
- now returns an MNE-type of ICA object (default)
- in fastica changed default to whiten=False
- added fu... | bsd-3-clause |
nliolios24/textrank | textrank.py | 1 | 1442 | import string
import nltk
import sys
import networkx as nx
import numpy as np
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
from collections import Counter
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extra... | mit |
dr-bigfatnoob/effort | datasets/cleaned/maxwell.py | 1 | 2885 | from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
from datasets.dataset import Dataset, Meta, read_pandas_dataframe
from datasets.cleaned import data_to_use
class Maxwell(Dataset):
def __init__(self):
Dataset.__init__(self,... | mit |
havok2063/cookiecutter-marvin | {{cookiecutter.repo_name}}/docs/sphinx/conf.py | 1 | 10487 | # -*- coding: utf-8 -*-
#
# Marvin documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 10 08:50:42 2016.
#
# 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.
#
# Al... | bsd-3-clause |
Aditya8795/Image-Processing- | DCT.py | 2 | 4996 |
import io
import os
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
from scipy import fftpack
from urllib.request import urlopen
import IPython
# [Source](http://bugra.github.io/work/notes/2014-07-12/discre-fourier-cosine-transform-dft-dct-image-compression/)
# [My Notes](https://docs.google.... | mit |
Achuth17/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 |
HolgerPeters/scikit-learn | examples/linear_model/plot_robust_fit.py | 147 | 3050 | """
Robust linear estimator fitting
===============================
Here a sine function is fit with a polynomial of order 3, for values
close to zero.
Robust fitting is demoed in different situations:
- No measurement errors, only modelling errors (fitting a sine with a
polynomial)
- Measurement errors in X
- M... | bsd-3-clause |
dmnfarrell/mhcpredict | epitopepredict/sequtils.py | 1 | 22463 | #!/usr/bin/env python
"""
Sequence utilities and genome annotation methods
Created November 2013
Copyright (C) Damien Farrell
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; e... | apache-2.0 |
NeuPhysics/codebase | ipynb/matter/py-server/two-freq-trans-prob.py | 1 | 1925 |
# coding: utf-8
# In[ ]:
import numpy as np
from scipy.integrate import odeint
from scipy.integrate import ode
import matplotlib.pylab as plt
endpoint = 10000000; # integration range
dx = 10.0; # step size
lam0 = 0.845258; # in unit of omegam, omegam = 3.66619*10^-17
dellam = np.array([0.00003588645221954444, ... | mit |
supergis/QGIS | python/plugins/processing/algs/qgis/RasterLayerHistogram.py | 12 | 3376 | # -*- coding: utf-8 -*-
"""
***************************************************************************
RasterLayerHistogram.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*****************... | gpl-2.0 |
wyfzeqw/Environmental-Influence-on-Crowd-Dynamics | Project/3_fsg.py | 1 | 1508 | import numpy as np
from pandas import *
import math
# a = np.arange(9).reshape((3,3))
arr = np.loadtxt(open("csv files/matlab.csv","rb"),delimiter=",",skiprows=0)
data = np.loadtxt(open("csv files/output_tindex.csv","rb"),delimiter=",",skiprows=0)
# slice the arr(matlab csv) with the start time and end time
# then dr... | mit |
mattgiguere/scikit-learn | examples/linear_model/plot_lasso_coordinate_descent_path.py | 254 | 2639 | """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
The coefficients can be forced to be positive.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import num... | bsd-3-clause |
abhitopia/tensorflow | tensorflow/contrib/learn/python/learn/tests/dataframe/tensorflow_dataframe_test.py | 51 | 12969 | # 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 |
BonexGu/Blik2D-SDK | Blik2D/addon/tensorflow-1.2.1_for_blik/tensorflow/contrib/learn/python/learn/estimators/estimator.py | 7 | 55607 | # 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... | mit |
manipopopo/tensorflow | tensorflow/contrib/timeseries/examples/multivariate.py | 10 | 5155 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
q1ang/scikit-learn | sklearn/feature_selection/tests/test_chi2.py | 221 | 2398 | """
Tests for chi2, currently the only feature selection function designed
specifically to work with sparse matrices.
"""
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
import scipy.stats
from sklearn.feature_selection import SelectKBest, chi2
from sklearn.feature_selection.univariate_selection im... | bsd-3-clause |
lensacom/sparkit-learn | splearn/tests/test_pipeline.py | 1 | 11950 | import numpy as np
import scipy.sparse as sp
from sklearn.base import clone
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_selection import VarianceThreshold
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.pipeline import FeatureUnion, Pipeline
from sklearn.ut... | apache-2.0 |
AstroVPK/libcarma | examples/MBHBCARMAFit.py | 2 | 5298 | import math
import numpy as np
import copy
import random
import psutil
import os
import sys
import pdb
import matplotlib.pyplot as plt
import matplotlib.cm as colormap
import brewer2mpl
try:
import kali.mbhbcarma
except ImportError:
print 'Cannot import kali.mbhbcarma! kali is not setup. Setup kali by sourcin... | gpl-2.0 |
hitlonewind/PR-experiment | Classifrer/classifer.py | 1 | 4186 | print(__doc__)
#coding=utf-8
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.ne... | mit |
vortex-ape/scikit-learn | examples/svm/plot_svm_anova.py | 7 | 2046 | """
=================================================
SVM-Anova: SVM with univariate feature selection
=================================================
This example shows how to perform univariate feature selection before running a
SVC (support vector classifier) to improve the classification scores.
"""
print(__doc_... | bsd-3-clause |
evature/android | EvaSDK/evasdk/src/main/jni/webrtc/modules/video_coding/codecs/test/plot_webrtc_test_logs.py | 3 | 13317 | # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing proje... | mit |
hmendozap/auto-sklearn | test/test_pipeline/components/data_preprocessing/test_scaling.py | 1 | 2446 | import unittest
import numpy as np
import sklearn.datasets
from autosklearn.pipeline.components.data_preprocessing.rescaling import RescalingChoice
from autosklearn.pipeline.util import get_dataset
class ScalingComponentTest(unittest.TestCase):
def _test_helper(self, Preprocessor, dataset=None, make_sparse=Fals... | bsd-3-clause |
saketkc/bio-tricks | meme_parser/meme_processory.py | 1 | 2759 | #!/usr/bin/env python
"""
Process meme.txt files to
generate conservation plots
"""
import argparse
import csv
import sys
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.stats import pearsonr
from Bio import motifs
def plot_meme_against_phylo(meme_record, phylo):
sns.set(s... | mit |
NelisVerhoef/scikit-learn | examples/calibration/plot_calibration_curve.py | 225 | 5903 | """
==============================
Probability Calibration curves
==============================
When performing classification one often wants to predict not only the class
label, but also the associated probability. This probability gives some
kind of confidence on the prediction. This example demonstrates how to di... | bsd-3-clause |
jmd-dk/concept | concept/tests/fluid_vacuum/analyze.py | 1 | 4997 | # This file has to be run in pure Python mode!
# Imports from the CO𝘕CEPT code
from commons import *
from snapshot import load
import species
plt = get_matplotlib().pyplot
# Absolute path and name of the directory of this file
this_dir = os.path.dirname(os.path.realpath(__file__))
this_test = os.path.basename(this_... | gpl-3.0 |
robintw/scikit-image | skimage/viewer/utils/core.py | 18 | 6556 | import warnings
import numpy as np
from ..qt import QtWidgets, has_qt, FigureManagerQT, FigureCanvasQTAgg
import matplotlib as mpl
from matplotlib.figure import Figure
from matplotlib import _pylab_helpers
from matplotlib.colors import LinearSegmentedColormap
if has_qt and 'agg' not in mpl.get_backend().lower():
... | bsd-3-clause |
freemindhv/tq-python | docs/conf.py | 1 | 8134 | # -*- coding: utf-8 -*-
#
# 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.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
imp... | gpl-2.0 |
huongttlan/bokeh | bokeh/tests/test_protocol.py | 42 | 3959 | from __future__ import absolute_import
import unittest
from unittest import skipIf
import numpy as np
try:
import pandas as pd
is_pandas = True
except ImportError as e:
is_pandas = False
class TestBokehJSONEncoder(unittest.TestCase):
def setUp(self):
from bokeh.protocol import BokehJSONEnc... | bsd-3-clause |
moble/sympy | examples/intermediate/sample.py | 107 | 3494 | """
Utility functions for plotting sympy functions.
See examples\mplot2d.py and examples\mplot3d.py for usable 2d and 3d
graphing functions using matplotlib.
"""
from sympy.core.sympify import sympify, SympifyError
from sympy.external import import_module
np = import_module('numpy')
def sample2d(f, x_args):
"""
... | bsd-3-clause |
zhonghualiu/FaST-LMM | fastlmm/inference/glmm.py | 1 | 26306 | import scipy as SP
import scipy.stats as ST
import numpy as NP
from numpy import dot
from scipy.linalg import cholesky,solve_triangular
from fastlmm.external.util.math import check_definite_positiveness,check_symmetry,ddot,dotd,trace2
from fastlmm.external.util.math import stl, stu
from sklearn.base import BaseE... | apache-2.0 |
sknepneklab/SAMoS | analysis/plot_analysis_polar/plot_order_PRE.py | 1 | 3758 | # ################################################################
#
# Active Particles on Curved Spaces (APCS)
#
# Author: Silke Henkes
#
# ICSMB, Department of Physics
# University of Aberdeen
#
# (c) 2013, 2014
#
# This program cannot be used, copied, or modified without
# expli... | gpl-3.0 |
sanjayankur31/nest-simulator | pynest/examples/spatial/grid_iaf_irr.py | 20 | 1453 | # -*- coding: utf-8 -*-
#
# grid_iaf_irr.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, o... | gpl-2.0 |
williamgilpin/netsim | marktools/renorm_neq.py | 1 | 3232 | """
Given row-normalized stochastic matrices, functions to consolidate columns, rows,
and both rows and columns. Unlike the function renorm(), the row consolidation
does not use the steady-state state occupation probabilities but instead weighs
each row in a cluster equally---corresponding to local equilibration over s... | mit |
ashapochka/saapy | setup.py | 1 | 3540 | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
deps = [
'invoke', # task automation tool, see tasks.py for project task definitions
# python optimization and utilities
'cython', # python to c optimization
'toolz', # functional programming support
'recordclass', # better th... | apache-2.0 |
poryfly/scikit-learn | sklearn/kernel_approximation.py | 258 | 17973 | """
The :mod:`sklearn.kernel_approximation` module implements several
approximate kernel feature maps base on Fourier transforms.
"""
# Author: Andreas Mueller <amueller@ais.uni-bonn.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import svd
from .base im... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.