repo_name
stringlengths
7
92
path
stringlengths
5
149
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
911
693k
license
stringclasses
15 values
xhochy/arrow
python/pyarrow/tests/test_hdfs.py
1
13325
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
spallavolu/scikit-learn
examples/bicluster/plot_spectral_coclustering.py
276
1736
""" ============================================== A demo of the Spectral Co-Clustering algorithm ============================================== This example demonstrates how to generate a dataset and bicluster it using the the Spectral Co-Clustering algorithm. The dataset is generated using the ``make_biclusters`` f...
bsd-3-clause
ASU-CodeDevils/DemonHacks2017
gameFiles/Python/helpers.py
1
7120
from __future__ import print_function from __future__ import division import numpy as np from datetime import datetime from scipy.stats import norm from scipy.optimize import minimize def acq_max(ac, gp, y_max, bounds, random_state): """ A function to find the maximum of the acquisition function It uses ...
mit
muLAn-project/muLAn
muLAn/instruments.py
1
5376
# -*-coding:Utf-8 -* # ==================================================================== # Packages # ==================================================================== import configparser as cp import copy import glob import muLAn import muLAn.packages.general_tools as gtools import muLAn.packages.algebra as alge...
mit
imaculate/scikit-learn
examples/preprocessing/plot_function_transformer.py
158
1993
""" ========================================================= Using FunctionTransformer to select columns ========================================================= Shows how to use a function transformer in a pipeline. If you know your dataset's first principle component is irrelevant for a classification task, you ca...
bsd-3-clause
Axelrod-Python/Axelrod-fingerprint
update_fingerprints.py
1
8815
""" A script to obtain the Ashlock Fingerprints of all strategies in the Axelrod library. This writes a hash of the source code of each strategy to file: db.csv. If the source code of a strategy changes **or** a new strategy is introduced then the fingerprint is regenerated for that strategy. """ import inspect impo...
mit
hwp-kiel/opencali
src/ui/mplwidget.py
1
1403
# Python Qt4 bindings for GUI objects from PyQt4 import QtGui # import the Qt4Agg FigureCanvas object, that binds Figure to # Qt4Agg backend. It also inherits from QWidget from matplotlib.backends.backend_qt4agg \ import FigureCanvasQTAgg as FigureCanvas # Matplotlib Figure object from matplotlib.figure import Figure ...
gpl-2.0
Evensgn/MNIST-learning
mnist_svm.py
1
1201
import numpy as np import matplotlib.pyplot as plt GRAY_SCALE_RANGE = 255 import pickle data_filename = 'data_deskewed.pkl' print('Loading data from file \'' + data_filename + '\' ...') with open(data_filename, 'rb') as f: train_labels = pickle.load(f) train_images = pickle.load(f) test_labels = pickle.l...
mit
dr-jpk/saltefficiency
weekly/weekly_summary_plots.py
1
8536
# -*- coding: utf-8 -*- """ Created on Mon Mar 9 10:06:20 2015 @author: jpk ToDo: automate the subsystems check. A query that checks all the subsystems in case things change in the future should prevent issues with the pis chart colours """ import sys import os import pandas as pd import pandas.io.sql as psql impor...
bsd-3-clause
dhalleine/tensorflow
tensorflow/examples/skflow/iris.py
1
1465
# 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
amueller/advanced_training
plots/plot_interactive_tree.py
1
2695
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_blobs from sklearn.tree import DecisionTreeClassifier from sklearn.externals.six import StringIO # doctest: +SKIP from sklearn.tree import export_graphviz from scipy.misc import imread from scipy import ndimage import os import re ...
bsd-2-clause
rsheftel/pandas_market_calendars
tests/test_bse_calendar.py
1
1192
import datetime import pandas as pd import pytz from pandas_market_calendars.exchange_calendar_bse import BSEExchangeCalendar, BSEClosedDay def test_time_zone(): assert BSEExchangeCalendar().tz == pytz.timezone('Asia/Calcutta') assert BSEExchangeCalendar().name == 'BSE' def test_holidays(): bse_calend...
mit
dipanjanS/text-analytics-with-python
Old-First-Edition/Ch04_Text_Classification/classifier_evaluation_demo.py
1
3277
# -*- coding: utf-8 -*- """ Created on Fri Sep 02 12:36:55 2016 @author: DIP """ from sklearn import metrics import numpy as np import pandas as pd from collections import Counter actual_labels = ['spam', 'ham', 'spam', 'spam', 'spam', 'ham', 'ham', 'spam', 'ham', 'spam', 'spam', 'ham',...
apache-2.0
Averroes/statsmodels
statsmodels/sandbox/examples/try_multiols.py
33
1243
# -*- coding: utf-8 -*- """ Created on Sun May 26 13:23:40 2013 Author: Josef Perktold, based on Enrico Giampieri's multiOLS """ #import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.sandbox.multilinear import multiOLS, multigroup data = sm.datasets.longley.load_pandas() df = data.e...
bsd-3-clause
nlhepler/freetype-py3
examples/glyph-vector-2.py
1
3414
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # FreeType high-level python API - Copyright 2011 Nicolas P. Rougier # Distributed under the terms of the new BSD license. # # ---------------------------------------------------------------...
bsd-3-clause
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/dask/dataframe/__init__.py
2
1278
from __future__ import print_function, division, absolute_import try: from .core import (DataFrame, Series, Index, _Frame, map_partitions, repartition, to_datetime, to_timedelta) from .groupby import Aggregation from .io import (from_array, from_pandas, from_bcolz, ...
gpl-3.0
lifei96/Medium-crawler-with-data-analyzer
User_Crawler/get_data.py
2
1601
# -*- coding: utf-8 -*- import pandas as pd import json import datetime import os def read_users(): users = list() file_in = open('./username_list.txt', 'r') username_list = str(file_in.read()).split(' ') file_in.close() num = 0 for username in username_list: if not username: ...
mit
MechCoder/scikit-learn
sklearn/metrics/__init__.py
8
3701
""" The :mod:`sklearn.metrics` module includes score functions, performance metrics and pairwise metrics and distance computations. """ from .ranking import auc from .ranking import average_precision_score from .ranking import coverage_error from .ranking import label_ranking_average_precision_score from .ranking imp...
bsd-3-clause
willyd/fast-rcnn
tools/demo.py
22
5446
#!/usr/bin/env python # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """ Demo script showing detections in sample ima...
mit
clawpack/clawpack-4.x
doc/sphinx/example-acoustics-1d/setplot_2.py
2
2095
""" Single figure and axes with two items ======================================= Only the pressure q[0] is plotted. In this example the line and points are plotted in different colors by specifying a second item on the same axes. """ #-------------------------- def setplot(plotdata): #--------------------------...
bsd-3-clause
dingocuster/scikit-learn
sklearn/naive_bayes.py
70
28476
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
jhamman/xray
xarray/tests/test_combine.py
1
15860
from __future__ import absolute_import from __future__ import division from __future__ import print_function from copy import deepcopy import numpy as np import pandas as pd from xarray import Dataset, DataArray, auto_combine, concat, Variable from xarray.core.pycompat import iteritems, OrderedDict from . import Tes...
apache-2.0
spallavolu/scikit-learn
examples/linear_model/plot_logistic.py
312
1426
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logit function ========================================================= Show in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or two, u...
bsd-3-clause
chungjjang80/FRETBursts
fretbursts/tests/test_burstlib.py
1
40546
# # FRETBursts - A single-molecule FRET burst analysis toolkit. # # Copyright (C) 2014 Antonino Ingargiola <tritemio@gmail.com> # """ Module containing automated unit tests for FRETBursts. Running the tests requires `py.test`. """ from __future__ import division from builtins import range, zip from collections impor...
gpl-2.0
kylerbrown/scikit-learn
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
paultcochrane/bokeh
examples/charts/file/stocks_timeseries.py
33
1230
from collections import OrderedDict import pandas as pd from bokeh.charts import TimeSeries, show, output_file # read in some stock data from the Yahoo Finance API AAPL = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) MSFT = pd.read_csv( "http...
bsd-3-clause
gerddie/nipype
nipype/algorithms/rapidart.py
9
30137
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ The rapidart module provides routines for artifact detection and region of interest analysis. These functions include: * ArtifactDetect: performs artifact detection on functional images * Stimulu...
bsd-3-clause
tedunderwood/GenreProject
python/piketty/fifteenwordsnippets.py
1
11248
# fifteenwordsnippets.py # A script that searches a HathiTrust corpus of 6,942 volumes (1700-1923), plus Hoyt & Richard's # corpus of 808 vols (1923-1950), for words related to money. It takes seven words on either # side of those words to create a snippet. # In cases where the possibly-monetary word is ambiguous, e....
mit
alesaccoia/TF_SoundClassification
as_sound/exec/train_vad_ann_5FCL_classifier.py
1
1585
import numpy as np import as_classification.ann_models import as_sound.features.extractFeatures as ef import as_classification.utilities import os import matplotlib.pyplot as plt # ------------------------------- # CREATE MODEL # ------------------------------- model = as_classification.ann_models.ANN_5FCL() model.i...
mit
blaze/dask
dask/dataframe/tests/test_indexing.py
2
19852
import pandas as pd import numpy as np import pytest import dask import dask.dataframe as dd from dask.dataframe._compat import tm, PANDAS_GT_100 from dask.dataframe.indexing import _coerce_loc_index from dask.dataframe.utils import assert_eq, make_meta, PANDAS_VERSION dsk = { ("x", 0): pd.DataFrame({"a": [1, ...
bsd-3-clause
merenlab/anvio
anvio/drivers/sourmash.py
2
4700
# coding: utf-8 """Interface to sourmash""" import os import numpy as np import pandas as pd import shutil import anvio import anvio.utils as utils import anvio.terminal as terminal import anvio.filesnpaths as filesnpaths from scipy.stats import entropy, skew, kurtosis from anvio.errors import ConfigError __autho...
gpl-3.0
JsNoNo/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py
254
2795
"""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
BigDataforYou/movie_recommendation_workshop_1
big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/stats/tests/test_math.py
9
1836
import nose from datetime import datetime from numpy.random import randn import numpy as np from pandas.core.api import Series, DataFrame, date_range import pandas.util.testing as tm import pandas.stats.math as pmath from pandas import ols N, K = 100, 10 _have_statsmodels = True try: import statsmodels.api as s...
mit
trachelr/mne-python
mne/time_frequency/tfr.py
2
48373
"""A module which implements the time frequency estimation. Morlet code inspired by Matlab code from Sheraz Khan & Brainstorm & SPM """ # Authors : Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Hari Bharadwaj <hari@nmr.mgh.harvard.edu> # # License : BSD (3-clause) import warnings from math ...
bsd-3-clause
Peratham/tensorlib
doc/sphinxext/gen_rst.py
11
38957
""" Example generation for the scikit learn Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ from __future__ import division, print_function from time import time import ast import os import re import shutil import traceback i...
bsd-3-clause
JackKelly/neuralnilm_prototype
scripts/e129.py
2
5359
from __future__ import print_function, division import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import c...
mit
jseabold/statsmodels
examples/python/contrasts.py
5
9020
# coding: utf-8 # DO NOT EDIT # Autogenerated from the notebook contrasts.ipynb. # Edit the notebook and then sync the output with this file. # # flake8: noqa # DO NOT EDIT # # Contrasts Overview import numpy as np import statsmodels.api as sm # This document is based heavily on this excellent resource from UCLA # ...
bsd-3-clause
rahul-c1/scikit-learn
sklearn/cluster/tests/test_mean_shift.py
19
2844
""" Testing for mean shift clustering methods """ import numpy as np 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.cluster import MeanShift from sklearn.clu...
bsd-3-clause
jingxiang-li/kaggle-yelp
archive/preprocess.py
1
1280
from __future__ import division, absolute_import from __future__ import print_function, unicode_literals import pandas as pd from transfer_features import * # process training data biz2label = pd.read_csv("rawdata/train.csv", index_col=0) photo2biz = pd.read_csv("rawdata/train_photo_to_biz_ids.csv", index_col=0) biz2...
mit
zak-k/iris
lib/iris/tests/test_quickplot.py
4
7721
# (C) British Crown Copyright 2010 - 2016, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
gpl-3.0
Chaparqanatoos/kaggle-knowledge
src/main/python/titanic.py
1
2524
import pandas as pd import numpy as np def pre_process(df): df['Gender'] = df['Sex'].map({'female': 0, 'male': 1}).astype(int) median_ages = np.zeros((2, 3)) for i in range(0, 2): for j in range(0, 3): median_ages[i, j] = df[(df['Gender'] == i) & (df['Pclass'] == j + 1)][...
apache-2.0
mlperf/training_results_v0.7
Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/example/deep-embedded-clustering/dec.py
6
7768
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
waynenilsen/statsmodels
statsmodels/sandbox/examples/ex_kaplan_meier.py
33
2838
#An example for the Kaplan-Meier estimator from __future__ import print_function from statsmodels.compat.python import lrange import statsmodels.api as sm import matplotlib.pyplot as plt import numpy as np from statsmodels.sandbox.survival2 import KaplanMeier #Getting the strike data as an array dta = sm.datasets.stri...
bsd-3-clause
IshankGulati/scikit-learn
sklearn/linear_model/tests/test_sgd.py
34
47824
import pickle import unittest import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing ...
bsd-3-clause
hasecbinusr/pysal
pysal/contrib/pdio/dbf.py
7
6661
"""miscellaneous file manipulation utilities """ import numpy as np import pysal as ps import pandas as pd def check_dups(li): """checks duplicates in list of ID values ID values must be read in as a list __author__ = "Luc Anselin <luc.anselin@asu.edu> " Arguments --------- ...
bsd-3-clause
rubennj/pvlib-python
docs/sphinx/sphinxext/numpydoc/docscrape_sphinx.py
41
9437
from __future__ import division, absolute_import, print_function import sys, re, inspect, textwrap, pydoc import sphinx import collections from .docscrape import NumpyDocString, FunctionDoc, ClassDoc if sys.version_info[0] >= 3: sixu = lambda s: s else: sixu = lambda s: unicode(s, 'unicode_escape') class Sp...
bsd-3-clause
Garrett-R/scikit-learn
sklearn/metrics/tests/test_ranking.py
4
33878
from __future__ import division, print_function import numpy as np from itertools import product import warnings from sklearn import datasets from sklearn import svm from sklearn import ensemble from sklearn.datasets import make_multilabel_classification from sklearn.random_projection import sparse_random_matrix fro...
bsd-3-clause
bgris/ODL_bgris
lib/python3.5/site-packages/matplotlib/patches.py
6
148732
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import map, zip import math import matplotlib as mpl import numpy as np import matplotlib.cbook as cbook import matplotlib.artist as artist from matplotlib.a...
gpl-3.0
kcavagnolo/astroML
examples/learning/plot_neighbors_photoz.py
3
2115
""" K-Neighbors for Photometric Redshifts ------------------------------------- Estimate redshifts from the colors of sdss galaxies and quasars. This uses colors from a sample of 50,000 objects with SDSS photometry and ugriz magnitudes. The example shows how far one can get with an extremely simple machine learning a...
bsd-2-clause
iproduct/course-social-robotics
11-dnn-keras/venv/Lib/site-packages/pandas/tests/reshape/merge/test_merge_ordered.py
3
6370
import numpy as np import pytest import pandas as pd from pandas import DataFrame, merge_ordered import pandas._testing as tm class TestMergeOrdered: def setup_method(self, method): self.left = DataFrame({"key": ["a", "c", "e"], "lvalue": [1, 2.0, 3]}) self.right = DataFrame({"key": ["b", "c", "...
gpl-2.0
vibhorag/scikit-learn
sklearn/tests/test_isotonic.py
230
11087
import numpy as np import pickle from sklearn.isotonic import (check_increasing, isotonic_regression, IsotonicRegression) from sklearn.utils.testing import (assert_raises, assert_array_equal, assert_true, assert_false, assert_equal, ...
bsd-3-clause
nelson-liu/scikit-learn
examples/ensemble/plot_adaboost_regression.py
311
1529
""" ====================================== Decision Tree Regression with AdaBoost ====================================== A decision tree is boosted using the AdaBoost.R2 [1] algorithm on a 1D sinusoidal dataset with a small amount of Gaussian noise. 299 boosts (300 decision trees) is compared with a single decision tr...
bsd-3-clause
arabenjamin/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
allrod5/extra-trees
benchmarks/classification/decision_surface.py
1
4826
print(__doc__) # Code source: Gaël Varoquaux # Andreas Müller # Modified for MCZA015-13 class project by Rodrigo Martins de Oliveira # License: BSD 3 clause import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import ListedColormap from sklearn.datasets import make_circles from skle...
mit
dadawang/tushare
tushare/stock/macro.py
37
12728
# -*- coding:utf-8 -*- """ 宏观经济数据接口 Created on 2015/01/24 @author: Jimmy Liu @group : waditu @contact: jimmysoa@sina.cn """ import pandas as pd import numpy as np import re import json from tushare.stock import macro_vars as vs from tushare.stock import cons as ct try: from urllib.request import urlopen, Reques...
bsd-3-clause
Remi-C/LOD_ordering_for_patches_of_points
script/test_octree_LOD.py
1
7481
# -*- coding: utf-8 -*- """ Created on Tue Dec 2 22:08:22 2014 @author: remi """ #trying to order points by octree with python from numpy import random, sqrt from sklearn import preprocessing import matplotlib.pyplot as plt #defining a dummy entry :a random 3D pointcloud pointcloud = random.rand(16*16,2); index =...
lgpl-3.0
huobaowangxi/scikit-learn
sklearn/manifold/tests/test_t_sne.py
162
9771
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises_regexp ...
bsd-3-clause
Tong-Chen/scikit-learn
sklearn/datasets/base.py
6
18276
""" 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 import warnings from os import en...
bsd-3-clause
jor-/scipy
scipy/optimize/minpack.py
1
34280
from __future__ import division, print_function, absolute_import import threading import warnings from . import _minpack import numpy as np from numpy import (atleast_1d, dot, take, triu, shape, eye, transpose, zeros, prod, greater, array, all, where, isscalar, asarray, inf, abs,...
bsd-3-clause
ARUNSOORAJPS/flipkart_gridlock
src/main.py
1
2686
# -*- coding: utf-8 -*- # @Author: chandan # @Date: 2017-07-08 00:32:09 # @Last Modified by: chandan # @Last Modified time: 2017-07-08 11:13:46 from data_utils import read_file from config import DATA_DIR, SCORE_COLUMNS import os from model import train_model, test_model import pandas as pd import numpy as np fr...
mit
sugiare418/tensorfx
build/tensorflow/scripts/003_lstm_keras_171203/model.py
2
5565
# -*- coding: utf-8 -*- # Python 2.7.6 # tensorflow (0.7.1) import numpy as np import random from param import * import matplotlib matplotlib.use('Agg') # GUI Off設定 import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers.normalization import BatchNormalization from keras.layers.core impo...
mit
nesterione/scikit-learn
sklearn/tests/test_learning_curve.py
225
10791
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import warnings from sklearn.base import BaseEstimator from sklearn.learning_curve import learning_curve, validation_curve from sklearn.u...
bsd-3-clause
vighneshbirodkar/scikit-image
skimage/viewer/viewers/core.py
33
13265
""" ImageViewer class for viewing and interacting with images. """ import numpy as np from ... import io, img_as_float from ...util.dtype import dtype_range from ...exposure import rescale_intensity from ..qt import QtWidgets, Qt, Signal from ..widgets import Slider from ..utils import (dialogs, init_qtapp, figimage, ...
bsd-3-clause
chiu/vincent
examples/scatter_chart_examples.py
9
2130
# -*- coding: utf-8 -*- """ Vincent Scatter Examples """ #Build a Line Chart from scratch from vincent import * import pandas as pd import pandas.io.data as web import datetime all_data = {} date_start = datetime.datetime(2010, 1, 1) date_end = datetime.datetime(2014, 1, 1) for ticker in ['AAPL', 'IBM', 'YHOO', 'MS...
mit
jia-kai/hearv
disp_freq.py
1
1942
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # $File: disp_freq.py # $Date: Sun Nov 23 12:45:25 2014 +0800 # $Author: jiakai <jia.kai66@gmail.com> import matplotlib.pyplot as plt import numpy as np import argparse import json def main(): parser = argparse.ArgumentParser() parser.add_argument('fpath', help=...
unlicense
samuel1208/scikit-learn
sklearn/decomposition/truncated_svd.py
199
7744
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck <L.J.Buitinck@uva.nl> # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sp...
bsd-3-clause
hainm/scikit-learn
sklearn/externals/joblib/parallel.py
86
35087
""" Helpers for embarrassingly parallel code. """ # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org > # Copyright: 2010, Gael Varoquaux # License: BSD 3 clause from __future__ import division import os import sys import gc import warnings from math import sqrt import functools import time import thr...
bsd-3-clause
gbugaisky/bimm_185_conotoxin
wip-scripts_data/kNNProc.py
1
1321
#!usr/bin/env/python import numpy as np import pylab as pl from matplotlib.colors import ListedColormap from sklearn import neighbors def kNNGen(trainfile, testfile): features = np.genfromtxt(trainfile, delimiter=' ', usecols=(0, 1, 2)) labels = np.genfromtxt(trainfile, delimiter=' ', usecols=(-1)) tests = np.genf...
gpl-2.0
sinhrks/scikit-learn
sklearn/tree/tests/test_tree.py
32
52369
""" Testing for the tree module (sklearn.tree). """ import pickle from functools import partial from itertools import product import platform import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import sparse_rand...
bsd-3-clause
kwikadi/orange3
Orange/widgets/data/owdatasampler.py
2
14322
import sys import math from PyQt4 import QtGui from PyQt4.QtCore import Qt import numpy as np import sklearn.cross_validation as skl_cross_validation from Orange.widgets import widget, gui from Orange.widgets.settings import Setting from Orange.data import Table from Orange.data.sql.table import SqlTable class OWD...
bsd-2-clause
idlead/scikit-learn
sklearn/preprocessing/label.py
16
26702
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Joel Nothman <joel.nothman@gmail.com> # Hamzeh Alsalhi <ha258@cornell.edu> # Licens...
bsd-3-clause
jm-begon/scikit-learn
sklearn/metrics/cluster/__init__.py
312
1322
""" The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation: - supervised, which uses a ground truth class values for each sample. - unsupervised, which does not and measures the 'quality' of the model itself. """ from .supervised import ...
bsd-3-clause
edhuckle/statsmodels
statsmodels/tools/parallel.py
32
2180
"""Parallel utility function using joblib copied from https://github.com/mne-tools/mne-python Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu> License: Simplified BSD changes for statsmodels (Josef Perktold) - try import from joblib directly, (doesn't import all of sklearn) """ from __future__ import print...
bsd-3-clause
combust/mleap
python/tests/sklearn/tree/tree_test.py
2
3507
import unittest import os import shutil import json import tempfile import uuid from mleap.sklearn.tree.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.datasets import load_iris class TransformerTests(unittest.TestCase): def setUp(self): self.tmp_dir = tempfile.mkdtemp() def te...
apache-2.0
colin2328/asciiclass
lectures/lec6/match-loop.py
3
2094
import csv from sklearn import tree import editdist import re def string_match_score(p1,p2,field): s1 = p1[field] s2 = p2[field] return editdist.distance(s1.lower(),s2.lower())/float(len(s1)) def jaccard_score(p1,p2,field): name1 = p1[field] name2 = p2[field] set1 = set(name1.lower().split()) ...
mit
steven-cutting/latinpigsay
data/text/samples.py
1
6123
# -*- coding: utf-8 -*- __title__ = 'latinpigsay' __license__ = 'MIT' __author__ = 'Steven Cutting' __author_email__ = 'steven.c.projects@gmail.com' __created_on__ = '12/3/2014' """ Created on Wed Dec 3 17:36:17 2014 @author: steven_c """ acidtest = """Can you talk piglatin to piglatin. """ quotes = """A Tale of ...
mit
Duncan93/dbm-project2
Ttest.py
1
5148
# -*- coding: utf-8 -*- """ Created on Wed Apr 22 22:52:24 2015 @author: lorraine """ import json from pprint import pprint import numpy as np from scipy.stats import mstats from scipy import stats import csv import pandas as pd #json_data=open("data/{0}_B.json".format("pizza")).read() #data = json.loads(json_data) ...
mit
Obus/scikit-learn
examples/feature_stacker.py
246
1906
""" ================================================= Concatenating multiple feature extraction methods ================================================= In many real-world examples, there are many ways to extract features from a dataset. Often it is beneficial to combine several methods to obtain good performance. Th...
bsd-3-clause
mindriot101/bokeh
sphinx/source/docs/user_guide/examples/categorical_heatmap_unemployment.py
11
1638
import pandas as pd from bokeh.io import output_file, show from bokeh.models import BasicTicker, ColorBar, ColumnDataSource, LinearColorMapper, PrintfTickFormatter from bokeh.plotting import figure from bokeh.sampledata.unemployment1948 import data from bokeh.transform import transform output_file("unemploymemt.html"...
bsd-3-clause
kyleabeauchamp/vcfnp
example.py
2
1198
from __future__ import print_function, division import numpy as np import matplotlib.pyplot as plt import vcfnp vcfnp.__version__ filename = 'fixture/sample.vcf' # load data from fixed fields (including INFO) v = vcfnp.variants(filename, cache=True).view(np.recarray) # print some simple variant metrics print('found ...
mit
sumitsourabh/opencog
opencog/python/utility/functions.py
34
11056
from math import fabs, isnan from datetime import datetime from spatiotemporal.unix_time import UnixTime from utility.generic import convert_dict_to_sorted_lists from utility.numeric.globals import EPSILON from numpy import NINF as NEGATIVE_INFINITY, PINF as POSITIVE_INFINITY from scipy.integrate import quad __author_...
agpl-3.0
theandygross/Figures
src/Figures/Boxplots.py
1
11851
""" Created on Apr 24, 2013 @author: agross """ import numpy as np import pandas as pd import matplotlib.pylab as plt import Stats.Scipy as Stats from Figures.FigureHelpers import latex_float, init_ax from Figures.FigureHelpers import prettify_ax from Helpers.Pandas import match_series, true_index colors = plt.rcPa...
mit
cg31/tensorflow
tensorflow/examples/learn/iris_with_pipeline.py
17
1848
# 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
Machyne/econ_comps
full_2011.py
1
6827
import os import numpy as np import pandas as pd from pandas.tools.plotting import scatter_matrix import pylab import statsmodels.formula.api as smf import statsmodels.stats.api as sms from industry_to_days import get_census_mapper """ USAGE: python full_2011.py CREATES: results/2011/clean.csv results/2011/corr.txt...
bsd-3-clause
toastedcornflakes/scikit-learn
benchmarks/bench_plot_ward.py
117
1283
""" Benchmark scikit-learn's Ward implement compared to SciPy's """ import time import numpy as np from scipy.cluster import hierarchy import matplotlib.pyplot as plt from sklearn.cluster import AgglomerativeClustering ward = AgglomerativeClustering(n_clusters=3, linkage='ward') n_samples = np.logspace(.5, 3, 9) n...
bsd-3-clause
gavruskin/microinteractions
data_preprocess_6_reps_with_negatives.py
1
9983
import pandas as pd data = pd.read_csv("development_times_exp1and2.csv", sep="\t") # Add all parameters (Taylor coefficients) as 0 in rows following the data: for i in range(data.shape[0]): for j in range(10, 42): data.set_value(i, j, 0) data.rename(columns={10: "a", 11: "a1", 12: "a2", 13: "...
mit
redarmy30/Eurobot-2017
old year/RESET-master/Machine_vision/get_position.py
2
3426
#!/usr/bin/env python2 import numpy as np import cv2 from matplotlib import pyplot as plt from math import sin, cos, tan, sqrt, pi, atan from operator import itemgetter import timeit #start = timeit.timeit() h = 0.37 #the vertical distance from the ground to camera [in meters] alpha = pi*(28.3)/180.0 #the inclination ...
mit
einarhuseby/arctic
tests/integration/test_arctic.py
4
6898
from datetime import datetime as dt, timedelta as dtd from mock import patch from pandas import DataFrame from pandas.util.testing import assert_frame_equal import pytest import time import numpy as np from arctic.arctic import Arctic, VERSION_STORE from arctic.exceptions import LibraryNotFoundException, QuotaExceeded...
lgpl-2.1
chrsrds/scikit-learn
sklearn/neighbors/lof.py
3
20358
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np import warnings from .base import NeighborsBase from .base import KNeighborsMixin from .base import UnsupervisedMixin from ..base import Outlie...
bsd-3-clause
thientu/scikit-learn
sklearn/gaussian_process/gaussian_process.py
78
34552
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # Licence: BSD 3 clause from __future__ import print_function import numpy as np from scipy import linalg, optimize from ..base import BaseEstimator, RegressorMixin from ..metrics...
bsd-3-clause
nmartensen/pandas
pandas/io/sql.py
3
58612
# -*- coding: utf-8 -*- """ Collection of query wrappers / abstractions to both facilitate data retrieval and to reduce dependency on DB-specific API. """ from __future__ import print_function, division from datetime import datetime, date, time import warnings import re import numpy as np import pandas._libs.lib as ...
bsd-3-clause
anntzer/scikit-learn
sklearn/decomposition/tests/test_online_lda.py
11
14166
import sys import numpy as np from scipy.linalg import block_diag from scipy.sparse import csr_matrix from scipy.special import psi import pytest from sklearn.decomposition import LatentDirichletAllocation from sklearn.decomposition._lda import (_dirichlet_expectation_1d, _dir...
bsd-3-clause
albertbup/DeepBeliefNetwork
example_classification.py
3
1158
import numpy as np np.random.seed(1337) # for reproducibility from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn.metrics.classification import accuracy_score from dbn.tensorflow import SupervisedDBNClassification # Loading dataset digits = load_digits() X, Y ...
mit
joshzarrabi/e-mission-server
emission/analysis/classification/inference/mode.py
2
17308
# Standard imports from pymongo import MongoClient import logging from datetime import datetime import sys import os import numpy as np import scipy as sp import time from datetime import datetime # Our imports import emission.analysis.section_features as easf import emission.core.get_database as edb # We are not goi...
bsd-3-clause
calispac/digicampipe
digicampipe/scripts/spe.py
1
14553
#!/usr/bin/env python """ Do the Single Photoelectron anaylsis Usage: digicam-spe [options] [--] <INPUT>... Options: -h --help Show this screen. --max_events=N Maximum number of events to analyse. --max_histo_filename=FILE File path of the max histogram. ...
gpl-3.0
stoneflyop1/py_machine_learning
ch08/main.py
1
1080
import pandas as pd df = pd.read_csv('../data/movie_data.csv') import cleandata df['review'] = df['review'].apply(cleandata.preprocessor) # grid search, 非常耗时 #import gridlearn #gridlearn.learn(df) from sklearn.feature_extraction.text import HashingVectorizer from sklearn.linear_model import SGDClassifier import tok...
mit
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/pandas/io/pytables.py
3
161411
""" High level interface to PyTables for reading and writing pandas data structures to disk """ # pylint: disable-msg=E1101,W0613,W0603 from datetime import datetime, date import time import re import copy import itertools import warnings import os from pandas.core.dtypes.common import ( is_list_like, is_cate...
mit
yavalvas/yav_com
build/matplotlib/doc/mpl_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
liyu1990/sklearn
sklearn/cluster/dbscan_.py
7
11611
# -*- coding: utf-8 -*- """ DBSCAN: Density-Based Spatial Clustering of Applications with Noise """ # Author: Robert Layton <robertlayton@gmail.com> # Joel Nothman <joel.nothman@gmail.com> # Lars Buitinck # # License: BSD 3 clause import numpy as np from scipy import sparse from ..base import BaseEst...
bsd-3-clause
kaushik94/tardis
tardis/montecarlo/tests/test_base.py
1
1152
import os import pandas as pd import numpy as np import pytest from astropy import units as u from numpy.testing import assert_almost_equal ### # Save and Load ### @pytest.fixture(scope="module", autouse=True) def to_hdf_buffer(hdf_file_path, simulation_verysimple): simulation_verysimple.runner.to_hdf(hdf_file_pa...
bsd-3-clause