repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
WarrenWeckesser/scipy
scipy/spatial/_spherical_voronoi.py
7
13692
""" Spherical Voronoi Code .. versionadded:: 0.18.0 """ # # Copyright (C) Tyler Reddy, Ross Hemsley, Edd Edmondson, # Nikolai Nowaczyk, Joe Pitt-Francis, 2015. # # Distributed under the same BSD license as SciPy. # import warnings import numpy as np import scipy from . import _voronoi from scipy.spat...
bsd-3-clause
petebachant/MakeWaves
makewaves/wavemakerlimits.py
1
3085
"""This module replicates the logic of the Regular Waves VI to calculate a safe wave height. """ from __future__ import division, print_function, absolute_import import numpy as np import os import sys _thisdir = os.path.dirname(os.path.abspath(__file__)) settings_dir = os.path.join(_thisdir, "settings") max_halfstr...
gpl-3.0
ageron/tensorflow
tensorflow/contrib/learn/__init__.py
18
2695
# 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
LCAV/pyroomacoustics
pyroomacoustics/tests/test_build_rir.py
1
4247
from __future__ import division, print_function import pyroomacoustics as pra import numpy as np try: from pyroomacoustics import build_rir build_rir_available = True except: print('build_rir not available') build_rir_available = False # tolerance for test success (1%) tol = 0.01 fdl = 81 fs = 16000 ...
mit
prashantvyas/cuda-convnet2
convdata.py
174
14675
# Copyright 2014 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...
apache-2.0
depet/scikit-learn
examples/applications/face_recognition.py
12
5368
""" =================================================== Faces recognition example using eigenfaces and SVMs =================================================== The dataset used in this example is a preprocessed excerpt of the "Labeled Faces in the Wild", aka LFW_: http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2...
bsd-3-clause
minrk/oauthenticator
docs/source/conf.py
2
4506
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or module...
bsd-3-clause
mlyundin/scikit-learn
examples/applications/plot_model_complexity_influence.py
323
6372
""" ========================== Model Complexity Influence ========================== Demonstrate how model complexity influences both prediction accuracy and computational performance. The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for regression (resp. classification). For each class of models we m...
bsd-3-clause
yousrabk/mne-python
mne/viz/tests/test_3d.py
4
7511
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # Mainak Jas <mainak@neuro.hut.fi> # Mark Wronkiewicz <wronk.mark@gmail.c...
bsd-3-clause
achim1/HErmes
HErmes/selection/variables.py
2
26753
""" Container classes for variables """ import numpy as np import os import pandas as pd import tables import abc import enum import array import numbers from ..utils import files as f from ..utils import Logger from copy import deepcopy as copy from collections import Sequence from itertools import chain, count DEF...
gpl-2.0
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/pandas/core/nanops.py
7
23743
import itertools import functools import operator import numpy as np from pandas import compat from pandas._libs import tslib, algos, lib from pandas.core.dtypes.common import ( _get_dtype, is_float, is_scalar, is_integer, is_complex, is_float_dtype, is_complex_dtype, is_integer_dtype, is_bool_dtyp...
mit
aabadie/scikit-learn
sklearn/neighbors/classification.py
15
14359
"""Nearest Neighbor Classification""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck # Multi-output support by Arnaud Joly <a.joly@ul...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/sklearn/datasets/tests/test_lfw.py
42
7253
"""This test for the LFW require medium-size data downloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging...
mit
devanshdalal/scikit-learn
sklearn/datasets/tests/test_rcv1.py
322
2414
"""Test the rcv1 loader. Skipped if rcv1 is not already downloaded to data_home. """ import errno import scipy.sparse as sp import numpy as np from sklearn.datasets import fetch_rcv1 from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing i...
bsd-3-clause
treycausey/scikit-learn
examples/plot_precision_recall.py
3
6114
""" ================ 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
elenbert/allsky
src/webdatagen/sensors-graphgen.py
1
13361
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import csv import MySQLdb import sys import config def plot_sky_temp(sensor_data, output_file, output_csv_file, one_day=False): xdata = [] ydata = [] print 'Plotting skytemp graph using ' + str(len(sensor_data...
gpl-2.0
q1ang/scikit-learn
examples/linear_model/plot_robust_fit.py
238
2414
""" Robust linear estimator fitting =============================== Here a sine function is fit with a polynomial of order 3, for values close to zero. Robust fitting is demoed in different situations: - No measurement errors, only modelling errors (fitting a sine with a polynomial) - Measurement errors in X - M...
bsd-3-clause
mattgiguere/scikit-learn
examples/gaussian_process/plot_gp_regression.py
253
4054
#!/usr/bin/python # -*- coding: utf-8 -*- r""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression exercise computed in two different ways: 1. A noise-free cas...
bsd-3-clause
porterdf/porterdf.github.io
markdown_generator/publications.py
197
3887
# coding: utf-8 # # Publications markdown generator for academicpages # # Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook, with the core python code in publications.py. Run either from the `markdown_g...
mit
datapythonista/pandas
pandas/core/arrays/timedeltas.py
1
36958
from __future__ import annotations from datetime import timedelta from typing import TYPE_CHECKING import numpy as np from pandas._libs import ( lib, tslibs, ) from pandas._libs.arrays import NDArrayBacked from pandas._libs.tslibs import ( BaseOffset, NaT, NaTType, Period, Tick, Timed...
bsd-3-clause
phobson/statsmodels
statsmodels/tsa/ar_model.py
1
33913
from __future__ import division from statsmodels.compat.python import iteritems, range, string_types, lmap, long import numpy as np from numpy import dot, identity from numpy.linalg import inv, slogdet from scipy.stats import norm from statsmodels.regression.linear_model import OLS from statsmodels.tsa.tsatools import...
bsd-3-clause
icdishb/scikit-learn
examples/svm/plot_custom_kernel.py
115
1546
""" ====================== SVM with custom kernel ====================== Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface and the support vectors. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets # import some data...
bsd-3-clause
ChanChiChoi/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
frank-tancf/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
85
5728
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
Bollegala/MLIB
utils/genArtificialData.py
1
4811
''' Created on Aug 5, 2011 @author: danu ''' from matplotlib import pyplot as plt import numpy as np def twoGaussians(n): """ Generates 2d n data points from two Gaussians. Returns an array of 2D vectors corresponding to the data points and a 1d array indicating the true labels of those data points. """ flag ...
bsd-3-clause
neilpanchal/iPython-Notebook-Profile
profile_neil/ipython_notebook_config.py
1
19985
# Configuration file for ipython-notebook. c = get_config() #------------------------------------------------------------------------------ # NotebookApp configuration #------------------------------------------------------------------------------ # NotebookApp will inherit config from: BaseIPythonApplication, Appli...
mit
Alan-Robertson/python-qinfer
src/qinfer/examples/rebit_plotting_example.py
1
12182
#!/usr/bin/python # -*- coding: utf-8 -*- ## # rebit_plotting_example.py: rebit tomography illustration module ## # © 2013 Chris Ferrie (csferrie@gmail.com) and # Christopher E. Granade (cgranade@gmail.com) # # This file is a part of the Qinfer project. # Licensed under the AGPL version 3. ## # This program...
agpl-3.0
ryfeus/lambda-packs
LightGBM_sklearn_scipy_numpy/source/sklearn/exceptions.py
50
5276
""" The :mod:`sklearn.exceptions` module includes all custom warnings and error classes used across scikit-learn. """ __all__ = ['NotFittedError', 'ChangedBehaviorWarning', 'ConvergenceWarning', 'DataConversionWarning', 'DataDimensionalityWarning', 'EfficiencyWarn...
mit
ishanic/scikit-learn
examples/cluster/plot_ward_structured_vs_unstructured.py
320
3369
""" =========================================================== Hierarchical clustering: structured vs unstructured ward =========================================================== Example builds a swiss roll dataset and runs hierarchical clustering on their position. For more information, see :ref:`hierarchical_clus...
bsd-3-clause
pjryan126/solid-start-careers
store/api/zillow/venv/lib/python2.7/site-packages/numpy/lib/twodim_base.py
26
26904
""" Basic functions for manipulating 2d arrays """ from __future__ import division, absolute_import, print_function from numpy.core.numeric import ( asanyarray, arange, zeros, greater_equal, multiply, ones, asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal, ) from numpy.core import...
gpl-2.0
mantidproject/mantid
qt/python/mantidqt/widgets/plotconfigdialog/test/test_plotconfigdialogpresenter.py
3
12339
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2019 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # T...
gpl-3.0
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/pandas/io/tests/json/test_pandas.py
7
42394
# pylint: disable-msg=W0612,E1101 import nose from pandas.compat import range, lrange, StringIO, OrderedDict import os import numpy as np from pandas import (Series, DataFrame, DatetimeIndex, Timestamp, read_json, compat) from datetime import timedelta import pandas as pd from pandas.util.testing ...
gpl-3.0
nborggren/zipline
zipline/pipeline/loaders/blaze/earnings.py
2
4491
from datashape import istabular import pandas as pd from toolz import valmap from .core import ( TS_FIELD_NAME, SID_FIELD_NAME, bind_expression_to_resources, ffill_query_in_range, ) from zipline.pipeline.data import EarningsCalendar from zipline.pipeline.loaders.base import PipelineLoader from zipline....
apache-2.0
camptocamp/QGIS
python/plugins/processing/algs/BarPlot.py
1
2901
# -*- coding: utf-8 -*- """ *************************************************************************** BarPlot.py --------------------- Date : January 2013 Copyright : (C) 2013 by Victor Olaya Email : volayaf at gmail dot com ******************************...
gpl-2.0
MostafaGazar/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/transforms/in_memory_source.py
4
6151
# 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
harshaneelhg/scikit-learn
sklearn/tests/test_dummy.py
129
17774
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.base import clone 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.testing import assert_almost_eq...
bsd-3-clause
stanmoore1/lammps
examples/SPIN/test_problems/validation_damped_exchange/plot_precession.py
9
1111
#!/usr/bin/env python3 import numpy as np, pylab, tkinter import matplotlib.pyplot as plt from scipy.optimize import curve_fit from decimal import * import sys, string, os argv = sys.argv if len(argv) != 3: print("Syntax: ./plot_precession.py res_lammps.dat res_llg.dat") sys.exit() lammps_file = sys.argv[1] llg...
gpl-2.0
rhyolight/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/colors.py
69
31676
""" A module for converting numbers or color arguments to *RGB* or *RGBA* *RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the range 0-1. This module includes functions and classes for color specification conversions, and for mapping numbers to colors in a 1-D array of colors called a colormap. Color...
agpl-3.0
marcocaccin/scikit-learn
examples/plot_isotonic_regression.py
303
1767
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
bsd-3-clause
kmather73/content
labs/lab2/cs109style.py
38
1293
from __future__ import print_function from IPython.core.display import HTML from matplotlib import rcParams #colorbrewer2 Dark2 qualitative color table dark2_colors = [(0.10588235294117647, 0.6196078431372549, 0.4666666666666667), (0.8509803921568627, 0.37254901960784315, 0.00784313725490196), ...
mit
ChanChiChoi/scikit-learn
examples/manifold/plot_mds.py
261
2616
""" ========================= Multi-dimensional scaling ========================= An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. """ # Author: Nelle Varoquaux <nelle.varoquaux@gmail....
bsd-3-clause
jpautom/scikit-learn
examples/neighbors/plot_species_kde.py
282
4059
""" ================================================ Kernel Density Estimate of Species Distributions ================================================ This shows an example of a neighbors-based query (in particular a kernel density estimate) on geospatial data, using a Ball Tree built upon the Haversine distance metric...
bsd-3-clause
flyingbanana1024102/transmission-line-simulator
src/views/sourceeditor.py
1
5620
# # Transmission Line Simulator # # Author(s): Jiacong Xu # Created: Jul-14-2017 # from popupeditor import PopupEditor from kivy.properties import * from materialbutton import MaterialButton from util.constants import * from kivy.animation import Animation from models.powersource import * from kivy.metrics import * i...
mit
dtiarks/ThesisPlot
Chap5/Giovanni/post_selected/giovanni.py
1
8588
import numpy as np from matplotlib import pyplot as plt from datetime import datetime import re from scipy.optimize import curve_fit from matplotlib import rc #curve=np.loadtxt("curve.tsv") histoLst=[] histoPostLst=[] histoRefLst=[] xLst=np.arange(-8,-12.5,-1) #print xLst name="ref001" nameRef="ref001" ##for n in ...
mit
FRESNA/PyPSA
pypsa/pf.py
1
51617
## Copyright 2015-2018 Tom Brown (FIAS), Jonas Hoersch (FIAS) ## 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 3 of the ## License, or (at your option) any later version. ## T...
gpl-3.0
hannorein/rebound
python_examples/megno/problem.py
1
3476
#!/usr/bin/python # This example integrates Jupiter and Saturn in the Solar system for a variety of initial conditions. # Alongside the normal equations of motions, IAS15 is used to integrate the variational equations. # These can be used to measure the Mean Exponential Growth of Nearby Orbits (MEGNO), a chaos indicato...
gpl-3.0
evanbiederstedt/RRBSfun
epiphen/cll_tests/total_CLL_chr04.py
1
8306
import glob import pandas as pd import numpy as np pd.set_option('display.max_columns', 50) # print all rows import os os.chdir("/gpfs/commons/home/biederstedte-934/evan_projects/correct_phylo_files") cw154 = glob.glob("binary_position_RRBS_cw154*") trito = glob.glob("binary_position_RRBS_trito_pool*") print(le...
mit
macks22/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
85
8565
import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises...
bsd-3-clause
wlamond/scikit-learn
examples/calibration/plot_calibration_multiclass.py
95
6971
""" ================================================== Probability Calibration for 3-class classification ================================================== This example illustrates how sigmoid calibration changes predicted probabilities for a 3-class classification problem. Illustrated is the standard 2-simplex, wher...
bsd-3-clause
ClimbsRocks/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
168
2088
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
bsd-3-clause
aspiringfastlaner/spx_options_backtesting
Python Code/black_scholes.py
1
1821
# Importing modules import smtplib import pandas as pd import datetime as dt import pandas.stats.moments as st import matplotlib.pyplot as plt import os import quandl as qd import seaborn as sns from scipy.stats import norm from math import * import matplotlib.animation as animation import matplotlib.pyplot as plt impo...
apache-2.0
Capstone2017/Machine-Learning-NLP
notebook/2nd_RNN.py
1
3452
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 8 23:07:21 2016 @author: Yu Zhipeng """ from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility from keras.preprocessing import sequence from keras.utils import np_utils from keras.models import Sequen...
mit
bdh1011/wau
venv/lib/python2.7/site-packages/pandas/tests/test_expressions.py
4
16414
# -*- coding: utf-8 -*- from __future__ import print_function # pylint: disable-msg=W0612,E1101 import nose import re from numpy.random import randn import operator import numpy as np from numpy.testing import assert_array_equal from pandas.core.api import DataFrame, Panel from pandas.computation import expressions...
mit
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/doc/mpl_toolkits/axes_grid/figures/demo_colorbar_of_inset_axes.py
5
1150
import matplotlib.pyplot as plt from mpl_toolkits.axes_grid.inset_locator import inset_axes, zoomed_inset_axes from mpl_toolkits.axes_grid.colorbar import colorbar def get_demo_image(): from matplotlib.cbook import get_sample_data import numpy as np f = get_sample_data("axes_grid/bivariate_normal.npy", as...
gpl-2.0
mhue/scikit-learn
examples/cluster/plot_mean_shift.py
351
1793
""" ============================================= A demo of the mean-shift clustering algorithm ============================================= Reference: Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward feature space analysis". IEEE Transactions on Pattern Analysis and Machine Intelligence. 2002. ...
bsd-3-clause
stuart-knock/bokeh
bokeh/charts/builder/step_builder.py
43
5445
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Step class which lets you build your Step charts just passing the arguments to the Chart class and calling the proper functions. """ #-----------------------------------------------------------------...
bsd-3-clause
jdmcbr/geopandas
geopandas/io/tests/generate_legacy_storage_files.py
2
2736
""" Script to create the data and write legacy storage (pickle) files. Based on pandas' generate_legacy_storage_files.py script. To use this script, create an environment for which you want to generate pickles, activate the environment, and run this script as: $ python geopandas/geopandas/io/tests/generate_legacy_st...
bsd-3-clause
vybstat/scikit-learn
sklearn/datasets/__init__.py
176
3671
""" The :mod:`sklearn.datasets` module includes utilities to load datasets, including methods to load and fetch popular reference datasets. It also features some artificial data generators. """ from .base import load_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
bsd-3-clause
ndingwall/scikit-learn
sklearn/datasets/tests/test_openml.py
5
51973
"""Test the openml loader. """ import gzip import json import numpy as np import os import re import scipy.sparse import sklearn import pytest from sklearn import config_context from sklearn.datasets import fetch_openml from sklearn.datasets._openml import (_open_openml_url, _arff...
bsd-3-clause
khkaminska/scikit-learn
examples/calibration/plot_calibration_curve.py
225
5903
""" ============================== Probability Calibration curves ============================== When performing classification one often wants to predict not only the class label, but also the associated probability. This probability gives some kind of confidence on the prediction. This example demonstrates how to di...
bsd-3-clause
petebachant/seaborn
seaborn/tests/test_utils.py
11
11537
"""Tests for plotting utilities.""" import warnings import tempfile import shutil import numpy as np import pandas as pd import matplotlib.pyplot as plt import nose import nose.tools as nt from nose.tools import assert_equal, raises import numpy.testing as npt import pandas.util.testing as pdt from distutils.version ...
bsd-3-clause
intel-analytics/analytics-zoo
pyzoo/zoo/orca/learn/tf2/estimator.py
1
21473
# # Copyright 2018 Analytics Zoo Authors. # # 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...
apache-2.0
datapythonista/pandas
pandas/tests/frame/methods/test_count.py
3
1081
from pandas import ( DataFrame, Series, ) import pandas._testing as tm class TestDataFrameCount: def test_count(self): # corner case frame = DataFrame() ct1 = frame.count(1) assert isinstance(ct1, Series) ct2 = frame.count(0) assert isinstance(ct2, Series) ...
bsd-3-clause
lujunyan1118/SimpleBool
BoolSimu.py
1
14680
#!/bin/env python ''' SimpleBool is a python package for dynamic simulations of boolean network Copyright (C) 2013 Junyan Lu 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, eithe...
gpl-3.0
alphaBenj/zipline
tests/test_algorithm.py
1
175570
# # Copyright 2014 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
altairpearl/scikit-learn
sklearn/tree/export.py
12
16020
""" This module defines export functions for decision trees. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Dawe <noel@dawe.me> # Satrajit Gosh <satrajit.ghosh@gmail.com> # Trevor...
bsd-3-clause
daniaki/Enrich2
enrich2/base/utils.py
1
8780
# Copyright 2016-2017 Alan F Rubin, Daniel C Esposito # # This file is part of Enrich2. # # Enrich2 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 your option) ...
gpl-3.0
wzbozon/statsmodels
statsmodels/sandbox/examples/try_quantile_regression1.py
33
1188
'''Example to illustrate Quantile Regression Author: Josef Perktold polynomial regression with systematic deviations above ''' import numpy as np from statsmodels.compat.python import zip from scipy import stats import statsmodels.api as sm from statsmodels.regression.quantile_regression import QuantReg sige = 0....
bsd-3-clause
mattcaldwell/zipline
tests/test_history.py
2
36566
# # Copyright 2014 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
bitemyapp/ggplot
ggplot/stats/stat_bar.py
12
1322
from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas as pd from .stat import stat _MSG_LABELS = """There are more than 30 unique values mapped to x. If you want a histogram instead, use 'geom_histogram()'. """ class stat_bar(stat): REQUIRE...
bsd-2-clause
a4a881d4/6FSK
modu.py
1
1695
import const import freqTab import math import numpy as np import utils import matplotlib.pyplot as plt def dpmap(D,P): r = [] p = 1 for k in range(len(D)): r.append((D[k]*const.DataA+P[k]*const.PilotA*1j)*p) p = p * 1j return r def toFreq(D,P): m = dpmap(D,P) p = [const.constellationIndex[c] for c in m] r...
gpl-3.0
sahat/bokeh
bokeh/tests/test_protocol.py
4
3772
import unittest from unittest import skipIf import numpy as np from .test_utils import skipIfPyPy try: import pandas as pd is_pandas = True except ImportError as e: is_pandas = False class TestBokehJSONEncoder(unittest.TestCase): def setUp(self): from bokeh.protocol import BokehJSONEncoder...
bsd-3-clause
auDeep/auDeep
audeep/backend/parsers/compare19_sd.py
1
4730
# Copyright (C) 2017-2019 Michael Freitag, Shahin Amiriparian, Sergey Pugachevskiy, Nicholas Cummins, Björn Schuller # # This file is part of auDeep. # # auDeep 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, ...
gpl-3.0
jakobworldpeace/scikit-learn
examples/ensemble/plot_voting_decision_regions.py
86
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
IndraVikas/scikit-learn
sklearn/metrics/ranking.py
75
25426
"""Metrics to assess performance on classification task given scores Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria....
bsd-3-clause
MatthieuBizien/scikit-learn
sklearn/gaussian_process/tests/test_kernels.py
6
11602
"""Testing for kernels for Gaussian processes.""" # Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # License: BSD 3 clause from collections import Hashable from sklearn.externals.funcsigs import signature import numpy as np from sklearn.gaussian_process.kernels import _approx_fprime from sklearn.metrics...
bsd-3-clause
montoyjh/pymatgen
pymatgen/phonon/tests/test_plotter.py
3
3658
import unittest import os import json import scipy from io import open from pymatgen.phonon.dos import CompletePhononDos from pymatgen.phonon.plotter import PhononDosPlotter, PhononBSPlotter, ThermoPlotter from pymatgen.phonon.bandstructure import PhononBandStructureSymmLine test_dir = os.path.join(os.path.dirname(...
mit
yagmursato/RobotOrHuman
mainn.py
1
1464
import pandas import numpy as np from pandas import DataFrame from sklearn.cross_validation import train_test_split from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.naive_bayes import MultinomialNB deneme = [] human = [] with open("human.txt","r") as f: for line in f: ...
apache-2.0
RBDA-F17/crime
code_drop_2/filter_clean_taxi.py
1
3471
import os import sys import pandas as pd from pyspark.sql.types import * from pyspark.sql import Row, Column from pyspark.sql.functions import * from datetime import datetime from pyspark import SparkConf, SparkContext from pyspark.sql import SQLContext from pyspark.sql.functions import udf user = os. environ['USER'] ...
gpl-3.0
maheshakya/scikit-learn
examples/applications/plot_prediction_latency.py
25
11317
""" ================== 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
hlin117/scikit-learn
examples/hetero_feature_union.py
81
6241
""" ============================================= Feature Union with Heterogeneous Data Sources ============================================= Datasets can often contain components of that require different feature extraction and processing pipelines. This scenario might occur when: 1. Your dataset consists of hetero...
bsd-3-clause
cactusbin/nyt
matplotlib/lib/matplotlib/contour.py
4
66434
""" These are classes to support contour plotting and labelling for the axes class """ from __future__ import division, print_function import warnings import matplotlib as mpl import numpy as np from numpy import ma import matplotlib._cntr as _cntr import matplotlib.path as mpath import matplotlib.ticker as ticker imp...
unlicense
lpenguin/pandas-qt
pandasqt/models/DataFrameModel.py
3
21416
# -*- coding: utf-8 -*- """Easy integration of DataFrame into pyqt framework @author: Jev Kuznetsov, Matthias Ludwig - Datalyze Solutions """ from datetime import datetime from pandasqt.compat import Qt, QtCore, QtGui, Slot, Signal import pandas import numpy import parser import re from pandasqt.models.ColumnDty...
mit
Erotemic/ibeis
ibeis/main_module.py
1
21403
# -*- coding: utf-8 -*- """ This module defines the entry point into the IBEIS system ibeis.opendb and ibeis.main are the main entry points """ from __future__ import absolute_import, division, print_function #from six.moves import builtins import sys import multiprocessing #try: import utool as ut profile = ut.profil...
apache-2.0
phdowling/scikit-learn
sklearn/ensemble/tests/test_gradient_boosting.py
127
37672
""" Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting). """ import warnings import numpy as np from sklearn import datasets from sklearn.base import clone from sklearn.ensemble import GradientBoostingClassifier from sklearn.ensemble import GradientBoostingRegressor from sklearn.ensemble.grad...
bsd-3-clause
mattilyra/scikit-learn
sklearn/utils/tests/test_random.py
85
7349
from __future__ import division import numpy as np import scipy.sparse as sp from scipy.misc import comb as combinations from numpy.testing import assert_array_almost_equal from sklearn.utils.random import sample_without_replacement from sklearn.utils.random import random_choice_csc from sklearn.utils.testing import ...
bsd-3-clause
JingheZ/shogun
applications/easysvm/tutpaper/svm_params.py
26
12935
#from matplotlib import rc #rc('text', usetex=True) fontsize = 16 contourFontsize = 12 showColorbar = False xmin = -1 xmax = 1 ymin = -1.05 ymax = 1 import sys,os import numpy import shogun from shogun.Kernel import GaussianKernel, LinearKernel, PolyKernel from shogun.Features import RealFeatures, BinaryLabels from...
gpl-3.0
MaxNoe/pyhexgrid
hexgrid/utils.py
1
2136
import numpy as np import pandas as pd from .hexpoints import HexPoints DIRECTIONS = { orientation: HexPoints.from_points([ (1, -1, 0), (1, 0, -1), (0, 1, -1), (-1, 1, 0), (-1, 0, 1), (0, -1, 1) ], orientation=orientation) for orientation in ('flat_top', 'po...
mit
Ffisegydd/python-examples
examples/scipy/using odr to fit data with errors.py
1
1301
'''Use ODR to fit a quadratic function to data with errors in both x and y.''' import numpy as np import matplotlib.pyplot as plt from scipy.odr import * import random # Initiate some data, giving some randomness using random.random(). x = np.array([0, 1, 2, 3, 4, 5]) y = np.array([i**2 + random.random() for i in...
mit
dungvtdev/upsbayescpm
bayespy/inference/vmp/nodes/GaussianProcesses.py
5
25953
################################################################################ # Copyright (C) 2011-2012 Jaakko Luttinen # # This file is licensed under the MIT License. ################################################################################ import itertools import numpy as np #import scipy as sp #import s...
mit
nmayorov/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
103
22297
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
openego/ego.io
egoio/db_tables/model_draft.py
1
302053
# coding: utf-8 from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, CheckConstraint, Column, Date, DateTime, Float, ForeignKey, ForeignKeyConstraint, Index, Integer, JSON, Numeric, SmallInteger, String, Table, Text, UniqueConstraint, text from geoalchemy2.types import Geometry, Raster from sqlalchemy.dialects.post...
agpl-3.0
phobson/statsmodels
statsmodels/datasets/statecrime/data.py
3
3141
#! /usr/bin/env python """Statewide Crime Data""" __docformat__ = 'restructuredtext' COPYRIGHT = """Public domain.""" TITLE = """Statewide Crime Data 2009""" SOURCE = """ All data is for 2009 and was obtained from the American Statistical Abstracts except as indicated below. """ DESCRSHORT = """State ...
bsd-3-clause
minesense/VisTrails
scripts/dist/windows/Input/startup.py
2
7926
############################################################################### ## ## Copyright (C) 2014-2016, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## ...
bsd-3-clause
tosolveit/scikit-learn
sklearn/__check_build/__init__.py
345
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
djgagne/scikit-learn
sklearn/tree/tests/test_tree.py
11
47506
""" 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
liyu1990/sklearn
sklearn/cluster/birch.py
22
22730
# 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
Newman101/scipy
scipy/integrate/quadrature.py
33
28087
from __future__ import division, print_function, absolute_import import numpy as np import math import warnings # trapz is a public function for scipy.integrate, # even though it's actually a numpy function. from numpy import trapz from scipy.special.orthogonal import p_roots from scipy.special import gammaln from sc...
bsd-3-clause
f3r/scikit-learn
sklearn/datasets/twenty_newsgroups.py
35
13626
"""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
UCSD-CCAL/ccal
ccal/correlate.py
1
1960
from numpy import full, nan from numpy.random import seed, shuffle from sklearn.linear_model import LinearRegression from .COLOR_CATEGORICAL import COLOR_CATEGORICAL from .compute_empirical_p_value import compute_empirical_p_value from .plot_points import plot_points def correlate( x, y, n_permutation=0,...
mit