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 |
|---|---|---|---|---|---|
YaguangZhang/EarsMeasurementCampaignCode | PostProcessing/lib/ext/gnuradio-tools/examples/example_costas.py | 17 | 4430 | #!/usr/bin/env python
from gnuradio import gr, digital
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
try:
import scipy
except ImportError:
print "Error: could not import scipy (http://www.scipy.org/)"
sys.exit(1)
try:
import pylab
excep... | mit |
choderalab/openpathsampling | openpathsampling/analysis/tis/core.py | 3 | 15834 | import collections
import openpathsampling as paths
from openpathsampling.netcdfplus import StorableNamedObject
from openpathsampling.progress import SimpleProgress
import pandas as pd
import numpy as np
def steps_to_weighted_trajectories(steps, ensembles):
"""Bare function to convert to the weighted trajs dictio... | lgpl-2.1 |
mrosemeier/fusedwind | src/fusedwind/lib/environment.py | 2 | 11963 | #!/usr/bin/env python
# encoding: utf-8
"""
environment.py
Created by Andrew Ning on 2012-01-20.
Copyright (c) NREL. All rights reserved.
"""
import math
import numpy as np
from scipy.optimize import brentq
from openmdao.main.api import Component
from openmdao.main.datatypes.api import Float, Array
from utilities im... | apache-2.0 |
dingocuster/scikit-learn | sklearn/datasets/mldata.py | 309 | 7838 | """Automatically download MLdata datasets."""
# Copyright (c) 2011 Pietro Berkes
# License: BSD 3 clause
import os
from os.path import join, exists
import re
import numbers
try:
# Python 2
from urllib2 import HTTPError
from urllib2 import quote
from urllib2 import urlopen
except ImportError:
# Pyt... | bsd-3-clause |
valexandersaulys/prudential_insurance_kaggle | venv/lib/python2.7/site-packages/pandas/tseries/base.py | 9 | 18538 | """
Base and utility classes for tseries type pandas objects.
"""
import warnings
from datetime import datetime, timedelta
from pandas import compat
import numpy as np
from pandas.core import common as com, algorithms
from pandas.core.common import is_integer, is_float, AbstractMethodError
import pandas.tslib as tsli... | gpl-2.0 |
kmather73/zipline | tests/modelling/test_frameload.py | 11 | 6900 | """
Tests for zipline.data.ffc.frame.DataFrameFFCLoader
"""
from unittest import TestCase
from mock import patch
from numpy import arange
from numpy.testing import assert_array_equal
from pandas import (
DataFrame,
DatetimeIndex,
Int64Index,
)
from zipline.lib.adjustment import (
Float64Add,
Float... | apache-2.0 |
herilalaina/scikit-learn | sklearn/datasets/base.py | 13 | 30226 | """
Base IO code for all datasets
"""
# Copyright (c) 2007 David Cournapeau <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from __future__ import print_function
import os
import csv
import sy... | bsd-3-clause |
pbrod/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 |
cmdunkers/DeeperMind | PythonEnv/lib/python2.7/site-packages/scipy/stats/_multivariate.py | 17 | 69089 | #
# Author: Joris Vankerschaver 2013
#
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.linalg
from scipy.misc import doccer
from scipy.special import gammaln, psi, multigammaln
from scipy._lib._util import check_random_state
__all__ = ['multivariate_normal', 'dirichle... | bsd-3-clause |
bloyl/mne-python | mne/decoding/tests/test_search_light.py | 14 | 10119 | # Author: Jean-Remi King, <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from numpy.testing import assert_array_equal, assert_equal
import pytest
from mne.utils import requires_sklearn
from mne.fixes import _get_args
from mne.decoding.search_light import SlidingEstimator, GeneralizingEstimat... | bsd-3-clause |
lcdb/lcdblib | lcdblib/plotting/colormap_adjust.py | 1 | 5183 | """
Module to handle custom colormaps.
`cmap_powerlaw_adjust`, `cmap_center_adjust`, and
`cmap_center_adjust` are from
https://sites.google.com/site/theodoregoetz/notes/matplotlib_colormapadjust
"""
import math
import copy
import numpy
import numpy as np
from matplotlib import pyplot, colors, cm
import matplotlib
imp... | mit |
rajat1994/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 |
rohanp/scikit-learn | sklearn/model_selection/tests/test_split.py | 17 | 37397 | """Test the split module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy import stats
from scipy.misc import comb
from itertools import combinations
from sklearn.utils.fixes import combinations_with_replacement
from sklearn.utils.testing import asse... | bsd-3-clause |
Isaac-W/cpr-vision-measurement | dataloader.py | 1 | 6474 | import csv
import numpy as np
import matplotlib.pyplot as plt
import peakutils
from datetime import datetime
from datalogger import TIME_FORMAT
from markerutils import *
SMOOTH_WINDOW_SIZE = 3
def average(values):
return sum(values) / float(len(values))
def time_parse(value):
try:
return datetime.... | mit |
fspaolo/scikit-learn | examples/linear_model/plot_ard.py | 8 | 2588 | """
==================================================
Automatic Relevance Determination Regression (ARD)
==================================================
Fit regression model with Bayesian Ridge Regression.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary l... | bsd-3-clause |
cmusatyalab/dermshare | gemini/gemini/learn.py | 2 | 1052 | #
# Gemini -- machine learners
#
# Copyright (c) 2014-2015 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES
# ... | epl-1.0 |
eric-haibin-lin/mxnet | example/reinforcement-learning/ddpg/strategies.py | 10 | 2474 | # 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 u... | apache-2.0 |
PyLadiesTC/Dcubed-installfest-2015 | Python-titanic-intro.py | 1 | 3550 | # coding: utf-8
# # Python Practice with Titanic
#
# ## Getting Started
# We'll be practicing with the Kaggle 'Titanic: Machine Learning from Disaster' dataset available here:
# http://www.kaggle.com/c/titanic-gettingStarted/data. Go ahead and download the 'train.csv' file and use the
# Python commands described be... | mit |
xavierwu/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 |
spacelis/hrnn4sim | hrnn4sim/data_augmentation.py | 1 | 3901 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: data_augmentation.py
Author: Wen Li
Email: spacelis@gmail.com
Github: http://github.com/spacelis
Description: Augmenting data with some sythetic negative examples.
"""
# pylint: disable=invalid-name
from __future__ import print_function
import sys
import re
impo... | mit |
dmytroKarataiev/MachineLearning | learning/ud120-projects/feature_selection/find_signature.py | 1 | 1824 | #!/usr/bin/python
import pickle
import numpy
numpy.random.seed(42)
### The words (features) and authors (labels), already largely processed.
### These files should have been created from the previous (Lesson 10)
### mini-project.
words_file = "../text_learning/your_word_data.pkl"
authors_file = "../text_learning/yo... | mit |
nomadcube/scikit-learn | sklearn/metrics/cluster/__init__.py | 312 | 1322 | """
The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for
cluster analysis results. There are two forms of evaluation:
- supervised, which uses a ground truth class values for each sample.
- unsupervised, which does not and measures the 'quality' of the model itself.
"""
from .supervised import ... | bsd-3-clause |
massmutual/scikit-learn | examples/model_selection/plot_train_error_vs_test_error.py | 349 | 2577 | """
=========================
Train error vs Test error
=========================
Illustration of how the performance of an estimator on unseen data (test data)
is not the same as the performance on training data. As the regularization
increases the performance on train decreases while the performance on test
is optim... | bsd-3-clause |
fbagirov/scikit-learn | sklearn/feature_extraction/image.py | 263 | 17600 | """
The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to
extract features from images.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel
# Vlad Niculae
# License: BSD 3 clause
fro... | bsd-3-clause |
ScreamingUdder/mantid | scripts/PyChop/ISISDisk.py | 1 | 21169 | # pylint: disable=line-too-long, invalid-name, too-many-locals, too-many-branches, unused-variable
# pylint: disable=attribute-defined-outside-init, old-style-class, too-many-instance-attributes
"""
Contains the ISISDisk class which calculates resolution and flux for ISIS Disk chopper
spectrometer (LET) - using the fu... | gpl-3.0 |
dvro/imbalanced-learn | imblearn/combine/smote_enn.py | 2 | 6049 | """Class to perform over-sampling using SMOTE and cleaning using ENN."""
from __future__ import print_function
from __future__ import division
from ..over_sampling import SMOTE
from ..under_sampling import EditedNearestNeighbours
from ..base import BaseBinarySampler
class SMOTEENN(BaseBinarySampler):
"""Class to... | mit |
wolfiex/DSMACC-testing | dsmacc/datatables/vankrevelen.py | 1 | 1327 | from rdkit import Chem
from rdkit.Chem import rdMolDescriptors
from rdkit.Chem import rdmolops
import numpy as np
import pandas as pd
my_smiles_string = 'C1=CC(=C(C=C1C(CN)O)O)O'
def get_ratio(my_smiles_string):
try:
my_mol = Chem.MolFromSmiles(my_smiles_string)
#print(rdMolDescriptors.CalcMolForm... | gpl-3.0 |
idlead/scikit-learn | examples/decomposition/plot_sparse_coding.py | 12 | 4007 | """
===========================================
Sparse coding with a precomputed dictionary
===========================================
Transform a signal as a sparse combination of Ricker wavelets. This example
visually compares different sparse coding methods using the
:class:`sklearn.decomposition.SparseCoder` esti... | bsd-3-clause |
Djabbz/scikit-learn | examples/tree/plot_iris.py | 271 | 2186 | """
================================================================
Plot the decision surface of a decision tree on the iris dataset
================================================================
Plot the decision surface of a decision tree trained on pairs
of features of the iris dataset.
See :ref:`decision tree ... | bsd-3-clause |
RachitKansal/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 |
polyanskiy/refractiveindex.info-scripts | scripts/Rakic 1996 - GaAs.py | 1 | 3121 | # -*- coding: utf-8 -*-
# Author: Mikhail Polyanskiy
# Last modified: 2017-04-09
# Original data: Rakić and Majewski 1996, https://doi.org/10.1063/1.363586
import numpy as np
import matplotlib.pyplot as plt
# model parameters
E0 = 1.410 #eV
Δ0 = 1.746-E0#eV
E1 = 2.926 #eV
Δ1 = 3.170-E1#eV
εinf = 0.77
A ... | gpl-3.0 |
paladin74/neural-network-animation | matplotlib/tight_bbox.py | 22 | 2601 | """
This module is to support *bbox_inches* option in savefig command.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import warnings
from matplotlib.transforms import Bbox, TransformedBbox, Affine2D
def adjust_bbox(fig, bbox_inches, fixe... | mit |
almarklein/bokeh | scripts/interactive_tester.py | 1 | 6655 | import argparse
import importlib
import os
from shutil import rmtree
from six.moves import input
import sys
import textwrap
import time
# TODO:
# catch and log exceptions in examples files that fail to open
DIRECTORIES = {
'file' : '../../examples/plotting/file',
'notebook': '../../examples/plotting... | bsd-3-clause |
sknepneklab/SAMoS | utils/Hessian2d.py | 1 | 13793 | # ***************************************************************************
# *
# * Copyright (C) 2013-2016 University of Dundee
# * All rights reserved.
# *
# * This file is part of SAMoS (Soft Active Matter on Surfaces) program.
# *
# * SAMoS is free software; you can redistribute it and/or modify
# * it unde... | gpl-3.0 |
arabenjamin/scikit-learn | sklearn/mixture/tests/test_gmm.py | 200 | 17427 | import unittest
import copy
import sys
from nose.tools import assert_true
import numpy as np
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_raises)
from scipy import stats
from sklearn import mixture
from sklearn.datasets.samples_generator import make_spd_ma... | bsd-3-clause |
MatthieuBizien/scikit-learn | sklearn/linear_model/tests/test_ransac.py | 52 | 17482 | from scipy import sparse
import numpy as np
from scipy import sparse
from numpy.testing import assert_equal, assert_raises
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_raises_rege... | bsd-3-clause |
alialerwi/LearningRepository | code-python3/natural_language_processing.py | 12 | 10000 | import math, random, re
from collections import defaultdict, Counter
from bs4 import BeautifulSoup
import requests
def plot_resumes(plt):
data = [ ("big data", 100, 15), ("Hadoop", 95, 25), ("Python", 75, 50),
("R", 50, 40), ("machine learning", 80, 20), ("statistics", 20, 60),
("data science", 6... | unlicense |
ptkool/spark | python/pyspark/sql/udf.py | 1 | 21057 | #
# 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 |
alurban/mentoring | tidal_disruption/scripts/schwarzschild_potentials.py | 1 | 4349 | # Imports.
import numpy as np
from numpy import pi
import matplotlib.pyplot as plt
import matplotlib.patheffects as PE
from matplotlib import ticker
# Define the effective potential.
def potential(r, h):
return -1/r + (h/r)**2/2 - h**2/r**3
# Set array of orbital separation values.
r = np.linspace(1e-4, 100, 1000... | gpl-3.0 |
idanivanov/catdtree | catdtree/classification/c45.py | 1 | 6198 | from catdtree import BaseDecisionTree
from scipy import stats
class C45(BaseDecisionTree):
"""C4.5 decision tree for classification.
This class implements a decision tree using the C4.5 algorithm for
building it.
References:
* Quinlan, J. R. C4.5: Programs for Machine Learning. Morgan Kaufma... | mit |
PYPIT/PYPIT | pypeit/fluxspec.py | 1 | 20140 | # Module for guiding Slit/Order tracing
from __future__ import absolute_import, division, print_function
import inspect
import numpy as np
import linetools
import os
import json
import matplotlib.pyplot as plt
#from importlib import reload
from astropy import units
from astropy.io import fits
from pypeit import msg... | gpl-3.0 |
dpinney/omf | omf/models/cvrStatic.py | 1 | 19551 | ''' Calculate CVR impacts using a targetted set of static loadflows. '''
import json, os, shutil, math, base64, platform
from copy import copy
from os.path import join as pJoin
import matplotlib
if platform.system() == 'Darwin':
matplotlib.use('TkAgg')
else:
matplotlib.use('Agg')
from matplotlib import pyplot as pl... | gpl-2.0 |
sanghack81/SDCIT | experiments/run_time_sdcit.py | 1 | 2417 | import time
from os.path import exists
import pandas as pd
import scipy.io
from experiments.exp_setup import *
from sdcit.sdcit import c_SDCIT
from sdcit.utils import rbf_kernel_median, K2D
if __name__ == '__main__':
# experiments
fname = SDCIT_RESULT_DIR + '/c_sdcit_time.csv'
independent = 1
if not ... | mit |
Haleyo/spark-tk | regression-tests/sparktkregtests/testcases/graph/graph_triangle_count_test.py | 10 | 2503 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
YuepengGuo/zipline | zipline/finance/risk/cumulative.py | 9 | 17469 | #
# Copyright 2014 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
asalomatov/variants | variants/work/scratch_variant.py | 1 | 5663 | from scipy import stats, integrate
import matplotlib.pyplot as plt
import seaborn as sns
#plot univariate distributions
x = np.random.normal(size=1000)
y = np.random.normal(size=1000)
plt.hold(False)
plt.scatter(x, y)
plt.plot(x)
sns.distplot(x)
plt.clf()
# read a vcf file using PyVCF
who
import vcf
#'ios_mut_stat... | mit |
tomsilver/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... | gpl-3.0 |
tillrohrmann/flink | flink-python/pyflink/table/tests/test_pandas_udf.py | 2 | 16329 | ################################################################################
# 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... | apache-2.0 |
ratnania/pigasus | doc/manual/include/demo/test_poisson_circle_metric.py | 1 | 3938 | #! /usr/bin/python
# ...
try:
from matplotlib import pyplot as plt
PLOT=True
except ImportError:
PLOT=False
# ...
import numpy as np
from pigasus.gallery.poisson import *
import sys
import inspect
filename = inspect.getfile(inspect.currentframe()) # script filename (usually with path)
# ...... | mit |
jaeilepp/eggie | mne/io/base.py | 1 | 73937 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
from math import floor, ceil
import copy
from copy import... | bsd-2-clause |
beepee14/scikit-learn | sklearn/cross_validation.py | 15 | 68189 | """
The :mod:`sklearn.cross_validation` module includes utilities for cross-
validation and performance evaluation.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from... | bsd-3-clause |
Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/pandas/tests/frame/test_dtypes.py | 4 | 26600 | # -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
from datetime import timedelta
import numpy as np
from pandas import (DataFrame, Series, date_range, Timedelta, Timestamp,
compat, concat, option_context)
from pandas.compat import u
from pandas.core.dtypes.dtypes import... | agpl-3.0 |
trachelr/mne-python | mne/tests/test_report.py | 9 | 8943 | # Authors: Mainak Jas <mainak@neuro.hut.fi>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
import os
import os.path as op
import glob
import warnings
import shutil
from nose.tools import assert_true, assert_equal, assert_raises
from mne import Epochs, read_events, pick_types, read_evokeds
... | bsd-3-clause |
B3AU/waveTree | sklearn/utils/setup.py | 4 | 2703 | import os
from os.path import join
from sklearn._build_utils import get_blas_info
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('utils', parent_package, top_path)
config.add_subpackage('sparsetools')
... | bsd-3-clause |
jblackburne/scikit-learn | examples/decomposition/plot_image_denoising.py | 70 | 6249 | """
=========================================
Image denoising using dictionary learning
=========================================
An example comparing the effect of reconstructing noisy fragments
of a raccoon face image using firstly online :ref:`DictionaryLearning` and
various transform methods.
The dictionary is fi... | bsd-3-clause |
liangz0707/scikit-learn | sklearn/neighbors/nearest_centroid.py | 199 | 7249 | # -*- coding: utf-8 -*-
"""
Nearest Centroid Classification
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse as sp
from ..base import BaseEstimator, ClassifierMixin
from ..met... | bsd-3-clause |
moutai/scikit-learn | examples/svm/plot_oneclass.py | 80 | 2338 | """
==========================================
One-class SVM with non-linear kernel (RBF)
==========================================
An example using a one-class SVM for novelty detection.
:ref:`One-class SVM <svm_outlier_detection>` is an unsupervised
algorithm that learns a decision function for novelty detection:
... | bsd-3-clause |
blaze/dask | docs/source/scripts/scheduling.py | 1 | 3230 | from time import time
import dask
from dask import threaded, multiprocessing, local
from random import randint
import matplotlib.pyplot as plt
def noop(x):
pass
nrepetitions = 1
def trivial(width, height):
""" Embarrassingly parallel dask """
d = {("x", 0, i): i for i in range(width)}
for j in ran... | bsd-3-clause |
jmschrei/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 |
huzq/scikit-learn | examples/linear_model/plot_ridge_path.py | 75 | 2129 | """
===========================================================
Plot Ridge coefficients as a function of the regularization
===========================================================
Shows the effect of collinearity in the coefficients of an estimator.
.. currentmodule:: sklearn.linear_model
:class:`Ridge` Regressi... | bsd-3-clause |
terkkila/scikit-learn | examples/ensemble/plot_forest_importances.py | 241 | 1761 | """
=========================================
Feature importances with forests of trees
=========================================
This examples shows the use of forests of trees to evaluate the importance of
features on an artificial classification task. The red bars are the feature
importances of the forest, along wi... | bsd-3-clause |
datacommonsorg/data | scripts/oecd/regional_demography/gen_place_mapping_stats.py | 1 | 1752 | import pandas as pd
## PART 1: JUST THE RESOLVER
df = pd.read_csv("geos_resolved.csv")
df.errors = df.errors.str[:25] + "..."
df['namespace'] = df['dcid'].map(lambda x: str(x).split('/')[0])
print("""
PLACE RESOLUTION STATISTICS
This only tracks the resolution statistics from `tools/place_name_resolver/`.
The fina... | apache-2.0 |
SpatialMetabolomics/SM_distributed | sm/engine/tests/test_isocalc_wrapper.py | 2 | 1190 | import pytest
import numpy as np
import pandas as pd
from numpy.testing import assert_array_almost_equal
from sm.engine.isocalc_wrapper import IsocalcWrapper, ISOTOPIC_PEAK_N
from sm.engine.tests.util import ds_config
@pytest.mark.parametrize("sf, adduct", [
(None, '+H'),
('Au', None),
('Np', '+H'),
... | apache-2.0 |
trankmichael/scikit-learn | examples/feature_selection/plot_rfe_with_cross_validation.py | 226 | 1384 | """
===================================================
Recursive feature elimination with cross-validation
===================================================
A recursive feature elimination example with automatic tuning of the
number of features selected with cross-validation.
"""
print(__doc__)
import matplotlib.p... | bsd-3-clause |
hvanhovell/spark | dev/sparktestsupport/modules.py | 3 | 15880 | #
# 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 |
ephes/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 |
mannyfin/VolatilityForecasting | src/NumDaysWeeksMonths.py | 1 | 1887 | def NumDaysWeeksMonths(df):
"""
Takes the input df and finds the days, weeks, and months in the pd.dataframe
:param df:
:return days_weeks_months, num__days_per__year:
"""
import pandas as pd
days_weeks_months = {}
for i in range(len(df.Date.unique())):
year = str(pd.to_... | gpl-3.0 |
datapythonista/pandas | pandas/io/pickle.py | 3 | 7670 | """ pickle compat """
import pickle
from typing import Any
import warnings
from pandas._typing import (
CompressionOptions,
FilePathOrBuffer,
StorageOptions,
)
from pandas.compat import pickle_compat as pc
from pandas.util._decorators import doc
from pandas.core import generic
from pandas.io.common impor... | bsd-3-clause |
soylentdeen/BlurryApple | Disturbances/zerndecomp.py | 2 | 3188 | import scipy
import pyfits
import numpy
import matplotlib.pyplot as pyplot
from scipy.optimize import leastsq as lsq
fig = pyplot.figure(0)
fig.clear()
closeddf = '/home/deen/Data/GRAVITY/LoopClosure/cld_4/cld_4.fits'
opendf = '/home/deen/Data/GRAVITY/LoopClosure/old_2/old_2.fits'
CMf = '/home/deen/Code/Python/Blurry... | gpl-2.0 |
ericd/redeem | redeem/Util.py | 2 | 8220 | """
Util functions for Redeem
Author: Elias Bakken
email: elias(dot)bakken(at)gmail(dot)com
Website: http://www.thing-printer.com
License: GNU GPL v3: http://www.gnu.org/copyleft/gpl.html
Redeem is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published... | gpl-3.0 |
smorante/continuous-goal-directed-actions | simulated-CGDA/recognition/recognition_test3.py | 1 | 3281 |
from __future__ import division
import numpy as np
import mlpy.dtwcore as md
from scipy.interpolate import Rbf, InterpolatedUnivariateSpline
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import pylab as pl
# reading file
actionGeneral="paint"
actionQuery ="paint"
vectorOne = np.loadtxt("generalized/"+... | mit |
bartosh/zipline | tests/test_algorithm.py | 1 | 172682 | #
# Copyright 2014 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
aleksandr-bakanov/astropy | astropy/visualization/tests/test_units.py | 3 | 3190 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import pytest
try:
import matplotlib.pyplot as plt
except ImportError:
HAS_PLT = False
else:
HAS_PLT = True
from astropy import units as u
from astropy.coordinates import Angle
from astropy.visualization.un... | bsd-3-clause |
MartinDelzant/scikit-learn | sklearn/decomposition/tests/test_online_lda.py | 49 | 13124 | import numpy as np
from scipy.linalg import block_diag
from scipy.sparse import csr_matrix
from scipy.special import psi
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d,
_dirichlet_expect... | bsd-3-clause |
mmlab/eice | EiCGraphAlgo/plots/plot_checked_resources_vs_pathlengths.py | 1 | 3587 | from core import cached_pathfinder
import sys, time
import scipy.stats as spst
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from numpy.random import normal
from pylab imp... | agpl-3.0 |
StupidTortoise/personal | python/knn.py | 1 | 1045 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
iris = load_iris()
n_samples, n_features = iris.data.shape
print(iris.keys())
print((n_samples, n_features))
print(iris.data.shape)
print(iris.target.shape)
print(iris.target_names)
print(iris.feature_na... | gpl-2.0 |
joyeshmishra/spark-tk | regression-tests/sparktkregtests/testcases/frames/frame_timeseries_test.py | 13 | 7936 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
zihua/scikit-learn | benchmarks/bench_mnist.py | 38 | 6799 | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | bsd-3-clause |
lehai0609/ThinkStats2 | code/analytic.py | 69 | 6265 | """This file contains code used in "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 numpy as np
import pandas
import nsfg
import thinkplot
import th... | gpl-3.0 |
tomlof/scikit-learn | sklearn/ensemble/gradient_boosting.py | 7 | 74149 | """Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regressio... | bsd-3-clause |
btabibian/scikit-learn | sklearn/feature_selection/tests/test_feature_select.py | 43 | 26651 | """
Todo: cross-check the F-value with stats model
"""
from __future__ import division
import itertools
import warnings
import numpy as np
from scipy import stats, sparse
from numpy.testing import run_module_suite
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from... | bsd-3-clause |
wrshoemaker/ffpopsim | examples/mutation_selection_balance_lowd.py | 2 | 3053 | '''
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_lowd.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the ... | gpl-3.0 |
Juanlu001/PyFME | examples/example_006_elevator_doublet.py | 1 | 4584 | # -*- coding: utf-8 -*-
"""
Python Flight Mechanics Engine (PyFME).
Copyright (c) AeroPython Development Team.
Distributed under the terms of the MIT License.
Example
-------
Cessna 172, ISA1976 integrated with Flat Earth (Euler angles).
Evolution of the aircraft after a pitch perturbation (delta doublet
applied on... | mit |
sofiane87/lasagne-GAN | dcgan/dcgan_celeba.py | 1 | 8790 | from __future__ import print_function
from keras.datasets import mnist
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D, concatenate
from keras.layers.advanced_activations import LeakyReLU
from keras.layers.convolutional import UpSa... | mit |
jreback/pandas | pandas/tests/indexes/multi/test_setops.py | 1 | 15380 | import numpy as np
import pytest
import pandas as pd
from pandas import Index, MultiIndex, Series
import pandas._testing as tm
@pytest.mark.parametrize("case", [0.5, "xxx"])
@pytest.mark.parametrize(
"method", ["intersection", "union", "difference", "symmetric_difference"]
)
def test_set_ops_error_cases(idx, cas... | bsd-3-clause |
fmfn/UnbalancedDataset | imblearn/ensemble/_bagging.py | 2 | 11765 | """Bagging classifier trained on balanced bootstrap samples."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Christos Aridas
# License: MIT
import numbers
import numpy as np
from sklearn.base import clone
from sklearn.ensemble import BaggingClassifier
from sklearn.tree import DecisionTreeClassi... | mit |
cybernet14/scikit-learn | examples/linear_model/plot_ols_ridge_variance.py | 387 | 2060 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... | bsd-3-clause |
mikofski/pvlib-python | pvlib/iotools/tmy.py | 3 | 29163 | """
Import functions for TMY2 and TMY3 data files.
"""
import datetime
import re
import pandas as pd
def read_tmy3(filename, coerce_year=None, recolumn=True):
'''
Read a TMY3 file in to a pandas dataframe.
Note that values contained in the metadata dictionary are unchanged
from the TMY3 file (i.e. u... | bsd-3-clause |
nikste/tensorflow | tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py | 12 | 15286 | # 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 |
h-2/seqan | extras/apps/ngs_roi/tool_shed/roi_details.py | 18 | 3825 | #!/usr/bin/env python
"""Generation of detailed ROI reports with larger plots.
This report generation works for hundred of ROIs.
"""
try:
import argparse
except ImportError:
import argparse26 as argparse
import math
import os.path
import sys
import Cheetah.Template
import matplotlib.pyplot as plt
import ngs... | bsd-3-clause |
wasit7/recognition | src/nn.py | 1 | 5896 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 02 00:47:40 2014
@author: Wasit
"""
from PIL import Image
import numpy as np
from matplotlib import pyplot as plt
import os
from scipy.spatial import kdtree
import cPickle
from scipy.ndimage import filters
import sys
import scipy.ndimage
sys.setrecursionlimit(10000)
roo... | gpl-2.0 |
bmazin/ARCONS-pipeline | beammap/mpl_pyqt4_widget.py | 9 | 2159 | #!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
import numpy as N
class My... | gpl-2.0 |
mhdella/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 |
sgrid/pysgrid | demos/demo_basic_interp.py | 3 | 2453 | import pysgrid
import numpy as np
node_lon = np.array(([1, 3, 5], [1, 3, 5], [1, 3, 5]))
node_lat = np.array(([1, 1, 1], [3, 3, 3], [5, 5, 5]))
edge2_lon = np.array(([0, 2, 4, 6], [0, 2, 4, 6], [0, 2, 4, 6]))
edge2_lat = np.array(([1, 1, 1, 1], [3, 3, 3, 3], [5, 5, 5, 5]))
edge1_lon = np.array(([1, 3, 5], [1, 3, 5], [... | bsd-3-clause |
urinieto/msaf | msaf/algorithms/vmo/main.py | 1 | 3076 |
import sklearn
import numpy as np
import vmo
import vmo.analysis as van
import scipy.linalg
import scipy.ndimage
import librosa
def vmo_routine(feature):
ideal_t = vmo.find_threshold(feature, dim=feature.shape[1])
oracle = vmo.build_oracle(feature, flag='a', threshold=ideal_t[0][1], dim=feature.shape[1])
... | mit |
rmccoy7541/egillettii-rnaseq | scripts/model_B2.synonymous.py | 1 | 3802 | #! /bin/env python
import sys
from optparse import OptionParser
import copy
import matplotlib
matplotlib.use('Agg')
import pylab
import scipy.optimize
import numpy
from numpy import array
import dadi
import random
#import demographic models
import gillettii_models
#sample and set random seed
seed = random.randint(0, ... | mit |
jphacks/KB_02 | source/face_recognizer.py | 1 | 13684 | # -*- coding: UTF-8 -*-
import matplotlib
matplotlib.use('TkAgg')
import cv2
import math
import numpy as np
import os
from PIL import Image, ImageDraw, ImageFont
from speech_recognizer import SpeechRecognizer
from Face import GeoInfo,Face
from graph_drawer import GraphDrawer,Graph
from word_analyze import WordAnal... | mit |
qifeigit/scikit-learn | sklearn/metrics/cluster/supervised.py | 207 | 27395 | """Utilities to evaluate the clustering performance of models
Functions named as *_score return a scalar value to maximize: the higher the
better.
"""
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Wei LI <kuantkid@gmail.com>
# Diego Molla <dmolla-aliod@gmail.com>
# License: BSD 3 clause
fr... | bsd-3-clause |
ldirer/scikit-learn | doc/datasets/mldata_fixture.py | 367 | 1183 | """Fixture module to skip the datasets loading when offline
Mock urllib2 access to mldata.org and create a temporary data folder.
"""
from os import makedirs
from os.path import join
import numpy as np
import tempfile
import shutil
from sklearn import datasets
from sklearn.utils.testing import install_mldata_mock
fr... | bsd-3-clause |
zorojean/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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.