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 |
|---|---|---|---|---|---|
lekshmideepu/nest-simulator | pynest/examples/spatial/test_3d.py | 14 | 2140 | # -*- coding: utf-8 -*-
#
# test_3d.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, or
# (... | gpl-2.0 |
RasaHQ/rasa_core | rasa/core/run.py | 1 | 7791 | import asyncio
from functools import partial
import argparse
import logging
from sanic import Sanic
from sanic_cors import CORS
from typing import List, Optional, Text
import rasa.core.cli.arguments
import rasa.utils
import rasa.core
from rasa.core import constants, utils, cli
from rasa.core.channels import (BUILTIN... | apache-2.0 |
carlsonp/kaggle-TrulyNative | process.py | 1 | 3832 | import re, os, sys
from bs4 import BeautifulSoup
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import numpy as np
#337304 total HTML files
process_folders = ["./data/0/", "./data/1/", "./data/2/", "./data/3/", "./data/4/"]
def strip... | gpl-3.0 |
prasadtalasila/IRCLogParser | lib/deprecated/GephiTimelapseCSV.py | 2 | 16385 | #This code is useful if one wants to plot the timelapse or the dynamic variations of a graph over a specific time interval using Gephi.
#Our final output would be a Node and an Edge CSV file. We would import these files to Gephi, generate a time frame, and then eventually the required
#timelapse. Whenever an edge would... | gpl-3.0 |
maxalbert/bokeh | bokeh/compat/mplexporter/exporter.py | 8 | 12406 | """
Matplotlib Exporter
===================
This submodule contains tools for crawling a matplotlib figure and exporting
relevant pieces to a renderer.
"""
import warnings
import io
from . import utils
import matplotlib
from matplotlib import transforms
from matplotlib.backends.backend_agg import FigureCanvasAgg
clas... | bsd-3-clause |
AlexRobson/scikit-learn | sklearn/externals/joblib/__init__.py | 86 | 4795 | """ Joblib is a set of tools to provide **lightweight pipelining in
Python**. In particular, joblib offers:
1. transparent disk-caching of the output values and lazy re-evaluation
(memoize pattern)
2. easy simple parallel computing
3. logging and tracing of the execution
Joblib is optimized to be **fast*... | bsd-3-clause |
yyjiang/scikit-learn | examples/ensemble/plot_forest_importances_faces.py | 403 | 1519 | """
=================================================
Pixel importances with a parallel forest of trees
=================================================
This example shows the use of forests of trees to evaluate the importance
of the pixels in an image classification task (faces). The hotter the pixel,
the more impor... | bsd-3-clause |
hmgaudecker/econ-project-templates | {{cookiecutter.project_slug}}/src_julia/final/plot_locations.py | 3 | 1719 | import json
import pickle
import sys
import matplotlib
import numpy as np
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
from bld.project_paths import project_paths_join as ppj
PLOT_ARGS = {"markersize": 4, "alpha": 0.6}
def plot_locations(locations_by_round, model_name):
"Plot the distribution of ag... | bsd-3-clause |
neale/CS-program | 434-MachineLearning/final_project/linearClassifier/sklearn/ensemble/tests/test_voting_classifier.py | 25 | 8160 | """Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raise_message
from sklearn.exceptions import NotFittedError
from sklearn.linear_model import Logi... | unlicense |
aabadie/scikit-learn | examples/linear_model/plot_ols_3d.py | 350 | 2040 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Sparsity Example: Fitting only features 1 and 2
=========================================================
Features 1 and 2 of the diabetes-dataset are fitted and
plotted below. It illustrates that although feature... | bsd-3-clause |
phvu/DDF | python/ddf/ml.py | 3 | 2102 | from __future__ import unicode_literals
from py4j import java_gateway
import pandas as pd
from ml_models import KMeansModel, LinearRegressionModel, LogisticRegressionModel
import util
def kmeans(data, centers=2, runs=5, max_iters=10):
"""
Train Kmeans on a given DDF
:param data: DDF
:param centers: ... | apache-2.0 |
jkarnows/scikit-learn | sklearn/covariance/graph_lasso_.py | 127 | 25626 | """GraphLasso: sparse inverse covariance estimation with an l1-penalized
estimator.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
# Copyright: INRIA
import warnings
import operator
import sys
import time
import numpy as np
from scipy import linalg
from .empirical_covariance_ im... | bsd-3-clause |
rhyolight/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/axes.py | 69 | 259904 | from __future__ import division, generators
import math, sys, warnings, datetime, new
import numpy as np
from numpy import ma
import matplotlib
rcParams = matplotlib.rcParams
import matplotlib.artist as martist
import matplotlib.axis as maxis
import matplotlib.cbook as cbook
import matplotlib.collections as mcoll
im... | agpl-3.0 |
pv/scikit-learn | sklearn/neighbors/tests/test_kd_tree.py | 129 | 7848 | import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors.kd_tree import (KDTree, NeighborsHeap,
simultaneous_sort, kernel_norm,
nodeheap_sort, DTYPE, ITYPE)
from sklearn.neighbors.dist_metrics import Dista... | bsd-3-clause |
trachelr/mne-python | examples/preprocessing/plot_define_target_events.py | 19 | 3350 | """
============================================================
Define target events based on time lag, plot evoked response
============================================================
This script shows how to define higher order events based on
time lag between reference and target events. For
illustration, we will... | bsd-3-clause |
nvoron23/scikit-learn | benchmarks/bench_plot_lasso_path.py | 301 | 4003 | """Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
from collections import defaultdict
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model import lars_pat... | bsd-3-clause |
jpo/healthcareai-py | healthcareai/common/top_factors.py | 2 | 2570 | import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression, LinearRegression
from healthcareai.common.healthcareai_error import HealthcareAIError
def descending_sort(row):
# TODO Low priority, consider testing
"""
Sorts (descending) the columns of a dataframe by value or ... | mit |
franchenstein/master_project | main.py | 1 | 18773 | #!/usr/bin
import probabilisticgraph as pg
import graphgenerator as gg
import dmarkov as dm
import sequenceanalyzer as sa
import yaml
import matplotlib.pyplot as plt
import synchwordfinder as swf
def main(config_file, fsw=False, terminate=False, dmark=False, generate=False, gen_seq=False, an_seq=False, plot=False,
... | mit |
rahul-c1/scikit-learn | examples/ensemble/plot_forest_iris.py | 335 | 6271 | """
====================================================================
Plot the decision surfaces of ensembles of trees on the iris dataset
====================================================================
Plot the decision surfaces of forests of randomized trees trained on pairs of
features of the iris dataset.
... | bsd-3-clause |
arokem/nipy | nipy/labs/viz_tools/test/test_activation_maps.py | 2 | 2563 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import tempfile
import numpy as np
from nose import SkipTest
try:
import matplotlib as mp
# Make really sure that we don't try to open an Xserver connection.
mp.use('svg', warn=False)
impo... | bsd-3-clause |
clembou/PCWG | pcwg/core/dataset.py | 1 | 41261 | import pandas as pd
import numpy as np
import datetime
import math
import os
import rews
import binning
import turbine
import warnings
from ..core.status import Status
warnings.simplefilter('ignore', np.RankWarning)
def getSeparatorValue(separator):
try:
return {"TAB":"\t",
"SPACE":" ",
... | mit |
rmcgibbo/msmbuilder | msmbuilder/tests/test_dataset.py | 1 | 7871 | from __future__ import print_function, absolute_import, division
import os
import shutil
import tempfile
from six.moves import cPickle
import numpy as np
from nose.tools import assert_raises
from msmbuilder.dataset import dataset, _keynat, NumpyDirDataset
from mdtraj.testing import get_fn
from sklearn.externals.joblib... | lgpl-2.1 |
ray-project/ray | python/ray/tune/utils/visual_utils.py | 4 | 2077 | import pandas as pd
from pandas.api.types import is_string_dtype, is_numeric_dtype
import logging
import os
import os.path as osp
import numpy as np
import json
from ray.tune.utils import flatten_dict
logger = logging.getLogger(__name__)
logger.warning("This module will be deprecated in a future version of Tune.")
... | apache-2.0 |
tmhm/scikit-learn | sklearn/covariance/tests/test_graph_lasso.py | 272 | 5245 | """ Test the graph_lasso module.
"""
import sys
import numpy as np
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_less
from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV,
empirical_... | bsd-3-clause |
ch3ll0v3k/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 |
sumspr/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 221 | 2702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
xuanyuanking/spark | python/pyspark/pandas/missing/window.py | 16 | 5201 | #
# 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 |
nrhine1/scikit-learn | sklearn/metrics/cluster/bicluster.py | 359 | 2797 | from __future__ import division
import numpy as np
from sklearn.utils.linear_assignment_ import linear_assignment
from sklearn.utils.validation import check_consistent_length, check_array
__all__ = ["consensus_score"]
def _check_rows_and_columns(a, b):
"""Unpacks the row and column arrays and checks their shap... | bsd-3-clause |
jpinedaf/pyspeckit | pyspeckit/wrappers/fitnh3.py | 4 | 16036 | """
NH3 fitter wrapper
==================
Wrapper to fit ammonia spectra. Generates a reasonable guess at the position
and velocity using a gaussian fit
Example use:
.. code:: python
import pyspeckit
sp11 = pyspeckit.Spectrum('spec.nh3_11.dat', errorcol=999)
sp22 = pyspeckit.Spectrum('spec.nh3_22.dat',... | mit |
ua-snap/downscale | snap_scripts/downscaling_10min/cru_cl20_preprocess_10min.py | 1 | 7915 | # # # PREPROCESS CRU CL20 1961-1990 CLIMATOLOGY DATA (http://www.cru.uea.ac.uk/cru/data/hrg/tmc)
# # author: Michael Lindgren (malindgren@alaska.edu) -- Sept. 2016
# # # #
import numpy as np
def xyz_to_grid( x, y, z, xi, yi, method='linear', output_dtype=np.float32 ):
'''
interpolate points to a grid. simple wrappe... | mit |
bhargav/scikit-learn | examples/calibration/plot_calibration_curve.py | 113 | 5904 | """
==============================
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 |
openturns/otlhs | python/doc/sphinxext/numpydoc/tests/test_docscrape.py | 39 | 18326 | # -*- encoding:utf-8 -*-
from __future__ import division, absolute_import, print_function
import sys, textwrap
from numpydoc.docscrape import NumpyDocString, FunctionDoc, ClassDoc
from numpydoc.docscrape_sphinx import SphinxDocString, SphinxClassDoc
from nose.tools import *
if sys.version_info[0] >= 3:
sixu = la... | gpl-3.0 |
xinfang/face-recognize | api-docs/conf.py | 9 | 1447 | #!/usr/bin/env python2
import sys
import mock
import os
sys.path.insert(0, os.path.abspath('..'))
MOCK_MODULES = ['argparse', 'cv2', 'dlib', 'numpy', 'numpy.linalg', 'pandas']
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.MagicMock()
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage... | apache-2.0 |
MartinSavc/scikit-learn | examples/linear_model/plot_robust_fit.py | 238 | 2414 | """
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 |
sjspence/spenceOTU | epicBarcoder/utilities.py | 2 | 7859 | import pandas as pd
import os
import subprocess
from collections import defaultdict
from itertools import combinations, chain
from scipy.stats import poisson
from . import io
def getExtension(fileName):
fileName = fileName.split('.')
fileExt = '.' + fileName[len(fileName)-1]
return fileExt
def clusterWit... | mit |
wilsonkichoi/zipline | tests/test_bar_data.py | 2 | 30240 | #
# Copyright 2016 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 |
LamaHamadeh/Microsoft-DAT210x | Module-4/assignment2.py | 1 | 3877 | '''
author Lama Hamadeh
'''
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import assignment2_helper as helper
# Look pretty...
matplotlib.style.use('ggplot')
# Do * NOT * alter this line, until instructed!
scaleFeatures = True #Features scaling (if it's false no scaling appears and that aff... | mit |
roxyboy/scikit-learn | sklearn/tests/test_qda.py | 155 | 3481 | import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import ignore_war... | bsd-3-clause |
xuewei4d/scikit-learn | sklearn/inspection/tests/test_partial_dependence.py | 4 | 28053 | """
Testing for the partial dependence module.
"""
import numpy as np
import pytest
import sklearn
from sklearn.inspection import partial_dependence
from sklearn.inspection._partial_dependence import (
_grid_from_X,
_partial_dependence_brute,
_partial_dependence_recursion
)
from sklearn.ensemble import Gr... | bsd-3-clause |
mjourdan/paperwork | src/paperwork/backend/docsearch.py | 1 | 31991 | # Paperwork - Using OCR to grep dead trees the easy way
# Copyright (C) 2012-2014 Jerome Flesch
#
# Paperwork 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... | gpl-3.0 |
sanjayankur31/nest-simulator | examples/nest/Potjans_2014/spike_analysis.py | 20 | 6437 | # -*- coding: utf-8 -*-
#
# spike_analysis.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,... | gpl-2.0 |
alephu5/Soundbyte | environment/lib/python3.3/site-packages/scipy/interpolate/fitpack2.py | 2 | 52059 | """
fitpack --- curve and surface fitting with splines
fitpack is based on a collection of Fortran routines DIERCKX
by P. Dierckx (see http://www.netlib.org/dierckx/) transformed
to double routines by Pearu Peterson.
"""
# Created by Pearu Peterson, June,August 2003
from __future__ import division, print_function, abs... | gpl-3.0 |
raincoatrun/basemap | examples/utmtest.py | 3 | 1355 | from __future__ import print_function
from mpl_toolkits.basemap import pyproj
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
# proj4 definition of UTM zone 17.
# coordinates agree to the 3rd decimal place (less than 1mm)
# when compared to result from
# http://home.hiwaay.net/~taylorc/toolbox/... | gpl-2.0 |
oew1v07/scikit-image | doc/examples/plot_swirl.py | 18 | 2581 | """
=====
Swirl
=====
Image swirling is a non-linear image deformation that creates a whirlpool
effect. This example describes the implementation of this transform in
``skimage``, as well as the underlying warp mechanism.
Image warping
-------------
When applying a geometric transformation on an image, we typically ... | bsd-3-clause |
hugobowne/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 |
bikong2/scikit-learn | sklearn/tests/test_kernel_ridge.py | 342 | 3027 | import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_regression
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils.testing import ignore_warnings
from sklearn.utils.testing import assert... | bsd-3-clause |
AstroVPK/libcarma | tests/test_mbhbcarma.py | 2 | 21792 | import math
import numpy as np
import copy
import unittest
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... | gpl-2.0 |
cmoutard/mne-python | mne/viz/decoding.py | 3 | 8791 | """Functions to plot decoding results
"""
from __future__ import print_function
# Authors: Denis Engemann <denis.engemann@gmail.com>
# Clement Moutard <clement.moutard@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: Simplified BSD
import numpy as np
import warnings
from .utils im... | bsd-3-clause |
deepesch/scikit-learn | examples/gaussian_process/plot_gp_probabilistic_classification_after_regression.py | 252 | 3490 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
==============================================================================
Gaussian Processes classification example: exploiting the probabilistic output
==============================================================================
A two-dimensional regression exerci... | bsd-3-clause |
gclenaghan/scikit-learn | examples/decomposition/plot_pca_3d.py | 354 | 2432 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Principal components analysis (PCA)
=========================================================
These figures aid in illustrating how a point cloud
can be very flat in one direction--which is where PCA
comes in to ch... | bsd-3-clause |
Oxylo/factors | factors/utils_extra.py | 1 | 3026 | import os
import pandas as pd
import numpy as np
from factors import settings
# AG2014 characteristics
from factors.settings import DATADIR
STARTYEAR = 2014
MAXAGE = 120
def read_generation_table(xlswb, sheet_name, calc_year):
""" Return generations tables (M, F), starting from calculation year
"""
tab... | mit |
timothydmorton/bokeh | examples/compat/mpl/lc_offsets.py | 34 | 1096 | from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
import numpy as np
from bokeh import mpl
from bokeh.plotting import output_file, show
# Simulate a series of ocean current profiles, successively
# offset by 0.1 m/s so that they form what is sometimes called
# a "waterfall" plot or a "... | bsd-3-clause |
zfrenchee/pandas | pandas/tests/io/msgpack/test_read_size.py | 22 | 1870 | """Test Unpacker's read_array_header and read_map_header methods"""
from pandas.io.msgpack import packb, Unpacker, OutOfData
UnexpectedTypeException = ValueError
def test_read_array_header():
unpacker = Unpacker()
unpacker.feed(packb(['a', 'b', 'c']))
assert unpacker.read_array_header() == 3
assert un... | bsd-3-clause |
henridwyer/scikit-learn | sklearn/cluster/tests/test_mean_shift.py | 121 | 3429 | """
Testing for mean shift clustering methods
"""
import numpy as np
import warnings
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import asser... | bsd-3-clause |
netixx/autotopo | sims/grapher.py | 1 | 40818 | __author__ = 'francois'
from string import Template
import numpy as np
import collections
import textwrap
import traceback
from processing import PostFunction
import pandas as pd
import subprocess
def addExtension(path, ext):
return "%s.%s"%(path, ext)
class _GnuplotGraph(type):
counter = {}
def __new_... | apache-2.0 |
anilcs13m/Projects | MovieReviewSentimentAnalysis/MovieReveiw/nb_model.py | 1 | 8052 | import os
import re
import nltk
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.grid_sea... | gpl-2.0 |
steinnymir/RegAscope2017 | rrTransientAnalysis.py | 1 | 15602 | # -*- coding: utf-8 -*-
"""
Created on Wed May 3 10:37:19 2017
@author: Steinn Ymir Agustsson
"""
import os
import matplotlib.pyplot as plt
import numpy as np
import scipy
from scipy.optimize import curve_fit, fmin
from matplotlib import cm, colorbar
from lib import utils as gfs
from lib import redred as rr
from l... | mit |
victor-prado/broker-manager | environment/lib/python3.5/site-packages/pandas/tests/series/test_indexing.py | 7 | 65910 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
from datetime import datetime, timedelta
from numpy import nan
import numpy as np
import pandas as pd
from pandas.types.common import is_integer, is_scalar
from pandas import Index, Series, DataFrame, isnull, date_range
from pandas.core.index import MultiIndex
from pa... | mit |
davidgbe/scikit-learn | sklearn/datasets/tests/test_svmlight_format.py | 228 | 11221 | from bz2 import BZ2File
import gzip
from io import BytesIO
import numpy as np
import os
import shutil
from tempfile import NamedTemporaryFile
from sklearn.externals.six import b
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert... | bsd-3-clause |
lindeloev/psychopy-course | ppc3_trial_handling.py | 1 | 4613 | # -*- coding: utf-8 -*-
"""
SOME WAYS TO HANDLE TRIALS. PICK YOUR FAVOURITE!
1. using psychopy TrialHandler. If you want it short and easy
2. using generic python only. When you want maximal control and clean code (my favourite)
3. using pandas. When you want to calculate/extract cross-trial or cross-c... | gpl-2.0 |
tdhopper/scikit-learn | benchmarks/bench_sgd_regression.py | 283 | 5569 | """
Benchmark for SGD regression
Compares SGD regression against coordinate descent and Ridge
on synthetic data.
"""
print(__doc__)
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com>
# License: BSD 3 clause
import numpy as np
import pylab as pl
import gc
from time import time
from sklearn.linear_model i... | bsd-3-clause |
jlegendary/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 284 | 3265 | """
===========================================
FeatureHasher and DictVectorizer Comparison
===========================================
Compares FeatureHasher and DictVectorizer by using both to vectorize
text documents.
The example demonstrates syntax and speed only; it doesn't actually do
anything useful with the e... | bsd-3-clause |
rahuldhote/scikit-learn | benchmarks/bench_plot_neighbors.py | 287 | 6433 | """
Plot the scaling of the nearest neighbors algorithms with k, D, and N
"""
from time import time
import numpy as np
import pylab as pl
from matplotlib import ticker
from sklearn import neighbors, datasets
def get_data(N, D, dataset='dense'):
if dataset == 'dense':
np.random.seed(0)
return np.... | bsd-3-clause |
duthchao/kaggle-galaxies | predict_augmented_npy_shareddense.py | 7 | 9449 | """
Load an analysis file and redo the predictions on the validation set / test set,
this time with augmented data and averaging. Store them as numpy files.
"""
import numpy as np
# import pandas as pd
import theano
import theano.tensor as T
import layers
import cc_layers
import custom
import load_data
import realtime... | bsd-3-clause |
gallantlab/pycortex | cortex/mayavi_aligner.py | 1 | 39313 | import types
import nibabel
import numpy as np
from traits.api import HasTraits, List, Instance, Array, Bool, Dict, Range, Float, Enum, Color, Int, Str, on_trait_change, Button, DelegatesTo, Any
from traitsui.api import View, Item, HGroup, Group, ImageEnumEditor, ColorEditor, TextEditor
from tvtk.api import tvtk
from... | bsd-2-clause |
commaai/panda | tests/automated/3_usb_to_can.py | 1 | 5242 | import sys
import time
from panda import Panda
from nose.tools import assert_equal, assert_less, assert_greater
from .helpers import start_heartbeat_thread, reset_pandas, SPEED_NORMAL, SPEED_GMLAN, time_many_sends, test_white_and_grey, panda_type_to_serial, test_all_pandas, panda_connect_and_init
# Reset the pandas be... | mit |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/pandas/tests/test_util.py | 7 | 13482 | # -*- coding: utf-8 -*-
import nose
from collections import OrderedDict
import sys
import unittest
from uuid import uuid4
from pandas.util._move import move_into_mutable_buffer, BadMove, stolenbuf
from pandas.util.decorators import deprecate_kwarg
from pandas.util.validators import (validate_args, validate_kwargs,
... | mit |
davidastephens/zipline | zipline/finance/performance/tracker.py | 3 | 16409 | #
# Copyright 2013 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 |
j9ac9k/NavitronEve | crons/navitron_crons/navitron_dump_database.py | 1 | 4683 | """launcher/wrapper for executing CLI"""
from datetime import datetime
import os
import logging
import time
import json
import uuid
import pymongo
import pandas as pd
from plumbum import cli
import prosper.common.prosper_cli as p_cli
from . import _version, connections, exceptions
HERE = os.path.abspath(os.path.dirn... | mit |
ClimbsRocks/scikit-learn | examples/linear_model/plot_ransac.py | 73 | 1859 | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | bsd-3-clause |
moonbury/pythonanywhere | MasteringMLWithScikit-learn/8365OS_02_Codes/scratch.py | 3 | 3078 | """
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from sklearn.linear_model import LinearRegression
>>> from sklearn.preprocessing import PolynomialFeatures
>>> X_train = [[6], [8], [10], [14], [18]]
>>> y_train = [[7], [9], [13], [17.5], [18]]
>>> X_test = [[6], [8], [11], [16]]
>>> y_test = [[8... | gpl-3.0 |
Myasuka/scikit-learn | benchmarks/bench_lasso.py | 297 | 3305 | """
Benchmarks of Lasso vs LassoLars
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of the
training set. Then we plot the computation time as function of
the number o... | bsd-3-clause |
henrykironde/scikit-learn | examples/applications/face_recognition.py | 191 | 5513 | """
===================================================
Faces recognition example using eigenfaces and SVMs
===================================================
The dataset used in this example is a preprocessed excerpt of the
"Labeled Faces in the Wild", aka LFW_:
http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2... | bsd-3-clause |
evgchz/scikit-learn | examples/cluster/plot_cluster_comparison.py | 9 | 4727 | """
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example aims at showing characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. The last ... | bsd-3-clause |
kwinkunks/geopandas | tests/test_sjoin.py | 6 | 3347 |
from __future__ import absolute_import
import tempfile
import shutil
import numpy as np
from shapely.geometry import Point
from geopandas import GeoDataFrame, read_file
from geopandas.tools import sjoin
from .util import unittest, download_nybb
class TestSpatialJoin(unittest.TestCase):
def setUp(self):
... | bsd-3-clause |
willgrass/pandas | pandas/core/index.py | 1 | 6255 | # pylint: disable-msg=E1101
# pylint: disable-msg=E1103
# pylint: disable-msg=W0232
import numpy as np
from pandas.lib.tseries import map_indices, isAllDates
def _indexOp(opname):
"""
Wrapper function for Series arithmetic operations, to avoid
code duplication.
"""
def wrapper(self, other):
... | bsd-3-clause |
saketkc/statsmodels | docs/source/plots/graphics_gofplots_qqplot.py | 38 | 1911 | # -*- coding: utf-8 -*-
"""
Created on Sun May 06 05:32:15 2012
Author: Josef Perktold
editted by: Paul Hobson (2012-08-19)
"""
from scipy import stats
from matplotlib import pyplot as plt
import statsmodels.api as sm
#example from docstring
data = sm.datasets.longley.load()
data.exog = sm.add_constant(data.exog, pre... | bsd-3-clause |
evgchz/scikit-learn | sklearn/linear_model/omp.py | 11 | 29513 | """Orthogonal matching pursuit algorithms
"""
# Author: Vlad Niculae
#
# License: BSD 3 clause
import warnings
from distutils.version import LooseVersion
import numpy as np
from scipy import linalg
from scipy.linalg.lapack import get_lapack_funcs
from .base import LinearModel, _pre_fit
from ..base import RegressorM... | bsd-3-clause |
paladin74/neural-network-animation | matplotlib/compat/subprocess.py | 19 | 2827 | """
A replacement wrapper around the subprocess module, with a number of
work-arounds:
- Provides the check_output function (which subprocess only provides from Python
2.7 onwards).
- Provides a stub implementation of subprocess members on Google App Engine
(which are missing in subprocess).
Instead of importing s... | mit |
max-ionov/russian-anaphora | anaphoramllib.py | 1 | 7001 | #!/usr/bin/python2.7
# -!- coding: utf-8 -!-
# usage: anaphoramllib.py
import os, sys, codecs, re
import cPickle
import lemmatizer
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier
from sklearn import tree, svm
from sklearn.svm import LinearSVC
from sklearn.pipeline import Pipeline
classifier... | gpl-3.0 |
lancezlin/ml_template_py | lib/python2.7/site-packages/sklearn/gaussian_process/tests/test_gaussian_process.py | 46 | 7057 | """
Testing for Gaussian Process module (sklearn.gaussian_process)
"""
# Author: Vincent Dubourg <vincent.dubourg@gmail.com>
# License: BSD 3 clause
import numpy as np
from sklearn.gaussian_process import GaussianProcess
from sklearn.gaussian_process import regression_models as regression
from sklearn.gaussian_proce... | mit |
tawsifkhan/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
jorge2703/scikit-learn | examples/calibration/plot_compare_calibration.py | 241 | 5008 | """
========================================
Comparison of Calibration of Classifiers
========================================
Well calibrated classifiers are probabilistic classifiers for which the output
of the predict_proba method can be directly interpreted as a confidence level.
For instance a well calibrated (bi... | bsd-3-clause |
BalazsHoranyi/movie_stream | movie_stream/ML/stream_lightfm.py | 1 | 1730 | import pandas as pd
from scipy.sparse import coo_matrix
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from movie_stream.models import Rating, Movie, LightFMModel
import pickle
from movie_stream.users.models import User
def get_recommendations(userid):
"""Get movie and follow recommenda... | mit |
irhete/predictive-monitoring-benchmark | preprocessing/preprocess_logs_hospital_billing.py | 1 | 5225 | import pandas as pd
import numpy as np
import os
import sys
input_data_folder = "../orig_logs"
output_data_folder = "../labeled_logs_csv_processed"
in_filename = "Hospital Billing - Event Log.csv"
case_id_col = "Case ID"
activity_col = "Activity"
timestamp_col = "Complete Timestamp"
label_col = "label"
pos_label = "d... | apache-2.0 |
vberaudi/scipy | scipy/special/c_misc/struve_convergence.py | 76 | 3725 | """
Convergence regions of the expansions used in ``struve.c``
Note that for v >> z both functions tend rapidly to 0,
and for v << -z, they tend to infinity.
The floating-point functions over/underflow in the lower left and right
corners of the figure.
Figure legend
=============
Red region
Power series is clo... | bsd-3-clause |
tmilicic/networkx | examples/drawing/giant_component.py | 33 | 2084 | #!/usr/bin/env python
"""
This example illustrates the sudden appearance of a
giant connected component in a binomial random graph.
Requires pygraphviz and matplotlib to draw.
"""
# Copyright (C) 2006-2008
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov... | bsd-3-clause |
daniel-severo/dask-ml | benchmarks/kmeans_airline.py | 1 | 3447 | """
K-Means clustering for the NYC-taxis data.set
"""
import argparse
import logging
import sys
from timeit import default_timer as tic
import coloredlogs
import dask.array as da
import pandas as pd
import dask.dataframe as dd
from distributed import Client
from dask import persist
from dask_ml.cluster import KMeans
... | bsd-3-clause |
Kane-Larrete/ProsperAPI | tests/test_crest_utils.py | 1 | 9437 | from os import path, makedirs, rmdir
from shutil import rmtree
from datetime import datetime, timedelta
import time
import pandas as pd
import numpy as np
import requests
from tinydb import Query
import pytest
import publicAPI.crest_utils as crest_utils
import publicAPI.exceptions as exceptions
import helpers
HERE =... | mit |
mganeva/mantid | scripts/test/MultiPlotting/Gridspec_test.py | 1 | 1281 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from matplotlib.gridspec import GridSpec
impo... | gpl-3.0 |
idlead/scikit-learn | sklearn/metrics/tests/test_ranking.py | 16 | 41687 | from __future__ import division, print_function
import numpy as np
from itertools import product
import warnings
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn import svm
from sklearn import ensemble
from sklearn.datasets import make_multilabel_classification
from sklearn.random_projec... | bsd-3-clause |
TNT-Samuel/Coding-Projects | DNS Server/Source - Copy/Lib/site-packages/dask/dataframe/io/tests/test_hdf.py | 2 | 19703 | import numpy as np
import pandas as pd
import pandas.util.testing as tm
import sys
import os
import dask
import pytest
from time import sleep
import dask.dataframe as dd
from dask.utils import tmpfile, tmpdir, dependency_depth
from dask.dataframe.utils import assert_eq
def test_to_hdf():
pytest.importorskip(... | gpl-3.0 |
altairpearl/scikit-learn | sklearn/mixture/tests/test_bayesian_mixture.py | 2 | 15056 | # Author: Wei Xue <xuewei4d@gmail.com>
# Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import numpy as np
from scipy.special import gammaln
from sklearn.utils.testing import assert_raise_message
from sklearn.utils.testing import assert_almost_equal
from sklearn.mixture.bayesian... | bsd-3-clause |
jeffshek/betterself | apis/betterself/v1/correlations/views.py | 1 | 4800 | import pandas as pd
from rest_framework.response import Response
from rest_framework.views import APIView
from analytics.events.utils.aggregate_dataframe_builders import AggregateSupplementProductivityDataframeBuilder, \
AggregateUserActivitiesEventsProductivityActivitiesBuilder, AggregateSleepActivitiesUserActivi... | mit |
mugizico/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 |
skavulya/spark-tk | regression-tests/sparktkregtests/testcases/models/arimax_test.py | 12 | 4674 | # 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 |
Erotemic/hotspotter | setup.py | 1 | 14995 | #!/usr/bin/env python
from __future__ import division, print_function
from os.path import dirname, realpath, join, exists, normpath, expanduser, splitext
import os
import sys
import fnmatch
# Hotspotter
from hscom import helpers as util
HOME = os.path.expanduser('~')
# Allows other python modules (like hesaff) to find... | apache-2.0 |
cbertinato/pandas | pandas/tests/sparse/frame/test_indexing.py | 3 | 3135 | import numpy as np
import pytest
from pandas import DataFrame, SparseDataFrame
from pandas.util import testing as tm
pytestmark = pytest.mark.skip("Wrong SparseBlock initialization (GH 17386)")
@pytest.mark.parametrize('data', [
[[1, 1], [2, 2], [3, 3], [4, 4], [0, 0]],
[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0], ... | bsd-3-clause |
YihaoLu/statsmodels | statsmodels/examples/ex_kernel_regression2.py | 34 | 1511 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 02 13:43:44 2013
Author: Josef Perktold
"""
from __future__ import print_function
import numpy as np
import numpy.testing as npt
import statsmodels.nonparametric.api as nparam
if __name__ == '__main__':
np.random.seed(500)
nobs = [250, 1000][0]
sig_fac = 1... | bsd-3-clause |
sugartom/tensorflow-alien | tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_queue_runner_test.py | 62 | 5053 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.