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 |
|---|---|---|---|---|---|
M4573R/BuildingMachineLearningSystemsWithPython | ch02/chapter.py | 17 | 4700 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
from matplotlib import pyplot as plt
import numpy as np
# We load the data with load_iris from sklear... | mit |
felixlaumon/kaggle-right-whale | scripts/create_test_cropped_image.py | 1 | 4813 | """
Create cropped test set image
$ ipython -i --pdb scripts/create_test_head_crop_image.py -- --size 256 --data 256_20151023 --model localize_pts_dec17 --overwrite
"""
import argparse
import os
import sys
from time import strftime
import pandas as pd
import numpy as np
from skimage.io import imread
from tqdm import t... | mit |
adamgreenhall/scikit-learn | examples/text/mlcomp_sparse_document_classification.py | 292 | 4498 | """
========================================================
Classification of text documents: using a MLComp dataset
========================================================
This is an example showing how the scikit-learn can be used to classify
documents by topics using a bag-of-words approach. This example uses
a s... | bsd-3-clause |
thatguyandy27/python-sandbox | Ex_Files_ML_EssT_Recommendations/Exercise Files/Chapter 6/make_recommendations.py | 1 | 1441 | import numpy as np
import pandas as pd
import matrix_factorization_utilities
# Load user ratings
raw_dataset_df = pd.read_csv('movie_ratings_data_set.csv')
# Load movie titles
movies_df = pd.read_csv('movies.csv', index_col='movie_id')
# Convert the running list of user ratings into a matrix
ratings_df = pd.pivot_ta... | mit |
dmsul/econtools | econtools/metrics/tests/test_savemem.py | 1 | 1514 | from os import path
import pandas as pd
from econtools.metrics.api import reg, ivreg
class TestOLS_savemem(object):
@classmethod
def setup_class(cls):
"""Stata reg output from `sysuse auto; reg price mpg`"""
test_path = path.split(path.relpath(__file__))[0]
auto_path = path.join(tes... | bsd-3-clause |
dongjoon-hyun/spark | python/pyspark/pandas/tests/test_ops_on_diff_frames_groupby_expanding.py | 15 | 5360 | #
# 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 |
snsansom/xcell | pipelines/PipelineScRnaseq.py | 2 | 1918 | import sys
import os
import re
import sqlite3
import pandas as pd
import numpy as np
from cgatcore import experiment as E
from cgatcore import pipeline as P
# load options from the config file
PARAMS = P.get_parameters(
["%s/pipeline.yml" % os.path.splitext(__file__)[0],
"../pipeline.yml",
"pipeline.ym... | mit |
pascalgutjahr/Praktikum-1 | GeometOptik/bekannt.py | 1 | 1880 | import matplotlib as mpl
from scipy.optimize import curve_fit
mpl.use('pgf')
import matplotlib.pyplot as plt
plt.rcParams['lines.linewidth'] = 1
import numpy as np
mpl.rcParams.update({
'font.family': 'serif',
'text.usetex': True,
'pgf.rcfonts': False,
'pgf.texsystem': 'lualatex',
'pgf.preamble': r'\usepackage{unicode... | mit |
sinkpoint/dipy | doc/examples/streamline_length.py | 9 | 5933 | """
=====================================
Streamline length and size reduction
=====================================
This example shows how to calculate the lengths of a set of streamlines and
also how to compress the streamlines without considerably reducing their
lengths or overall shape.
A streamline in Dipy is re... | bsd-3-clause |
nicholaschris/landsatpy | cloud_shadow_detection.py | 1 | 3078 | import cloud_detection_new as cloud_detection
import utils
import numpy as np
from numpy import ma
from skimage import morphology
from skimage.morphology import reconstruction
from views import create_composite, create_cm_greys, create_cm_orange, create_cm_blues
from skimage import exposure
import matplotlib as mpl
m... | mit |
deworrall92/groupConvolutions | deprecated/nathan/harmonic_convolution_test.py | 2 | 3810 | #
# test by Nate Thomas, 4/13/17
#
# to be run in https://github.com/deworrall92/harmonicConvolutions
#
# Notes: The harmonic network works well for small numbers of layers,
# but when the stride is greater than 1 or the number of layers
# is greater than 5 or so, global rotation invariance
# ... | mit |
larsmans/scikit-learn | examples/decomposition/plot_incremental_pca.py | 244 | 1878 | """
===============
Incremental PCA
===============
Incremental principal component analysis (IPCA) is typically used as a
replacement for principal component analysis (PCA) when the dataset to be
decomposed is too large to fit in memory. IPCA builds a low-rank approximation
for the input data using an amount of memo... | bsd-3-clause |
dreadjesus/MachineLearning | NaturalLanguageProcessing/ham_spam_pipline.py | 1 | 2484 | import nltk
# nltk.download_shell()
import pandas as pd
import string
from nltk.corpus import stopwords # words like: the, me, our
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
# https://www.analyticsvidhya.com/blog/2015/09/naive-bayes-explain... | mit |
gavinmh/keras | examples/kaggle_otto_nn.py | 70 | 3775 | from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import pandas as pd
np.random.seed(1337) # for reproducibility
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.normalization import BatchNormalization
from ke... | mit |
jarthurgross/bloch_distribution | doc/conf.py | 1 | 8503 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Bloch distribution documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 12 12:37:10 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in ... | mit |
martydill/url_shortener | code/venv/lib/python2.7/site-packages/IPython/lib/latextools.py | 4 | 6067 | # -*- coding: utf-8 -*-
"""Tools for handling LaTeX."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from io import BytesIO, open
from base64 import encodestring
import os
import tempfile
import shutil
import subprocess
from IPython.utils.process import find_cm... | mit |
ElDeveloper/scikit-learn | examples/ensemble/plot_gradient_boosting_quantile.py | 392 | 2114 | """
=====================================================
Prediction Intervals for Gradient Boosting Regression
=====================================================
This example shows how quantile regression can be used
to create prediction intervals.
"""
import numpy as np
import matplotlib.pyplot as plt
from skle... | bsd-3-clause |
jorik041/scikit-learn | sklearn/utils/tests/test_estimator_checks.py | 202 | 3757 | import scipy.sparse as sp
import numpy as np
import sys
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils.testing import assert_raises_regex, assert_true
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils.... | bsd-3-clause |
michaelaye/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 |
poryfly/scikit-learn | examples/neighbors/plot_classification.py | 287 | 1790 | """
================================
Nearest Neighbors Classification
================================
Sample usage of Nearest Neighbors classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColorm... | bsd-3-clause |
anurag313/scikit-learn | sklearn/datasets/mlcomp.py | 289 | 3855 | # Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
"""Glue code to load http://mlcomp.org data as a scikit.learn dataset"""
import os
import numbers
from sklearn.datasets.base import load_files
def _load_document_classification(dataset_path, metadata, set_=None, **kwargs):
if ... | bsd-3-clause |
jamesblunt/kaggle-galaxies | extract_pysex_params_extra.py | 8 | 3883 | import load_data
import pysex
import numpy as np
import multiprocessing as mp
import cPickle as pickle
"""
Extract a bunch of extra info to get a better idea of the size of objects
"""
SUBSETS = ['train', 'test']
TARGET_PATTERN = "data/pysex_params_gen2_%s.npy.gz"
SIGMA2 = 5000 # 5000 # std of the centrality weig... | bsd-3-clause |
spbguru/repo1 | examples/opf/tools/testDiagnostics.py | 11 | 1762 | import numpy as np
############################################################################
def printMatrix(inputs, spOutput):
''' (i,j)th cell of the diff matrix will have the number of inputs for which the input and output
pattern differ by i bits and the cells activated differ at j places.
Parameters:
-... | gpl-3.0 |
aminert/scikit-learn | sklearn/tests/test_metaestimators.py | 226 | 4954 | """Common tests for metaestimators"""
import functools
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.externals.six import iterkeys
from sklearn.datasets import make_classification
from sklearn.utils.testing import assert_true, assert_false, assert_raises
from sklearn.pipeline import Pipeline... | bsd-3-clause |
ECP-CANDLE/Benchmarks | common/darts/meters/accuracy.py | 1 | 1178 | import os
import pandas as pd
from darts.meters.average import AverageMeter
class MultitaskAccuracyMeter:
def __init__(self, tasks):
self.tasks = tasks
self.reset()
def reset(self):
self.meters = self.create_meters()
def create_meters(self):
""" Create an average meter ... | mit |
johankaito/fufuka | microblog/flask/venv/lib/python2.7/site-packages/numpy/doc/creation.py | 54 | 5503 | """
==============
Array Creation
==============
Introduction
============
There are 5 general mechanisms for creating arrays:
1) Conversion from other Python structures (e.g., lists, tuples)
2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros,
etc.)
3) Reading arrays from disk, either from... | apache-2.0 |
plablo09/geo_context | helpers/models.py | 1 | 1104 | # -*- coding: utf-8 -*-
from sklearn import svm
#from sklearn.metrics import roc_auc_score
#from sklearn.metrics import f1_score
#from sklearn.metrics import make_scorer
from sklearn.cross_validation import StratifiedKFold
from sklearn.grid_search import GridSearchCV
def fit_model(predictor,target,grid,metric='f1',fol... | apache-2.0 |
autoreject/autoreject | autoreject/tests/test_viz.py | 1 | 1473 | # Author: Mainak Jas <mainak.jas@telecom-paristech.fr>
# License: BSD (3-clause)
import numpy as np
import pytest
import mne
from mne.datasets import sample
from mne import io
import autoreject
from autoreject.utils import set_matplotlib_defaults
import matplotlib
matplotlib.use('Agg')
data_path = sample.data_path... | bsd-3-clause |
smartscheduling/scikit-learn-categorical-tree | sklearn/manifold/tests/test_isomap.py | 28 | 4007 | from itertools import product
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from sklearn import datasets
from sklearn import manifold
from sklearn import neighbors
from sklearn import pipeline
from sklearn import preprocessing
from sklearn.utils.testing import assert_less
... | bsd-3-clause |
saullocastro/pyNastran | setup_no_gui.py | 1 | 5269 | #!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages
PY2 = False
if sys.version_info < (3, 0):
PY2 = True
if sys.version_info < (2, 7, 7):
imajor, minor1, minor2 = sys.version_info[:3]
# makes sure we don't get the following bug:
# Issue #19099: The struct module now... | lgpl-3.0 |
bdolenc/Zemanta-challenge | StatisticalModelling.py | 1 | 5666 | #The code is published under MIT license.
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import cross_validation
from sklearn.cross_validation import StratifiedKFold
from sklearn.metrics import ro... | mit |
Asurada2015/TFAPI_translation | Images_ops/Crop/tf_image_central_crop.py | 1 | 3200 | """在大多数场景中,对图像的操作最好能在预处理阶段完成.预处理包括对图像裁剪,缩放以及灰度调整.
另一方面,在训练时对图像进行操作有一个重要的用例.当一副图像被加载后,可对其进行翻转或扭曲处理,
以使输入给网络的训练信息多样化.虽然这个步骤会进一步增加处理时间,但却有助于缓解过拟合现象"""
"""
def central_crop(image, central_fraction):
Crop the central region of the image.
裁剪图像的中心区域.
Remove the outer parts of an image but retain the central region of th... | apache-2.0 |
vvvityaaa/PyImgProcess | filter/max_filter.py | 1 | 1282 | from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import math
from open_image import open_image
def max_filter(path, region_size):
'''
Values for every pixel equals to the max of all values in the region
:param path: path to the image
:param region_size: size of the ... | mit |
lukebarnard1/bokeh | bokeh/server/blaze/views.py | 29 | 6140 | from __future__ import absolute_import
import datetime as dt
import pandas as pd
import numpy as np
from blaze import into
from flask import request
from six import iteritems
from ..app import bokeh_app
from ... import protocol
from ...transforms import line_downsample
from ...transforms import image_downsample
from... | bsd-3-clause |
rew4332/tensorflow | tensorflow/contrib/learn/python/learn/estimators/estimator.py | 1 | 33419 | # 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 |
seckcoder/lang-learn | python/sklearn/examples/plot_train_error_vs_test_error.py | 5 | 2553 | """
=========================
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... | unlicense |
lponnala/glee-py-gui | glee.py | 1 | 27990 | from __future__ import division
from Tkinter import Tk, StringVar, DoubleVar, IntVar, Label, Button, Entry, Frame, Radiobutton, Checkbutton
from tkFileDialog import askopenfilename
from os import getcwd, path
from webbrowser import open_new
from tkMessageBox import showerror
import re
import xlrd
import sys
im... | gpl-2.0 |
wanggang3333/scikit-learn | sklearn/tree/tests/test_export.py | 130 | 9950 | """
Testing for export functions of decision trees (sklearn.tree.export).
"""
from re import finditer
from numpy.testing import assert_equal
from nose.tools import assert_raises
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn.ensemble import GradientBoostingClassifier
from sklearn... | bsd-3-clause |
cloudera/ibis | ibis/backends/pandas/execution/strings.py | 1 | 12723 | import itertools
import operator
from functools import reduce
import numpy as np
import pandas as pd
import regex as re
import toolz
from pandas.core.groupby import SeriesGroupBy
import ibis.expr.operations as ops
import ibis.util
from ..core import integer_types, scalar_types
from ..dispatch import execute_node
@... | apache-2.0 |
averagehat/scikit-bio | skbio/stats/distance/_base.py | 3 | 30069 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | bsd-3-clause |
DKarev/isolation-forest | data_maker.py | 1 | 2166 | #!/usr/bin/env python
import pandas
from sklearn.externals import joblib
from treeinterpreter import treeinterpreter as ti
from optparse import OptionParser
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from featureizer import featureize
from flowenhancer import enhance_flow
from clearcut_... | apache-2.0 |
ramseylab/cerenkov | ground_truth/osu17/snap_client_py2.py | 2 | 4378 | from urllib import urlencode
from urllib2 import Request, urlopen
import pandas
from io import StringIO
class SnapQuery:
# 1000 Genomes Pilot 1 / HapMap release 22 / HapMap release 21
_dataset_options = {'onekgpilot', 'rel22', 'rel21'}
_population_options = {'onekgpilot': {'CEU', 'YRI', 'CHBJPT'},
... | apache-2.0 |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/networkx/readwrite/tests/test_gml.py | 35 | 3099 | #!/usr/bin/env python
import io
from nose.tools import *
from nose import SkipTest
import networkx
class TestGraph(object):
@classmethod
def setupClass(cls):
global pyparsing
try:
import pyparsing
except ImportError:
try:
import matplotlib.pyparsi... | agpl-3.0 |
cpcloud/dask | dask/dataframe/tests/test_hyperloglog.py | 3 | 2470 |
import dask
import dask.dataframe as dd
import pandas as pd
import numpy as np
import pytest
rs = np.random.RandomState(96)
@pytest.mark.parametrize("df", [
pd.DataFrame({
'x': [1, 2, 3] * 3,
'y': [1.2, 3.4, 5.6] * 3,
'z': -np.arange(9, dtype=np.int8)}),
pd.DataFrame({
'x':... | bsd-3-clause |
willcode/gnuradio | gr-filter/examples/resampler.py | 6 | 3732 | #!/usr/bin/env python
#
# Copyright 2009,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr
from gnuradio import filter
from gnuradio import blocks
import sys
import numpy
try:
from gnuradio import analog
except Imp... | gpl-3.0 |
jzt5132/scikit-learn | sklearn/grid_search.py | 61 | 37197 | """
The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters
of an estimator.
"""
from __future__ import print_function
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# ... | bsd-3-clause |
ZENGXH/scikit-learn | examples/cluster/plot_mini_batch_kmeans.py | 265 | 4081 | """
====================================================================
Comparison of the K-Means and MiniBatchKMeans clustering algorithms
====================================================================
We want to compare the performance of the MiniBatchKMeans and KMeans:
the MiniBatchKMeans is faster, but give... | bsd-3-clause |
djgagne/scikit-learn | benchmarks/bench_glmnet.py | 297 | 3848 | """
To run this, you'll need to have installed.
* glmnet-python
* scikit-learn (of course)
Does two benchmarks
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... | bsd-3-clause |
CforED/Machine-Learning | benchmarks/bench_20newsgroups.py | 377 | 3555 | from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... | bsd-3-clause |
rvraghav93/scikit-learn | sklearn/cluster/setup.py | 79 | 1855 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import os
from os.path import join
import numpy
from sklearn._build_utils import get_blas_info
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
cblas_libs, blas_info = ... | bsd-3-clause |
nicproulx/mne-python | mne/viz/_3d.py | 2 | 78615 | # -*- coding: utf-8 -*-
"""Functions to make 3D plots with M/EEG data."""
from __future__ import print_function
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <lar... | bsd-3-clause |
ktyssowski/mea_analysis | pymea/matlab_compatibility.py | 2 | 3599 | from datetime import datetime
from datetime import timedelta
import pandas as pd
def datetime_str_to_datetime(datetime_str):
"""
This converts the strings generated when matlab datetimes are written to a table to python datetime objects
"""
if len(datetime_str) == 24: # Check for milliseconds
r... | mit |
pythonvietnam/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py | 227 | 5170 | """
=================================================
Hyper-parameters of Approximate Nearest Neighbors
=================================================
This example demonstrates the behaviour of the
accuracy of the nearest neighbor queries of Locality Sensitive Hashing
Forest as the number of candidates and the numb... | bsd-3-clause |
kuiwei/edx-platform | docs/en_us/developers/source/conf.py | 6 | 6954 | # -*- coding: utf-8 -*-
# pylint: disable=C0103
# pylint: disable=W0622
# pylint: disable=W0212
# pylint: disable=W0613
import sys, os
from path import path
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
sys.path.append('../../../../')
from docs.shared.conf import *
# Add any paths that contain templates... | agpl-3.0 |
dongjoon-hyun/spark | python/pyspark/pandas/strings.py | 14 | 71898 | #
# 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 |
costypetrisor/scikit-learn | sklearn/utils/tests/test_multiclass.py | 72 | 15350 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from itertools import product
from functools import partial
from sklearn.externals.six.moves import xrange
from sklearn.externals.six import iteritems
from scipy.sparse import issparse
from scipy.sparse import csc_matrix
from scipy.sparse im... | bsd-3-clause |
CG-F16-27-Rutgers/steersuite-rutgers | steerstats/tools/plotting/plot_across_subplots.py | 8 | 1863 | #! /usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import proj3d
import matplotlib
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
z = np.random.rand(N)
# point's to join
p1 = 10
p2 = 20
fig = plt.figure()
# a background ax... | gpl-3.0 |
SurfaceTemp/ISTI_Clean_Worlds | LinearTrends.py | 1 | 5330 | #!/usr/local/sci/bin/python
# PYTHON2.7
#
# Author: Kate Willett
# Created: 11 October 2012
# Last update: 8 October 2015
# Location: /data/local/hadkw/ISTI/PROGS/
# GitHub: https://github.com/SurfaceTemp/ISTI_Clean_Worlds/
# Location: /data/local/hadkw/HADCRUH2/UPDATE2014/PROGS/PYTHON/
# GitHub: https://github.com/... | cc0-1.0 |
ephes/scikit-learn | sklearn/datasets/base.py | 196 | 18554 | """
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
import os
import csv
import shutil
from os import environ
from os.pa... | bsd-3-clause |
alanrkessler/savantscraper | savantscraper.py | 1 | 4959 | # -*- coding: utf-8 -*-
"""Load detail level Baseball Savant data into an SQLite database."""
import os
from time import sleep
from urllib.error import HTTPError
import sqlite3
import pandas as pd
from tqdm.auto import tqdm
def savant_search(season, team, home_road, csv=False, sep=';'):
"""Return detail-level Ba... | gpl-3.0 |
lucas8/MPSI | ipt/ediff/td.py | 1 | 3559 | #!/usr/bin/python3
import numpy as np
import math
import matplotlib.pyplot as plt
from scipy.integrate import odeint
# {{{ Exercice 1.1
# F(t, u) = cos(t) - 3u
# F(t, u) = cos(t) + sin(t)*u
# F(t, u) = sqrt(t)*cos(t)/2 + u/(2t)
# TODO
# }}}
# {{{ Exercice 2.1
def Euler(f, t_0, y_0, T, N):
ys = [y_0]
t = t_0
... | mit |
soulmachine/scikit-learn | examples/ensemble/plot_adaboost_multiclass.py | 354 | 4124 | """
=====================================
Multi-class AdaBoosted Decision Trees
=====================================
This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can
improve prediction accuracy on a multi-class problem. The classification
dataset is constructed by taking a ten-dimensional ... | bsd-3-clause |
cjayb/mne-python | mne/io/fieldtrip/utils.py | 11 | 13366 | # -*- coding: UTF-8 -*-
# Authors: Thomas Hartmann <thomas.hartmann@th-ht.de>
# Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
#
# License: BSD (3-clause)
import numpy as np
from ..meas_info import create_info
from ...transforms import rotation3d_align_z_axis
from ...channels import make_dig_montage
from ..constan... | bsd-3-clause |
ARM-software/bart | tests/test_common_utils.py | 2 | 4354 | # Copyright 2015-2016 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | apache-2.0 |
binghongcha08/pyQMD | GWP/2D/1.0.7/plt.py | 14 | 1041 | ##!/usr/bin/python
import numpy as np
import pylab as plt
import seaborn as sns
sns.set_context('poster')
#with open("traj.dat") as f:
# data = f.read()
#
# data = data.split('\n')
#
# x = [row.split(' ')[0] for row in data]
# y = [row.split(' ')[1] for row in data]
#
# fig = plt.figure()
#
# ax1 ... | gpl-3.0 |
manashmndl/scikit-learn | examples/applications/svm_gui.py | 287 | 11161 | """
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... | bsd-3-clause |
AndrewRook/NFLWin | nflwin/preprocessing.py | 1 | 19618 | """Tools to get raw data ready for modeling."""
from __future__ import print_function, division
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator
from sklearn.preprocessing import OneHotEncoder
from sklearn.utils.validation import NotFittedError
class ComputeElapsedTime(BaseEstimator):
... | mit |
rbalda/neural_ocr | env/lib/python2.7/site-packages/pybrain/auxiliary/gaussprocess.py | 1 | 9527 | __author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de; Christian Osendorfer, osendorf@in.tum.de'
from scipy import r_, exp, zeros, eye, array, asarray, random, ravel, diag, sqrt, sin, cos, sort, mgrid, dot, floor
from scipy import c_ #@UnusedImport
from scipy.linalg import solve, inv
from pybrain.datasets import Super... | mit |
HealthCatalystSLC/healthcareai-py | healthcareai/supervised_model_trainer.py | 2 | 11036 | """Trains Supervised Models."""
import healthcareai.pipelines.data_preparation as hcai_pipelines
import healthcareai.trained_models.trained_supervised_model as hcai_tsm
import healthcareai.common.cardinality_checks as hcai_ordinality
from healthcareai.advanced_supvervised_model_trainer import AdvancedSupervisedModelTr... | mit |
trustedanalytics/spark-tk | python/sparktk/frame/constructors/import_pandas.py | 12 | 8940 | # 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 |
wzbozon/scikit-learn | sklearn/utils/arpack.py | 265 | 64837 | """
This contains a copy of the future version of
scipy.sparse.linalg.eigen.arpack.eigsh
It's an upgraded wrapper of the ARPACK library which
allows the use of shift-invert mode for symmetric matrices.
Find a few eigenvectors and eigenvalues of a matrix.
Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/
"""
#... | bsd-3-clause |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/cluster/tests/test_hierarchical.py | 17 | 21562 | """
Several basic tests for hierarchical clustering procedures
"""
# Authors: Vincent Michel, 2010, Gael Varoquaux 2012,
# Matteo Visconti di Oleggio Castello 2014
# License: BSD 3 clause
from tempfile import mkdtemp
import shutil
from functools import partial
import numpy as np
from scipy import sparse
from... | mit |
MJuddBooth/pandas | pandas/core/resample.py | 1 | 57792 | import copy
from datetime import timedelta
from textwrap import dedent
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.tslibs import NaT, Timestamp
from pandas._libs.tslibs.frequencies import is_subperiod, is_superperiod
from pandas._libs.tslibs.period import IncompatibleFrequency
im... | bsd-3-clause |
mpanteli/music-outliers | scripts/load_features.py | 1 | 15774 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 16 01:50:57 2017
@author: mariapanteli
"""
import numpy as np
import pandas as pd
import os
from sklearn.decomposition import NMF
import OPMellin as opm
import MFCC as mfc
import PitchBihist as pbi
class FeatureLoader:
def __init__(self, win2sec=8):
self.wi... | mit |
kdebrab/pandas | pandas/tests/indexes/datetimelike.py | 4 | 2770 | """ generic datetimelike tests """
import pytest
import numpy as np
import pandas as pd
from .common import Base
import pandas.util.testing as tm
class DatetimeLike(Base):
def test_can_hold_identifiers(self):
idx = self.create_index()
key = idx[0]
assert idx._can_hold_identifiers_and_hold... | bsd-3-clause |
hsaputra/tensorflow | tensorflow/python/estimator/canned/linear_testing_utils.py | 20 | 67865 | # 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 |
xyguo/scikit-learn | sklearn/utils/validation.py | 15 | 25983 | """Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from ..externals... | bsd-3-clause |
akrherz/iem | scripts/GIS/24h_lsr.py | 1 | 2772 | """Dump 24 hour LSRs to a file"""
import zipfile
import os
from collections import OrderedDict
import shutil
import subprocess
import datetime
from geopandas import read_postgis
from pyiem.util import get_dbconn
SCHEMA = {
"geometry": "Point",
"properties": OrderedDict(
[
("VALID", "str:12... | mit |
devanshdalal/scikit-learn | doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py | 157 | 2409 | """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 |
Djabbz/scikit-learn | examples/manifold/plot_compare_methods.py | 259 | 4031 | """
=========================================
Comparison of Manifold Learning methods
=========================================
An illustration of dimensionality reduction on the S-curve dataset
with various manifold learning methods.
For a discussion and comparison of these algorithms, see the
:ref:`manifold module... | bsd-3-clause |
raymondxyang/tensorflow | tensorflow/examples/learn/iris_custom_decay_dnn.py | 37 | 3774 | # 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 |
bloyl/mne-python | mne/externals/tqdm/_tqdm/_tqdm_pandas.py | 28 | 1608 | import sys
__author__ = "github.com/casperdcl"
__all__ = ['tqdm_pandas']
def tqdm_pandas(tclass, *targs, **tkwargs):
"""
Registers the given `tqdm` instance with
`pandas.core.groupby.DataFrameGroupBy.progress_apply`.
It will even close() the `tqdm` instance upon completion.
Parameters
------... | bsd-3-clause |
pgora/TensorTraffic | ErrorDistribution/error_distribution.py | 1 | 2944 |
# coding: utf-8
# In[17]:
from train import *
import pandas as pd
import numpy as np
# In[63]:
params = PARAMS
params['filename'] = "model1.csv"
params['max_steps'] = 1000000
params['learning_rate'] = 0.01
params['layers'] = [100, 200, 100]
params['dropout'] = 0.05
params['training_set_size'] = 90000
# In[64]:
... | mit |
bks/veusz | veusz/widgets/contour.py | 1 | 22171 | # Copyright (C) 2005 Jeremy S. Sanders
# Email: Jeremy Sanders <jeremy@jeremysanders.net>
#
# 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
# ... | gpl-2.0 |
tosolveit/scikit-learn | sklearn/linear_model/tests/test_perceptron.py | 378 | 1815 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_raises
from sklearn.utils import check_random_state
from sklearn.datasets import load_iris
from sklearn.linear_model import Pe... | bsd-3-clause |
ChanChiChoi/scikit-learn | doc/sphinxext/numpy_ext/docscrape_sphinx.py | 408 | 8061 | import re
import inspect
import textwrap
import pydoc
from .docscrape import NumpyDocString
from .docscrape import FunctionDoc
from .docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
self.use_plots... | bsd-3-clause |
tomlof/scikit-learn | sklearn/datasets/twenty_newsgroups.py | 31 | 13747 | """Caching loader for the 20 newsgroups text classification dataset
The description of the dataset is available on the official website at:
http://people.csail.mit.edu/jrennie/20Newsgroups/
Quoting the introduction:
The 20 Newsgroups data set is a collection of approximately 20,000
newsgroup documents,... | bsd-3-clause |
azariven/BioSig_SEAS | bin_personal/ATMOS/atmos_NIST_compare.py | 1 | 2276 | """
compare atmos result with nist result in TS simulation
"""
import os
import sys
import numpy as np
from scipy.special import wofz
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib import ticker
ml = MultipleLocator(10)
DIR = os.path.abspath(os.p... | gpl-3.0 |
magnunor/hyperspy | hyperspy/drawing/_widgets/label.py | 4 | 3756 | # -*- coding: utf-8 -*-
# Copyright 2007-2016 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 |
anirudhjayaraman/scikit-learn | examples/model_selection/plot_precision_recall.py | 249 | 6150 | """
================
Precision-Recall
================
Example of Precision-Recall metric to evaluate classifier output quality.
In information retrieval, precision is a measure of result relevancy, while
recall is a measure of how many truly relevant results are returned. A high
area under the curve represents both ... | bsd-3-clause |
siconos/siconos-deb | examples/Control/Relay/Filippov.py | 1 | 2866 | #!/usr/bin/env python
# Siconos is a program dedicated to modeling, simulation and control
# of non smooth dynamical systems.
#
# Copyright 2016 INRIA.
#
# 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 L... | apache-2.0 |
arhik/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtkcairo.py | 69 | 2207 | """
GTK+ Matplotlib interface using cairo (not GDK) drawing operations.
Author: Steve Chaplin
"""
import gtk
if gtk.pygtk_version < (2,7,0):
import cairo.gtk
from matplotlib.backends import backend_cairo
from matplotlib.backends.backend_gtk import *
backend_version = 'PyGTK(%d.%d.%d) ' % gtk.pygtk_version + \
... | agpl-3.0 |
takuya1981/sms-tools | lectures/06-Harmonic-model/plots-code/carnatic-spectrum.py | 22 | 1042 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
import math
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import dftModel as DFT
import utilFunctions as UF
(fs, x) = UF... | agpl-3.0 |
beepee14/scikit-learn | sklearn/cluster/tests/test_k_means.py | 63 | 26190 | """Testing for K-means"""
import sys
import numpy as np
from scipy import sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing i... | bsd-3-clause |
oesteban/dipy | scratch/very_scratch/simulation_comparisons_modified.py | 20 | 13117 | import nibabel
import os
import numpy as np
import dipy as dp
import dipy.core.generalized_q_sampling as dgqs
import dipy.io.pickles as pkl
import scipy as sp
from matplotlib.mlab import find
import dipy.core.sphere_plots as splots
import dipy.core.sphere_stats as sphats
import dipy.core.geometry as geometry
import get... | bsd-3-clause |
rgommers/scipy | scipy/integrate/_bvp.py | 16 | 41051 | """Boundary value problem solver."""
from warnings import warn
import numpy as np
from numpy.linalg import pinv
from scipy.sparse import coo_matrix, csc_matrix
from scipy.sparse.linalg import splu
from scipy.optimize import OptimizeResult
EPS = np.finfo(float).eps
def estimate_fun_jac(fun, x, y, p, f0=None):
... | bsd-3-clause |
stefanbuenten/nanodegree | p5/final_project/poi_id.py | 1 | 8077 | #!/usr/bin/python
import sys
import pickle
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
from tester import dump_classifier_and_data
### Load the dictionary containing the dataset
with open("final_project_dataset.pkl", "r") as data_file:
data_dict = pickle.load(data_fi... | mit |
trevorwitter/NYC-Real-Estate- | main.py | 1 | 11893 | import numpy as np
import pandas as pd
from pandas import DataFrame
import urllib2
import matplotlib.pyplot as plt
from collections import Counter
from bokeh.charts import Bar, Line, show, output_file
from bokeh.models import Legend, ColumnDataSource
from bokeh.layouts import widgetbox
from bokeh.models.widgets import ... | mit |
balazssimon/ml-playground | udemy/lazyprogrammer/deep-reinforcement-learning-python/mountaincar/pg_tf.py | 1 | 6115 | import gym
import os
import sys
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from gym import wrappers
from datetime import datetime
from q_learning import plot_running_avg, FeatureTransformer, plot_cost_to_go
# so you can test different architectures
class HiddenLayer:
def __init__(sel... | apache-2.0 |
mayhem/led-chandelier | software/patterns/sweep_gradient.py | 1 | 1514 | #!/usr/bin/env python3
import os
import sys
import math
from colour import Color as Colour
from colorsys import hsv_to_rgb
from random import random
import matplotlib as mpl
import numpy as np
from hippietrap.hippietrap import HippieTrap, ALL, NUM_NODES, NUM_RINGS, BOTTLES_PER_RING
from hippietrap.color import Color, ... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.