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
yebrahim/pydatalab
datalab/utils/commands/_csv.py
6
2397
# Copyright 2016 Google Inc. 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 applicable law or agreed ...
apache-2.0
MohammedWasim/scikit-learn
benchmarks/bench_covertype.py
120
7381
""" =========================== Covertype dataset benchmark =========================== Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART (decision tree), RandomForest and Extra-Trees on the forest covertype dataset of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ...
bsd-3-clause
wathen/PhD
MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/Newton/CavityDriven3D.py
1
13114
#!/usr/bin/python import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc from dolfin import * # from MatrixOperations import * import numpy as np import PETScIO as IO import common import scipy import scipy.io import time import scipy.sparse as sp import BiLinear as forms import IterOperations...
mit
lukeiwanski/tensorflow
tensorflow/contrib/training/python/training/feeding_queue_runner_test.py
76
5052
# 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
olologin/scikit-learn
examples/model_selection/grid_search_digits.py
44
2672
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.model_selection.GridS...
bsd-3-clause
AliShug/RoboVis
robovis/ik.py
1
13796
import numpy as np import cv2 # from matplotlib import pyplot as plt from robovis import RVConfig def runIK(config, stamp): return (RVIK(config), stamp) class RVSolver(object): def __init__(self, pool, config=None): self.subscribers = { 'ready': [] } self.outline = None ...
mit
yousrabk/mne-python
tutorials/plot_cluster_stats_time_frequency_repeated_measures_anova.py
15
9323
""" .. _tut_stats_cluster_sensor_rANOVA_tfr ==================================================================== Mass-univariate twoway repeated measures ANOVA on single trial power ==================================================================== This script shows how to conduct a mass-univariate repeated measure...
bsd-3-clause
bjlittle/iris
lib/iris/tests/unit/plot/test_points.py
1
2384
# Copyright Iris contributors # # This file is part of Iris and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. """Unit tests for the `iris.plot.points` function.""" # Import iris.tests first so that some things can be initialised before ...
lgpl-3.0
dcherian/pyroms
examples/Yellow_Sea/Inputs/Boundary/remap_bdry.py
1
9404
import numpy as np import os try: import netCDF4 as netCDF except: import netCDF3 as netCDF import matplotlib.pyplot as plt import time from datetime import datetime from matplotlib.dates import date2num, num2date import pyroms import pyroms_toolbox import _remapping class nctime(object): pass def remap_bdry...
bsd-3-clause
crazyhottommy/some-unorganized-old-scripts
python_scripts/metaPlot_by_metaseq.py
1
1858
# From http://www.biostars.org/p/83800/: # "What I want to do is to plot reads of my histone marks (in bam file) # around TSS with CpG and TSS without CpG (Essentially a coverage profile)." # to install metaseq and dependencies: # 1. get the metaseq source: # # git clone https://github.com/daler/metaseq.git #...
mit
fredhusser/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
244
9986
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
AndySchuetz/homemade_pi
serverImageProcRuntime.py
1
3441
# # # This module provides server runtime image classiciation functions # # import time import math import numpy as np # import Image from PIL import Image import sklearn from sklearn.externals import joblib def runtimeImageProcessByWindow(modelPath,imagePath, windowSize=(40,80), ...
mit
caiorss/m2py
scratchpad/rplot2.py
1
2766
#!/usr/bin/env python # -*- coding: utf-8 -*- #!/usr/bin/env python # Plot a graph of Data which is comming in on the fly # uses pylab # Author: Norbert Feurle # Date: 12.1.2012 # License: if you get any profit from this then please share it with me and only use it for good import pylab from pylab import * import tki...
bsd-3-clause
wlamond/scikit-learn
sklearn/cross_decomposition/cca_.py
151
3192
from .pls_ import _PLS __all__ = ['CCA'] class CCA(_PLS): """CCA Canonical Correlation Analysis. CCA inherits from PLS with mode="B" and deflation_mode="canonical". Read more in the :ref:`User Guide <cross_decomposition>`. Parameters ---------- n_components : int, (default 2). numb...
bsd-3-clause
mwidner/WebArchiveTextTools
src/subcorpus.py
1
4350
''' The Corpus Slicer Read in an CSV file of metadata describing corpus and file locations Organize and combine the text files for analysis and further processing Mike Widner <mikewidner@stanford.edu> ''' import os import re import sys import argparse import pandas as pd from string import punctuation def get_optio...
gpl-2.0
joshloyal/scikit-learn
sklearn/utils/tests/test_estimator_checks.py
26
7393
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
rsivapr/scikit-learn
examples/applications/wikipedia_principal_eigenvector.py
41
7742
""" =============================== Wikipedia principal eigenvector =============================== A classical way to assert the relative importance of vertices in a graph is to compute the principal eigenvector of the adjacency matrix so as to assign to each vertex the values of the components of the first eigenvect...
bsd-3-clause
shangwuhencc/scikit-learn
sklearn/tests/test_discriminant_analysis.py
35
11709
try: # Python 2 compat reload except NameError: # Regular Python 3+ import from importlib import reload 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_equal from sklearn.utils.t...
bsd-3-clause
GoogleCloudPlatform/ai-platform-samples
training/pytorch/structured/python_package/trainer/inputs.py
1
5303
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the \"License\"); # you may not use this file except in compliance with the License.\n", # 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 writ...
apache-2.0
calico/basenji
bin/basenji_bench_phylop_folds.py
1
14867
#!/usr/bin/env python # Copyright 2019 Calico LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agr...
apache-2.0
agentfog/qiime
scripts/compare_trajectories.py
15
9046
#!/usr/bin/env python from __future__ import division __author__ = "Jose Antonio Navas Molina" __copyright__ = "Copyright 2011, The QIIME Project" __credits__ = ["Jose Antonio Navas Molina", "Antonio Gonzalez Pena", "Yoshiki Vazquez Baeza"] __license__ = "GPL" __version__ = "1.9.1-dev" __maintainer__ = ...
gpl-2.0
cjbrasher/LipidFinder
LipidFinder/PeakFilter/FalseDiscoveryRate.py
1
4580
# Copyright (c) 2019 J. Alvarez-Jarreta and C.J. Brasher # # This file is part of the LipidFinder software tool and governed by the # 'MIT License'. Please see the LICENSE file that should have been # included as part of this software. """Set of methods aimed to calculate the False Discovery Rate: > get_fdr(): ...
mit
preete-dixit-ck/incubator-airflow
airflow/contrib/hooks/salesforce_hook.py
30
12110
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
apache-2.0
Xeralux/tensorflow
tensorflow/examples/learn/hdf5_classification.py
75
2899
# 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
wmvanvliet/mne-python
examples/connectivity/plot_mne_inverse_label_connectivity.py
13
7516
""" ========================================================================= Compute source space connectivity and visualize it using a circular graph ========================================================================= This example computes the all-to-all connectivity between 68 regions in source space based on...
bsd-3-clause
fabioticconi/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
78
17611
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from numpy.random import RandomState from sklearn.datasets import make_classification from sklearn.utils.s...
bsd-3-clause
wmvanvliet/mne-python
examples/time_frequency/plot_compute_csd.py
20
3996
""" ================================================== Compute a cross-spectral density (CSD) matrix ================================================== A cross-spectral density (CSD) matrix is similar to a covariance matrix, but in the time-frequency domain. It is the first step towards computing sensor-to-sensor cohe...
bsd-3-clause
Insight-book/data-science-from-scratch
scratch/recommender_systems.py
2
12803
users_interests = [ ["Hadoop", "Big Data", "HBase", "Java", "Spark", "Storm", "Cassandra"], ["NoSQL", "MongoDB", "Cassandra", "HBase", "Postgres"], ["Python", "scikit-learn", "scipy", "numpy", "statsmodels", "pandas"], ["R", "Python", "statistics", "regression", "probability"], ["machine learning", ...
unlicense
thientu/scikit-learn
sklearn/feature_extraction/tests/test_feature_hasher.py
258
2861
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
bsd-3-clause
jrabenoit/fizzy
estimators.py
1
8082
#!/usr/bin/env python3 import numpy as np import pandas as pd import copy, pickle from sklearn import svm, naive_bayes, neighbors, ensemble, linear_model, tree, neural_network #Quick note: feature_importances_ can be used with random forest etc. to generate feature importance lists def InnerFolds(): with open('...
gpl-3.0
yavalvas/yav_com
build/matplotlib/doc/mpl_examples/units/bar_demo2.py
9
1062
""" plot using a variety of cm vs inches conversions. The example shows how default unit instrospection works (ax1), how various keywords can be used to set the x and y units to override the defaults (ax2, ax3, ax4) and how one can set the xlimits using scalars (ax3, current units assumed) or units (conversions applie...
mit
deepesch/scikit-learn
sklearn/cross_validation.py
5
61899
""" 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
chizhizhen/DNT
caffe/examples/finetune_flickr_style/assemble_data.py
18
3323
#!/usr/bin/env python """ Form a subset of the Flickr Style data, download images to dirname, and write Caffe ImagesDataLayer training file. """ import os import urllib import hashlib import argparse import numpy as np import pandas as pd import multiprocessing # Flickr returns a special image if the request is unavai...
mit
lyijin/email_analysis
plot.aranda.swarmplot.py
1
2624
#!/usr/bin/env python3 """ > plot.aranda.swarmplot.py < Based on the parsed inbox file, plot a swarmplot to provide chronological context to email volume from lab members. """ import csv import datetime import matplotlib.pyplot as plt import pandas as pd import seaborn as sns KAUST_START_UNIX_TIME = 1367712000 LAB_...
gpl-3.0
Nyker510/scikit-learn
examples/cluster/plot_kmeans_digits.py
230
4524
""" =========================================================== A demo of K-Means clustering on the handwritten digits data =========================================================== In this example we compare the various initialization strategies for K-means in terms of runtime and quality of the results. As the gr...
bsd-3-clause
deprofundis/deprofundis
utils/utils.py
1
3403
from matplotlib import pyplot as plt import numpy as np from types import FunctionType class HashableDict(dict): # http://code.activestate.com/recipes/414283-frozen-dictionaries/ def __hash__(self): return hash(tuple(sorted(self.items()))) def grab_minibatch(patterns, n_in_minibatch): assert len...
mit
scikit-multilearn/scikit-multilearn
skmultilearn/adapt/mltsvm.py
1
6351
# Authors: Grzegorz Kulakowski <grzegorz7w@gmail.com> # License: BSD 3 clause from skmultilearn.base import MLClassifierBase import numpy as np import scipy.sparse as sp from scipy.linalg import norm from scipy.sparse.linalg import inv as inv_sparse from scipy.linalg import inv as inv_dense class MLTSVM(MLClassifier...
bsd-2-clause
google/NeuroNER-CSPMC
neuroner/evaluate.py
1
15107
import json import os import pkg_resources import time import numpy as np import matplotlib.pyplot as plt import sklearn.metrics from neuroner import utils_plots from neuroner import utils_nlp def assess_model(y_pred, y_true, labels, target_names, labels_with_o, target_names_with_o, dataset_type, stats_graph_folder,...
mit
wlamond/scikit-learn
examples/semi_supervised/plot_label_propagation_digits_active_learning.py
36
4076
""" ======================================== Label Propagation digits active learning ======================================== Demonstrates an active learning technique to learn handwritten digits using label propagation. We start by training a label propagation model with only 10 labeled points, then we select the t...
bsd-3-clause
fy2462/apollo
modules/tools/routing/util.py
1
3821
#!/usr/bin/env python ############################################################################### # Copyright 2017 The Apollo 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 ...
apache-2.0
sinhrks/seaborn
examples/many_facets.py
26
1062
""" Plotting on a large number of facets ==================================== """ import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set(style="ticks") # Create a dataset with many short random walks rs = np.random.RandomState(4) pos = rs.randint(-1, 2, (20, 5)).cumsum(ax...
bsd-3-clause
Haunter17/MIR_SU17
exp2/exp2l.py
1
8332
import numpy as np import tensorflow as tf import h5py import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import sys # Functions for initializing neural nets parameters def init_weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1, dtype=tf.float32) return tf.Var...
mit
bsipocz/statsmodels
statsmodels/discrete/tests/test_discrete.py
19
55886
""" Tests for discrete models Notes ----- DECIMAL_3 is used because it seems that there is a loss of precision in the Stata *.dta -> *.csv output, NOT the estimator for the Poisson tests. """ # pylint: disable-msg=E1101 from statsmodels.compat.python import range import os import numpy as np from numpy.testing import ...
bsd-3-clause
plotly/python-api
packages/python/plotly/plotly/graph_objs/_pie.py
1
78165
from plotly.basedatatypes import BaseTraceType as _BaseTraceType import copy as _copy class Pie(_BaseTraceType): # class properties # -------------------- _parent_path_str = "" _path_str = "pie" _valid_props = { "automargin", "customdata", "customdatasrc", "directi...
mit
shikhardb/scikit-learn
examples/model_selection/grid_search_digits.py
227
2665
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.grid_search.GridSearc...
bsd-3-clause
facebookresearch/ParlAI
parlai/crowdsourcing/tasks/model_chat/analysis/compile_results.py
1
21420
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import re from datetime import datetime from typing import Any, Dict import numpy as np import pa...
mit
GuessWhoSamFoo/pandas
pandas/tseries/offsets.py
2
83512
# -*- coding: utf-8 -*- from datetime import date, datetime, timedelta import functools import operator from dateutil.easter import easter import numpy as np from pandas._libs.tslibs import ( NaT, OutOfBoundsDatetime, Timedelta, Timestamp, ccalendar, conversion, delta_to_nanoseconds, frequencies as libfrequen...
bsd-3-clause
mylxiaoyi/rgbdslam_v2
test/figures.py
8
24389
#!/usr/bin/python import argparse import random import matplotlib from matplotlib.pyplot import figure, text, show, xticks, xlabel, ylabel, gcf, close from numpy import arange, pi, cos, sin, pi, asarray, median #If new parameter found, append a list for its values to the error and duration collections def check_for_n...
gpl-3.0
debugger87/spark
python/pyspark/sql/udf.py
16
17796
# # 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
bearishtrader/trading-with-python
lib/interactivebrokers.py
77
18140
""" Copyright: Jev Kuznetsov Licence: BSD Interface to interactive brokers together with gui widgets """ import sys # import os from time import sleep from PyQt4.QtCore import (SIGNAL, SLOT) from PyQt4.QtGui import (QApplication, QFileDialog, QDialog, QVBoxLayout, QHBoxLayout, QDialogButtonBox, ...
bsd-3-clause
duncanwp/cis_plugins
gassp.py
1
5417
from cis.data_io.products.NCAR_NetCDF_RAF import NCAR_NetCDF_RAF, NCAR_NetCDF_RAF_variable_name_selector class GASSP_variable_name_selector(NCAR_NetCDF_RAF_variable_name_selector): # Static air pressure value for faam rack measurements CORRECTED_PRESSURE_VAR_NAME = 'PS_RVSM' # Standard static air pressure...
lgpl-3.0
hvanhovell/spark
python/pyspark/worker.py
3
27527
# # 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
wzbozon/statsmodels
examples/python/generic_mle.py
33
7532
## Maximum Likelihood Estimation (Generic models) # This tutorial explains how to quickly implement new maximum likelihood models in `statsmodels`. We give two examples: # # 1. Probit model for binary dependent variables # 2. Negative binomial model for count data # # The `GenericLikelihoodModel` class eases the p...
bsd-3-clause
jatraug/Dataclass
Module4/assignment3.py
1
4575
import pandas as pd import matplotlib.pyplot as plt import matplotlib import assignment2_helper as helper import numpy as np # Look pretty... # matplotlib.style.use('ggplot') plt.style.use('ggplot') # Do * NOT * alter this line, until instructed! scaleFeatures = True ##False # TODO: Load up the dataset and remov...
mit
paulocoding/DataScienceMachineLearning
Decision_Trees/decision_trees_regression.py
2
1216
# -*- coding: utf-8 -*- """ Created on Tue Jul 07 20:42:01 2015 @author: Allen Thomas Varghese """ import numpy as np from sklearn.tree import DecisionTreeRegressor import matplotlib.pyplot as plt # Create a random dataset rng = np.random.RandomState(1) X = np.sort(5 * rng.rand(80, 1), axis=0) y = np.sin(X).ravel() y...
mit
icdishb/scikit-learn
sklearn/datasets/twenty_newsgroups.py
4
13427
"""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
escherba/annx
setup.py
1
10154
import os import sys import re import platform import numpy import warnings import logging import itertools import subprocess import distutils.sysconfig from glob import glob from setuptools import Command, setup, Extension from setuptools.dist import Distribution from setuptools.command.build_ext import build_ext as _...
mit
kanchenxi04/vnpy-app
vn.trader/ctaAlgo/strategy_MACD_v01_1.py
1
25181
# encoding: UTF-8 # 首先写系统内置模块 from datetime import datetime, timedelta, date from time import sleep # 其次,导入vnpy的基础模块 import sys # sys.path.append('C:\\vnpy_1.5\\vnpy-master\\vn.trader') sys.path.append('../') from vtConstant import EMPTY_STRING, EMPTY_INT, DIRECTION_LONG, DIRECTION_SHORT, OFFSET_OPEN, STA...
mit
shawnwanderson/466T7Music
feature_plots_w_wo_instr/get_charts_instr_occurr.py
1
1078
import csv import numpy as np import pylab as pylab import matplotlib.pyplot as plt import matplotlib.patches as mpatches # vocals row[0] # drums row[1] # claps row[2] # zero crossing row[3] # centroid row[4] # roll off row[5] # flux row[6] with open('zcrf_features.csv') as f: reader = csv.reader(f) featurex_instr...
mit
tskisner/healpix-autotools
src/healpy/healpy/newvisufunc.py
1
7036
__all__ = ['mollview', 'projplot'] import numpy as np from .pixelfunc import ang2pix, npix2nside from .rotator import Rotator from matplotlib.projections.geo import GeoAxes ###### WARNING ################# # this module is work in progress, the aim is to reimplement the healpy # plot functions using the new features ...
gpl-2.0
ssaeger/scikit-learn
sklearn/cluster/birch.py
18
22732
# Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Joel Nothman <joel.nothman@gmail.com> # License: BSD 3 clause from __future__ import division import warnings import numpy as np from scipy import sparse from math import sqrt fro...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/examples/user_interfaces/gtk_spreadsheet.py
13
2463
#!/usr/bin/env python """ Example of embedding matplotlib in an application and interacting with a treeview to store data. Double click on an entry to update plot data """ import pygtk pygtk.require('2.0') import gtk from gtk import gdk import matplotlib matplotlib.use('GTKAgg') # or 'GTK' from matplotlib.backends....
mit
bblais/Classy
classy/mlp.py
1
6918
import numpy as np import warnings from itertools import cycle from sklearn.utils import gen_even_slices from sklearn.utils import shuffle from sklearn.base import BaseEstimator from sklearn.base import ClassifierMixin from sklearn.preprocessing import LabelBinarizer def _softmax(x): np.exp(x, x) x /= np.sum...
mit
Achuth17/scikit-learn
examples/svm/plot_oneclass.py
249
2302
""" ========================================== 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
beepee14/scikit-learn
sklearn/feature_extraction/hashing.py
183
6155
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: BSD 3 clause import numbers import numpy as np import scipy.sparse as sp from . import _hashing from ..base import BaseEstimator, TransformerMixin def _iteritems(d): """Like d.iteritems, but accepts any collections.Mapping.""" return d.iteritems() if...
bsd-3-clause
benjaminaschultz/shakespeare
shakespeare/__init__.py
1
6194
import sys,os import re,glob import numpy as np import scipy.sparse from sklearn.naive_bayes import MultinomialNB import cPickle as pickle import pkg_resources from . import content_sources #remove punctuation and prepositions from a string def find_keywords(text): keywords=re.sub('[{}:?!@#$%^&*\(\)_.\\/,\'\"]','...
mit
rodluger/planetplanet
scripts/spitzer_example.py
1
5615
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' spitzer_example.py |github| --------------------------- Sample observations of TRAPPIST-1 PPOs with Spitzer. .. plot:: :align: center from scripts import spitzer_example spitzer_example._test() .. role:: raw-html(raw) :format: html ...
gpl-3.0
kmike/scikit-learn
sklearn/linear_model/ridge.py
2
31990
""" Ridge regression """ # Author: Mathieu Blondel <mathieu@mblondel.org> # Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com> # Fabian Pedregosa <fabian@fseoane.net> # License: Simplified BSD from abc import ABCMeta, abstractmethod import warnings import numpy as np from scipy import linalg f...
bsd-3-clause
dsullivan7/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause
idlead/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
guozixiang/vnpy
vn.datayes/api.py
19
45371
#encoding: UTF-8 import os import json import time import requests import pymongo import pandas as pd from datetime import datetime, timedelta from Queue import Queue, Empty from threading import Thread, Timer from pymongo import MongoClient from requests.exceptions import ConnectionError from errors im...
mit
alexis-jacq/shape_learning
scripts/shape_model_gui.py
2
3648
#!/usr/bin/env python # coding: utf-8 import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button from shape_learning.shape_modeler import ShapeModeler import argparse parser = argparse.ArgumentParser(description='Displays the effect of the parameters in a shape model'); parser.ad...
isc
procoder317/scikit-learn
sklearn/semi_supervised/label_propagation.py
71
15342
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms per...
bsd-3-clause
diegocavalca/Studies
phd-thesis/nilmtk/nilmtk/tests/test_datastore.py
1
6061
#!/usr/bin/python from __future__ import print_function, division import unittest from os.path import join import pandas as pd from datetime import timedelta from .testingtools import data_dir from nilmtk.datastore import HDFDataStore, CSVDataStore from nilmtk import TimeFrame # class name can't begin with test class...
cc0-1.0
mariusvniekerk/ibis
ibis/sql/alchemy.py
1
23791
# Copyright 2015 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
apache-2.0
changbindu/rufeng-finance
src/tushare/test/storing_test.py
40
1729
# -*- coding:utf-8 -*- import os from sqlalchemy import create_engine from pandas.io.pytables import HDFStore import tushare as ts def csv(): df = ts.get_hist_data('000875') df.to_csv('c:/day/000875.csv',columns=['open','high','low','close']) def xls(): df = ts.get_hist_data('000875') #直接保存 df.t...
lgpl-3.0
danielballan/mpld3
mpld3/tests/test_elements.py
16
5658
""" Test creation of basic plot elements """ import numpy as np import matplotlib.pyplot as plt from .. import fig_to_dict, fig_to_html from numpy.testing import assert_equal def test_line(): fig, ax = plt.subplots() ax.plot(np.arange(10), np.random.random(10), '--k', alpha=0.3, zorder=10, lw=2) ...
bsd-3-clause
shadmanj/college-code
BME301-Bioelectricity/hodgkin-huxley-solver-PYTHON/2nd-order-DE-solver.py
1
3308
#Shadman Jubaer #BME 301 #HW 2 #These functions will numerically solve a second order differential #equation using either Euler or Runge-Kutta numerical solving methods. #------------------------------------------------------------ import math as m import matplotlib.pyplot as plt #Generates interval over wh...
mit
schoolie/bokeh
bokeh/core/compat/bokeh_renderer.py
6
21121
"Supporting objects and functions to convert Matplotlib objects into Bokeh." #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.t...
bsd-3-clause
bzero/statsmodels
statsmodels/tsa/filters/hp_filter.py
27
3507
from __future__ import absolute_import from scipy import sparse from scipy.sparse import dia_matrix, eye as speye from scipy.sparse.linalg import spsolve import numpy as np from ._utils import _maybe_get_pandas_wrapper def hpfilter(X, lamb=1600): """ Hodrick-Prescott filter Parameters ---------- ...
bsd-3-clause
Eric89GXL/scipy
scipy/stats/_distn_infrastructure.py
2
120310
# # Author: Travis Oliphant 2002-2011 with contributions from # SciPy Developers 2004-2011 # from __future__ import division, print_function, absolute_import from scipy._lib.six import string_types, exec_, PY3 from scipy._lib._util import getargspec_no_self as _getargspec import sys import keyword import r...
bsd-3-clause
dbohn/openlab
appli/iotlab_examples/robot_broadcaster/robot_broadcaster.py
4
7396
""" live_imu.py IoT-LAB M3 Live Sensors Display data from an IoT-LAB M3 node running the robot_listener firmware. The application uses input from the serial_aggregator.py. Please see REAME.md Avalaible sensors are : - Gyroscop and Accerometer (from IMU) - Light - Temperature (from pression sensor) Author: Guilla...
gpl-3.0
ZenDevelopmentSystems/scikit-learn
sklearn/neighbors/approximate.py
71
22357
"""Approximate nearest neighbor search""" # Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # Joel Nothman <joel.nothman@gmail.com> import numpy as np import warnings from scipy import sparse from .base import KNeighborsMixin, RadiusNeighborsMixin from ..base import BaseEstimator from ..utils.va...
bsd-3-clause
3manuek/scikit-learn
sklearn/linear_model/tests/test_coordinate_descent.py
44
22866
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause from sys import version_info import numpy as np from scipy import interpolate, sparse from copy import deepcopy from sklearn.datasets import load_boston from sklearn.utils.testing ...
bsd-3-clause
illume/numpy3k
numpy/core/code_generators/ufunc_docstrings.py
2
75295
# Docstrings for generated ufuncs docdict = {} def get(name): return docdict.get(name) def add_newdoc(place, name, doc): docdict['.'.join((place, name))] = doc add_newdoc('numpy.core.umath', 'absolute', """ Calculate the absolute value element-wise. Parameters ---------- x : array_like...
bsd-3-clause
DSLituiev/scikit-learn
doc/conf.py
15
8446
# -*- coding: utf-8 -*- # # scikit-learn documentation build configuration file, created by # sphinx-quickstart on Fri Jan 8 09:13:42 2010. # # This file is execfile()d with the current directory set to its containing # dir. # # Note that not all possible configuration values are present in this # autogenerated file. ...
bsd-3-clause
0todd0000/spm1d
spm1d/rft1d/examples/paper/fig05_EC_broken.py
1
3709
from math import pi,log,sqrt,exp import numpy as np from scipy import stats from matplotlib import pyplot from spm1d import rft1d ### EPS production preliminaries: fig_width_mm = 100 fig_height_mm = 80 mm2in = 1/25.4 fig_width = fig_width_mm*mm2in # width in inches fig_height = fig_height_mm*mm2in # height...
gpl-3.0
argriffing/numpy
numpy/lib/recfunctions.py
148
35012
""" Collection of utilities to manipulate structured arrays. Most of these functions were initially implemented by John Hunter for matplotlib. They have been rewritten and extended for convenience. """ from __future__ import division, absolute_import, print_function import sys import itertools import numpy as np im...
bsd-3-clause
trungnt13/scikit-learn
sklearn/manifold/tests/test_mds.py
324
1862
import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_raises from sklearn.manifold import mds def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
jeremiedecock/snippets
python/matplotlib/contours/label_on_contours_and_choose_contour_levels.py
1
1448
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) # See http://matplotlib.org/api/axes_api.html?highlight=contour#matplotlib.axes.Axes.contour import math import numpy as np import matplotlib import matplotlib.cm as cm import matplotlib.mlab as mlab import matp...
mit
warren-oneill/powerline
tests/test_history.py
2
15600
from unittest import TestCase import numpy as np import pandas as pd from zipline.history.history import HistorySpec from zipline.protocol import BarData from zipline.finance.trading import TradingEnvironment from powerline.history.history_container import EpexHistoryContainer __author__ = 'Max' class TestHistory(...
apache-2.0
muxspace/facial_expressions
python/JN721.py
2
5371
# Augmenting Face Image Database via Transformations (Flip, Rotate, Crop & Scale) # Jay Narhan # UserID: JN721 # # This class is designed to apply a series of image transformations to a set of images. A transformation is simply a # function. It is a function that maps the image to another version of the image. # # G(x...
apache-2.0
jaidevd/scikit-learn
sklearn/tests/test_kernel_approximation.py
78
7586
import numpy as np from scipy.sparse import csr_matrix from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true from sklearn.utils.testing import assert_not_equal from sklearn.utils.testing import assert_array_almost_equal, assert_raises from sklearn.utils.testing import assert_less_equal from ...
bsd-3-clause
SuLab/scheduled-bots
scheduled_bots/phenotypes/download_mitodb.py
1
4192
# http://mitodb.com/symptoms.php?oid=302060&symptoms=Show import subprocess from itertools import chain from tqdm import tqdm from bs4 import BeautifulSoup import requests import pandas as pd def download_disease_list(): ## get all diseases url = "http://mitodb.com/" bs = BeautifulSoup(requests.get(url).t...
mit
eayoungs/DeltaMtrSvs
test_2_amsaves.py
1
10564
#!/usr/bin/env python __author__ = "Eric Allen Youngson" __email__ = "eric@successionecological.com" __copyright__ = "Copyright 2015, Succession Ecological Services" __license__ = "GNU Affero (GPLv3)" """ This module provides functions for requesting results from the DeltaMeter Services API * deltameterservices.c...
agpl-3.0
seberg/numpy
doc/source/conf.py
3
14190
# -*- coding: utf-8 -*- import os import re import sys # Minimum version, enforced by sphinx needs_sphinx = '3.2.0' # This is a nasty hack to use platform-agnostic names for types in the # documentation. # must be kept alive to hold the patched names _name_cache = {} def replace_scalar_type_names(): """ Rename...
bsd-3-clause
jeremyjbowers/nba_py
setup.py
1
3686
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.absp...
bsd-3-clause
nitish-tripathi/Simplery
Datasets/UCI_Wine/LDA_WineData.py
1
2501
import pandas as pd import numpy as np from sklearn.lda import LDA from sklearn.linear_model import LogisticRegression from sklearn.cross_validation import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.metrics import accuracy_score import matplotlib.pyplot as plt from matplotlib.colors...
mit
brianlorenz/COSMOS_IMACS_Redshifts
PlotCodes/Plot_Avfinal_dist.py
1
3816
#Plots the Av magnitude due to the balmer decerment import numpy as np import matplotlib.pyplot as plt from astropy.io import ascii import sys, os, string import pandas as pd from astropy.io import fits import collections #Folder to save the figures figout = '/Users/blorenz/COSMOS/Reports/2018/Images/' #The location ...
mit
WaveBlocks/WaveBlocks
src/scripts_advanced/PlotQRNodesSupportEvolution.py
1
3340
"""The WaveBlocks Project Script to plot the support of the transformed quadrature nodes during the time evolution. @author: R. Bourquin @copyright: Copyright (C) 2012 R. Bourquin @license: Modified BSD License """ import sys from numpy import unique, array, squeeze from matplotlib.pyplot import * from WaveBlocks i...
bsd-3-clause