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
DoWhatILove/turtle
ai/natural language understanding/conceptnet/distinguish_attributes.py
1
4801
''' the paper: Luminoso at SemEval-2018 Task 10: distinguishing attributes using text corpora and relational knowledge. this refers the blog: https://blog.conceptnet.io/posts/2018/distinguishing-attributes-using-conceptnet/ ''' from sklearn.metrics import f1_score import numpy as np import pandas as pd def text_to_ur...
mit
andaag/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
267
6813
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # Licence: BSD 3 clause from nose.tools import raises from nose.tools import assert_true import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process ...
bsd-3-clause
nicjhan/MOM6-examples
tools/analysis/MOM6_annual_analysis.py
6
4961
# Script to plot sub-surface ocean temperature drift. # Analysis: using newer python 2.7.3 """ module purge module use -a /home/fms/local/modulefiles module load gcc module load netcdf/4.2 module load python/2.7.3 """ import os import math import numpy as np from numpy import ma from netCDF4 import Dataset, MFDatase...
gpl-3.0
magne-max/zipline-ja
zipline/utils/calendars/us_holidays.py
6
4015
from pandas import ( Timestamp, DateOffset, date_range, ) from pandas.tseries.holiday import ( Holiday, sunday_to_monday, nearest_workday, ) from dateutil.relativedelta import ( MO, TH ) from pandas.tseries.offsets import Day from zipline.utils.calendars.trading_calendar import ( ...
apache-2.0
yeasy/lazyctrl
others/lc_sim/src/topo.py
1
5742
#!/usr/bin/python '''The Topology module for the HC project. @version: 1.0 @author: U{Baohua Yang<mailto:yangbaohua@gmail.com>} @created: Oct 12, 2011 @last update: Oct 22, 2011 @see: U{<https://github.com/yeasy/lazyctrl>} @TODO: nothing ''' import networkx as nx import os.path, sys from matplotlib import pyplot as plt...
apache-2.0
BitTiger-MP/DS502-AI-Engineer
DS502-1702/Homework/week2_homework_solution.py
1
2319
# coding=utf-8 import numpy as np from scipy import stats import matplotlib.pyplot as plt # # 构造训练数据 x = np.arange(0., 10., 0.2) m = len(x) # 训练数据点数目 x0 = np.full(m, 1.0) input_data = np.vstack([x0, x]).T # 将偏置b作为权向量的第一个分量 target_data = 2 * x + 5 + np.random.randn(m) # 定义batch size batch_size = 10 # 两种终止条件 loop_max...
apache-2.0
chrsrds/scikit-learn
benchmarks/bench_text_vectorizers.py
15
2047
""" To run this benchmark, you will need, * scikit-learn * pandas * memory_profiler * psutil (optional, but recommended) """ import timeit import itertools import numpy as np import pandas as pd from memory_profiler import memory_usage from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extrac...
bsd-3-clause
ricket1978/ggplot
ggplot/geoms/geom_line.py
12
1405
from __future__ import (absolute_import, division, print_function, unicode_literals) import sys from .geom import geom class geom_line(geom): DEFAULT_AES = {'color': 'black', 'alpha': None, 'linetype': 'solid', 'size': 1.0} REQUIRED_AES = {'x', 'y'} DEFAULT_PARAMS = {'stat': 'ident...
bsd-2-clause
vikhyat/dask
dask/dataframe/tests/test_dataframe.py
1
90686
from itertools import product from datetime import datetime from operator import getitem from distutils.version import LooseVersion import pandas as pd import pandas.util.testing as tm import numpy as np import pytest from numpy.testing import assert_array_almost_equal import dask from dask.async import get_sync from...
bsd-3-clause
johannesmik/neurons
MISC/plots/eta.py
2
1132
""" Show plots of the eta function for different """ import numpy as np import matplotlib.pyplot as plt def eta(s, eta_reset, t_membran): ret = np.zeros(s.size) ret = - eta_reset * np.exp(-s/t_membran) ret[s < 0] = 0 ret[s == 0] = 0.9 # Spike return ret def plot_eta(ax, eta_reset, t_membran):...
bsd-2-clause
leesavide/pythonista-docs
Documentation/matplotlib/examples/misc/contour_manual.py
12
1630
""" Example of displaying your own contour lines and polygons using ContourSet. """ import matplotlib.pyplot as plt from matplotlib.contour import ContourSet import matplotlib.cm as cm # Contour lines for each level are a list/tuple of polygons. lines0 = [ [[0,0],[0,4]] ] lines1 = [ [[2,0],[1,2],[1,3]] ] lines2 = [ [[...
apache-2.0
iismd17/scikit-learn
sklearn/utils/estimator_checks.py
21
51976
from __future__ import print_function import types import warnings import sys import traceback import inspect import pickle from copy import deepcopy import numpy as np from scipy import sparse import struct from sklearn.externals.six.moves import zip from sklearn.externals.joblib import hash, Memory from sklearn.ut...
bsd-3-clause
sanketloke/scikit-learn
examples/applications/plot_stock_market.py
76
8522
""" ======================================= Visualizing the stock market structure ======================================= This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote ...
bsd-3-clause
kylerbrown/scikit-learn
sklearn/tests/test_calibration.py
213
12219
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_greater, assert_almost_equal, ...
bsd-3-clause
dbrowneup/PacificBlue
src/PacificBlue.py
1
3661
#!/usr/bin/env python #PacificBlue Genome Scaffolding Tool for PacBio Long Reads # #Written by Dan Browne # #Devarenne Lab #Department of Biochemistry & Biophysics #Texas A&M University #College Station, TX # #Contact: dbrowne.up@gmail.com #Load modules import sys import argparse from datetime import datetime from m...
gpl-3.0
evidation-health/pymc3
pymc3/tests/test_plots.py
13
1721
import matplotlib matplotlib.use('Agg', warn=False) import numpy as np from .checks import close_to import pymc3.plots from pymc3.plots import * from pymc3 import Slice, Metropolis, find_hessian, sample def test_plots(): # Test single trace from pymc3.examples import arbitrary_stochastic as asmod with...
apache-2.0
simpeg/discretize
discretize/utils/code_utils.py
1
7209
import numpy as np import warnings SCALARTYPES = (complex, float, int, np.number) def is_scalar(f): """Determine if the input argument is a scalar. The function **is_scalar** returns *True* if the input is an integer, float or complex number. The function returns *False* otherwise. Parameters -...
mit
amolkahat/pandas
pandas/tests/util/test_testing.py
1
35103
# -*- coding: utf-8 -*- import textwrap import os import pandas as pd import pytest import numpy as np import sys from pandas import Series, DataFrame import pandas.util.testing as tm import pandas.util._test_decorators as td from pandas.util.testing import (assert_almost_equal, raise_with_traceback, ...
bsd-3-clause
rvraghav93/scikit-learn
sklearn/ensemble/gradient_boosting.py
4
76278
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
bsd-3-clause
rishikksh20/scikit-learn
examples/svm/plot_svm_margin.py
88
2540
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= SVM Margins Example ========================================================= The plots below illustrate the effect the parameter `C` has on the separation line. A large value of `C` basically tells our model that w...
bsd-3-clause
nbeaver/numpy
doc/example.py
81
3581
"""This is the docstring for the example.py module. Modules names should have short, all-lowercase names. The module name may have underscores if this improves readability. Every module should have a docstring at the very top of the file. The module's docstring may extend over multiple lines. If your docstring doe...
bsd-3-clause
f2nd/yandex-tank
yandextank/plugins/Console/screen.py
1
40733
# -*- coding: utf-8 -*- """ Classes to build full console screen """ import fcntl import logging import os import struct import termios import time import bisect from collections import defaultdict import pandas as pd from ...common import util def get_terminal_size(): """ Gets width and height of terminal v...
lgpl-2.1
DonBeo/scikit-learn
examples/exercises/plot_cv_digits.py
232
1206
""" ============================================= Cross-validation on Digits Dataset Exercise ============================================= A tutorial exercise using Cross-validation with an SVM on the Digits dataset. This exercise is used in the :ref:`cv_generators_tut` part of the :ref:`model_selection_tut` section...
bsd-3-clause
zmlabe/IceVarFigs
Scripts/SeaIce/plot_sit_PIOMAS_monthly_v2.py
1
8177
""" Author : Zachary M. Labe Date : 23 August 2016 """ from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import numpy as np import datetime import calendar as cal import matplotlib.colors as c import cmocean ### Define constants ### Directory and time directo...
mit
lenovor/scikit-learn
sklearn/datasets/samples_generator.py
45
56433
""" Generate samples of synthetic data sets. """ # Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel, # G. Louppe, J. Nothman # License: BSD 3 clause import numbers import warnings import array import numpy as np from scipy import linalg import scipy.sparse as sp from ..preprocessing impo...
bsd-3-clause
lail3344/sms-tools
lectures/04-STFT/plots-code/windows-2.py
24
1026
import matplotlib.pyplot as plt import numpy as np import time, os, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel as DF import utilFunctions as UF import math (fs, x) = UF.wavread('../../../sounds/violin-B3.wav') N = 1024 pin = 5000 w = np...
agpl-3.0
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/sklearn/linear_model/__init__.py
34
3161
""" The :mod:`sklearn.linear_model` module implements generalized linear models. It includes Ridge regression, Bayesian Regression, Lasso and Elastic Net estimators computed with Least Angle Regression and coordinate descent. It also implements Stochastic Gradient Descent related algorithms. """ # See http://scikit-le...
mit
metaml/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/pyplot.py
69
77521
import sys import matplotlib from matplotlib import _pylab_helpers, interactive from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike from matplotlib.figure import Figure, figaspect from matplotlib.backend_bases import FigureCanvasBase from matplotlib.image import imread as _imread from matplotl...
agpl-3.0
karthikvadla16/spark-tk
regression-tests/sparktkregtests/testcases/dicom/dicom_filter_test.py
13
10428
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #       http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
apache-2.0
larsmans/numpy
numpy/linalg/linalg.py
2
73993
"""Lite version of scipy.linalg. Notes ----- This module is a lite version of the linalg.py module in SciPy which contains high-level Python interface to the LAPACK library. The lite version only accesses the following LAPACK functions: dgesv, zgesv, dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr...
bsd-3-clause
southpaw94/MachineLearning
DimensionalityReduction/pca.py
1
2233
# This script uses the 'primary component analysis' technique to # determine the k dimensions with the most variance of the # original set of d features. import pandas as pd import matplotlib.pyplot as plt from sklearn.cross_validation import train_test_split from sklearn.preprocessing import StandardScaler from n...
gpl-2.0
APMonitor/applications
scheduling_and_control/3products_beginning_application/apm.py
4
26852
# Import import csv import math import os import random import string import time import webbrowser from contextlib import closing import sys # Get Python version ver = sys.version_info[0] #print('Version: '+str(ver)) if ver==2: # Python 2 import urllib else: # Python 3+ import urll...
apache-2.0
nrhine1/scikit-learn
sklearn/learning_curve.py
27
13650
"""Utilities to evaluate models with respect to a variable """ # Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings import numpy as np from .base import is_classifier, clone from .cross_validation import check_cv from .externals.joblib import Parallel, delayed fro...
bsd-3-clause
vermouthmjl/scikit-learn
sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py
65
5529
""" Testing for the gradient boosting loss functions and initial estimators. """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.utils import check_random_state from ...
bsd-3-clause
rabrahm/ceres
vbt/vbtutils.py
1
11062
import sys import matplotlib matplotlib.use("Agg") base = '../' sys.path.append(base+"utils/GLOBALutils") import GLOBALutils import numpy as np import scipy from astropy.io import fits as pyfits import os import glob import scipy.signal from scipy.signal import medfilt from scipy import interpolate import copy from...
mit
doncat99/StockRecommendSystem
Source/FetchData/Fetch_Data_Stock_US_Short.py
1
3659
import os, requests, time, datetime, configparser, warnings from bs4 import BeautifulSoup import pandas as pd from Fetch_Data_Stock_US_Daily import getStocksList import concurrent.futures from tqdm import tqdm def getSignleStockShortInfo(stock): df = pd.DataFrame() url = "http://shortsqueeze.com/?symbol=" + st...
mit
olakiril/pipeline
python/pipeline/utils/quality.py
5
4942
import numpy as np from sklearn.linear_model import TheilSenRegressor from scipy import signal def compute_quantal_size(scan): """ Estimate the unit change in calcium response corresponding to a unit change in pixel intensity (dubbed quantal size, lower is better). Assumes images are stationary from one ...
lgpl-3.0
pkainz/pylearn2
pylearn2/packaged_dependencies/theano_linear/unshared_conv/test_localdot.py
44
5013
from __future__ import print_function import nose import unittest import numpy as np from theano.compat.six.moves import xrange import theano from .localdot import LocalDot from ..test_matrixmul import SymbolicSelfTestMixin class TestLocalDot32x32(unittest.TestCase, SymbolicSelfTestMixin): channels = 3 bs...
bsd-3-clause
NelisVerhoef/scikit-learn
sklearn/tests/test_multiclass.py
136
23649
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing ...
bsd-3-clause
APPIAN-PET/APPIAN
src/utils.py
1
8440
import os import re import gzip import shutil import gzip import subprocess import nibabel as nib import ntpath import pandas as pd import numpy as np import tempfile import nibabel as nib from nipype.interfaces.base import (TraitedSpec, File, traits, InputMultiPath, CommandLine, CommandLineInputSpec, BaseInt...
mit
tracierenea/gnuradio
gr-filter/examples/chirp_channelize.py
58
7169
#!/usr/bin/env python # # Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your ...
gpl-3.0
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/examples/calibration/plot_compare_calibration.py
1
5011
""" ======================================== Comparison of Calibration of Classifiers ======================================== Well calibrated classifiers are probabilistic classifiers for which the output of the predict_proba method can be directly interpreted as a confidence level. For instance a well calibrated (bi...
mit
hsiaoyi0504/scikit-learn
examples/plot_multilabel.py
87
4279
# Authors: Vlad Niculae, Mathieu Blondel # License: BSD 3 clause """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the number of labels: n ...
bsd-3-clause
xiaoxiamii/scikit-learn
sklearn/feature_selection/variance_threshold.py
238
2594
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: 3-clause BSD import numpy as np from ..base import BaseEstimator from .base import SelectorMixin from ..utils import check_array from ..utils.sparsefuncs import mean_variance_axis from ..utils.validation import check_is_fitted class VarianceThreshold(BaseEstim...
bsd-3-clause
fxb22/BioGUI
plugins/Views/GEViewPlugins/HeatMap.py
1
4003
import wx import plotter as mpl import numpy as np import matplotlib.pyplot as plt class Plugin(): def OnSize(self): self.bPSize = self.coverPanel.GetSize() self.plotter.Show(False) self.plotter.SetSize((self.bPSize[1], self.bPSize[1])) self.plotter.SetPosition(((self.bPSize[0]-self...
gpl-2.0
cajohnst/Optimized_FX_Portfolio
fxstreet_google_sheet.py
1
3172
import gspread import pandas as pd from oauth2client.service_account import ServiceAccountCredentials import datetime from datetime import date, timedelta import os import fxstreet_scraper import StringIO import csv import settings as sv on_heroku = False if 'DYNO' in os.environ: on_heroku = True def main(): ...
mit
nealchenzhang/Py4Invst
Backtest_Futures/data.py
1
7656
# -*- coding: utf-8 -*- # data.py from abc import ABCMeta, abstractmethod import datetime import os import numpy as np import pandas as pd from Data.Futures_Data.MongoDB_Futures import df_fromMongoDB from Backtest_Futures.event import MarketEvent class DataHandler(object): """ DataHandler is an abstract b...
mit
hainm/dask
dask/array/tests/test_percentiles.py
8
1486
import pytest pytest.importorskip('numpy') from dask.utils import skip import dask.array as da from dask.array.percentile import _percentile import dask import numpy as np def eq(a, b): if isinstance(a, da.Array): a = a.compute(get=dask.get) if isinstance(b, da.Array): b = b.compute(get=dask....
bsd-3-clause
rs2/pandas
pandas/tests/extension/test_integer.py
2
7327
""" This file contains a minimal set of tests for compliance with the extension array interface test suite, and should contain no other tests. The test suite for the full functionality of the array is located in `pandas/tests/arrays/`. The tests in this file are inherited from the BaseExtensionTests, and only minimal ...
bsd-3-clause
acuzzio/GridQuantumPropagator
Scripts/multiGraphEneDipole.py
1
7791
''' This scripts collects energies and transition dipole matrices from several h5 files and makes graphs. It is a 1D module ''' from argparse import ArgumentParser from collections import namedtuple from itertools import repeat import glob import multiprocessing as mp import numpy as np from quantumpropagator import ...
gpl-3.0
huanzhang12/lightgbm-gpu
tests/python_package_test/test_sklearn.py
3
6123
# coding: utf-8 # pylint: skip-file import unittest import lightgbm as lgb import numpy as np from sklearn.base import clone from sklearn.datasets import (load_boston, load_breast_cancer, load_digits, load_svmlight_file) from sklearn.externals import joblib from sklearn.metrics import log...
mit
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/examples/animation/strip_chart_demo.py
6
1514
""" Emulate an oscilloscope. Requires the animation API introduced in matplotlib 1.0 SVN. """ import matplotlib import numpy as np from matplotlib.lines import Line2D import matplotlib.pyplot as plt import matplotlib.animation as animation class Scope: def __init__(self, ax, maxt=2, dt=0.02): self.ax = ax...
mit
arnabgho/sklearn-theano
sklearn_theano/utils/ports.py
9
5242
import warnings from sklearn.cross_validation import ShuffleSplit from itertools import chain from sklearn.utils import safe_indexing import numpy as np import scipy.sparse as sp # A port of sklearn 0.16 utilities # to avoid validation issues in older sklearn def check_consistent_length(*arrays): """Check that al...
bsd-3-clause
ctralie/TUMTopoTimeSeries2016
Synthetic1DPeriodTests.py
1
3277
from VideoTools import * from TDA import * import os import numpy as np import scipy.io as sio import scipy.interpolate as interp from sklearn.decomposition import PCA def getSlidingWindow(x, dim, Tau, dT): NWindows = int(np.floor((N-dim*Tau)/dT)) X = np.zeros((NWindows, dim)) idx = np.arange(len(x)) f...
apache-2.0
lemonade512/BluebonnetsPointsApp
docs/conf.py
1
8764
# -*- coding: utf-8 -*- # # 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. # # All configuration values have a default; values that are commented out # serve to show the default. import sys # ...
gpl-3.0
tbabej/astropy
astropy/visualization/units.py
2
2941
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np __doctest_skip__ = ['quantity_support'] def quantity_support(format='latex_inline'): """ En...
bsd-3-clause
HolgerPeters/scikit-learn
sklearn/cluster/tests/test_k_means.py
26
32656
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
ishanic/scikit-learn
sklearn/neural_network/tests/test_rbm.py
142
6276
import sys import re import numpy as np from scipy.sparse import csc_matrix, csr_matrix, lil_matrix from sklearn.utils.testing import (assert_almost_equal, assert_array_equal, assert_true) from sklearn.datasets import load_digits from sklearn.externals.six.moves import cStringIO as ...
bsd-3-clause
mjgrav2001/scikit-learn
sklearn/setup.py
225
2856
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
lukeiwanski/tensorflow-opencl
tensorflow/contrib/learn/python/learn/estimators/estimator.py
3
53280
# 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
Ziqi-Li/bknqgis
pandas/pandas/tests/io/msgpack/test_case.py
13
2740
# coding: utf-8 from pandas.io.msgpack import packb, unpackb def check(length, obj): v = packb(obj) assert len(v) == length, \ "%r length should be %r but get %r" % (obj, length, len(v)) assert unpackb(v, use_list=0) == obj def test_1(): for o in [None, True, False, 0, 1, (1 << 6), (1 << 7)...
gpl-2.0
themrmax/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
rexshihaoren/scikit-learn
examples/linear_model/plot_sparse_recovery.py
243
7461
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
nilbody/h2o-3
h2o-py/tests/testdir_algos/gbm/pyunit_DEPRECATED_bernoulli_synthetic_data_mediumGBM.py
1
2622
from builtins import zip import sys, os sys.path.insert(1, os.path.join("..","..","..")) import h2o from tests import pyunit_utils from h2o import H2OFrame import numpy as np import scipy.stats from sklearn import ensemble from sklearn.metrics import roc_auc_score def bernoulli_synthetic_data_gbm_medium(): # Gener...
apache-2.0
jzt5132/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
harisbal/pandas
pandas/core/algorithms.py
3
60557
""" Generic data algorithms. This module is experimental at the moment and not intended for public consumption """ from __future__ import division from warnings import warn, catch_warnings, simplefilter from textwrap import dedent import numpy as np from pandas.core.dtypes.cast import ( maybe_promote, construct_1...
bsd-3-clause
emmaggie/hmmlearn
hmmlearn/tests/test_hmm.py
2
21345
from __future__ import print_function from unittest import TestCase import numpy as np from nose import SkipTest from numpy.testing import assert_array_equal, assert_array_almost_equal from sklearn.datasets.samples_generator import make_spd_matrix from sklearn import mixture from sklearn.utils import check_random_sta...
bsd-3-clause
leggitta/mne-python
examples/time_frequency/plot_source_space_time_frequency.py
19
2314
""" =================================================== Compute induced power in the source space with dSPM =================================================== Returns STC files ie source estimates of induced power for different bands in the source space. The inverse method is linear based on dSPM inverse operator. "...
bsd-3-clause
RPGOne/Skynet
pactools-master/pactools/comodulogram.py
1
34259
import warnings import matplotlib import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d, interp2d from .dar_model.base_dar import BaseDAR from .dar_model.dar import DAR from .dar_model.preprocess import multiple_extract_driver from .utils.progress_bar import ProgressBar from .utils...
bsd-3-clause
buguen/pylayers
pylayers/simul/examples/ex_simulem_fur.py
3
1157
from pylayers.simul.simulem import * from pylayers.signal.bsignal import * from pylayers.measures.mesuwb import * import matplotlib.pyplot as plt from pylayers.gis.layout import * #M=UWBMesure(173) M=UWBMesure(13) #M=UWBMesure(1) cir=TUsignal() cirf=TUsignal() #cir.readcir("where2cir-tx001-rx145.mat","Tx001") #cir...
lgpl-3.0
arnold-jr/sem-classify
semclassify/plots.py
1
4028
import matplotlib import seaborn as sns matplotlib.rcParams['savefig.dpi'] = 2 * matplotlib.rcParams['savefig.dpi'] matplotlib.rc('text', usetex=True) from matplotlib import cm import matplotlib.pyplot as plt from pylab import imshow, show import pandas as pd pd.set_option('expand_frame_repr', False) import numpy as np...
mit
ClimbsRocks/scikit-learn
sklearn/tests/test_multioutput.py
39
6609
import numpy as np import scipy.sparse as sp from sklearn.utils import shuffle from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regex from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing impor...
bsd-3-clause
mprhode/malware-prediction-rnn
main.py
1
1306
import numpy as np import pandas as pd from copy import deepcopy import gc from col_headers import Header from experiments import Experiments, Configs from experiments.useful import timestamped_to_vector, unison_shuffled_copies, extract_neg # Load data headers = Header() c = headers.classification_col v = headers.vec...
apache-2.0
CKehl/pylearn2
pylearn2/scripts/datasets/step_through_small_norb.py
49
3123
#! /usr/bin/env python """ A script for sequentially stepping through SmallNORB, viewing each image and its label. Intended as a demonstration of how to iterate through NORB images, and as a way of testing SmallNORB's StereoViewConverter. If you just want an image viewer, consider pylearn2/scripts/show_binocular_gra...
bsd-3-clause
rwcarlsen/cyclus.github.com
source/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
dsavoiu/kafe2
kafe2/fit/xy/ensemble.py
1
29429
try: import typing # help IDEs with type-hinting inside docstrings except ImportError: pass import numpy as np import scipy.stats import six from .._base import FitEnsembleBase, FitEnsembleException from ..tools.ensemble import EnsembleVariable, EnsembleVariablePlotter from .cost import XYCostFunction_Chi2 fr...
gpl-3.0
BU-PyCon/Meeting-1
Programs/basic_plotting.py
1
1412
#BiMonBUPyCon - First meeting - 3/22/2015 selection = input('Input plot #: ') print(type(selection)) #Basic plotting if selection == '1': #Example 1: Basic importing and plotting procedures #------------------------------------------------------------------------------------- import matplotlib import matplotli...
mit
GuessWhoSamFoo/pandas
pandas/tests/test_lib.py
2
7875
# -*- coding: utf-8 -*- import numpy as np import pytest from pandas._libs import lib, writers as libwriters from pandas import Index import pandas.util.testing as tm class TestMisc(object): def test_max_len_string_array(self): arr = a = np.array(['foo', 'b', np.nan], dtype='object') assert l...
bsd-3-clause
bafnalab/CLEAR
CLEAR.py
1
13998
''' Copyleft Oct 27, 2016 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com ''' import numpy as np; np.set_printoptions(linewidth=200, precision=5, suppress=True) import pandas as pd; pd.options.display.max_rows = 20; pd.options.display.expand_frame_repr = False import pylab as plt import...
mit
avuan/PyMPA37
main.pympa.dir/pympa.py
1
33384
#!/usr/bin/env python # -*- coding: utf-8 -*- # 2016/08/23 Version 34 - parameters24 input file needed # 2017/10/27 Version 39 - Reformatted PEP8 Code # 2017/11/05 Version 40 - Corrections to tdifmin, tstda calculations # 2019/10/15 Version pympa - xcorr substitued with correlate_template from obspy # First Version Au...
gpl-3.0
pierre-chaville/automlk
automlk/graphs.py
1
21305
import logging import numpy as np import pandas as pd import matplotlib matplotlib.use('Agg') import matplotlib.pylab as plt import seaborn.apionly as sns import itertools import pickle from sklearn.preprocessing import LabelEncoder from sklearn.metrics import confusion_matrix from .config import METRIC_NULL from .con...
mit
mne-tools/mne-tools.github.io
dev/_downloads/ceb76325480611dc7a2e973a3b7a782c/20_dipole_fit.py
5
5301
# -*- coding: utf-8 -*- """ ============================================================ Source localization with equivalent current dipole (ECD) fit ============================================================ This shows how to fit a dipole :footcite:`Sarvas1987` using mne-python. For a comparison of fits between MN...
bsd-3-clause
sangwook236/SWDT
sw_dev/python/ext/test/high_performance_computing/spark/pyspark_descriptive_statistics.py
2
4298
#!/usr/bin/env python from pyspark import SparkConf, SparkContext from pyspark.sql import SparkSession, SQLContext import pyspark.sql.types as types import matplotlib.pyplot as plt from bokeh.plotting import figure, show, output_file from bokeh.io import output_notebook import traceback, sys def describe_statistics()...
gpl-3.0
stargaser/astropy
astropy/visualization/wcsaxes/patches.py
4
3408
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from matplotlib.patches import Polygon from astropy import units as u from astropy.coordinates.representation import UnitSphericalRepresentation from astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product __all_...
bsd-3-clause
SU-ECE-17-7/hotspotter
hstest/warp_parallel.py
2
6147
''' There is an issue with cv2.warpAffine on macs. This is a test to further investigate the issue. python -c "import cv2; help(cv2.warpAffine)" ''' from __future__ import division, print_function #import matplotlib #matplotlib.use('Qt4Agg') import os import sys from os.path import dirname, join, expanduser, exists fro...
apache-2.0
JanetMatsen/Machine_Learning_CSE_546
HW3/code/not_updated/ridge_regression.py
2
12001
import numpy as np import pandas as pd import scipy.sparse as sp import scipy.sparse.linalg as splin import time; from classification_base import ClassificationBase class RidgeMulti(ClassificationBase): """ Train multiple ridge models. """ def __init__(self, X, y, lam, W=None, verbose=False, sparse=...
mit
robin-lai/scikit-learn
examples/ensemble/plot_forest_importances.py
241
1761
""" ========================================= Feature importances with forests of trees ========================================= This examples shows the use of forests of trees to evaluate the importance of features on an artificial classification task. The red bars are the feature importances of the forest, along wi...
bsd-3-clause
Nehoroshiy/urnn
examples/lasagne_rnn.py
1
8511
import theano import lasagne import numpy as np import theano.tensor as T from numpy import random as rnd, linalg as la from layers import UnitaryLayer, UnitaryKronLayer, RecurrentUnitaryLayer, ComplexLayer, WTTLayer, ModRelu from matplotlib import pyplot as plt from utils.optimizations import nesterov_momentum, cust...
mit
NeoBoy/STSP_IIUI-Spring2016
Task2/nnet.py
1
11003
# -*- coding: utf-8 -*- """ The goal of this file is to design a class for Neural Networks @author: Sharjeel Abid Butt @References 1. http://ufldl.stanford.edu/wiki/index.php/Backpropagation_Algorithm 2. https://grantbeyleveld.wordpress.com/2015/10/09/implementing-a-artificial-neural-network-in-python/ 3. ...
bsd-2-clause
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/matplotlib/ticker.py
4
63240
""" Tick locating and formatting ============================ This module contains classes to support completely configurable tick locating and formatting. Although the locators know nothing about major or minor ticks, they are used by the Axis class to support major and minor tick locating and formatting. Generic t...
mit
mc-hammertimeseries/cs207project
procs/_corr.py
1
2825
import numpy.fft as nfft import numpy as np import timeseries as ts from scipy.stats import norm from .fft import fft def tsmaker(m, s, j): meta={} meta['order'] = int(np.random.choice([-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5])) meta['blarg'] = int(np.random.choice([1, 2])) t = np.arange(0.0, 1.0, 0.01) ...
mit
Myasuka/scikit-learn
sklearn/preprocessing/data.py
113
56747
# 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> # Eric Martin <eric@ericmart.in> # License: BSD 3 clause from itertools import chain, combina...
bsd-3-clause
alan-unravel/bokeh
bokeh/charts/builder/donut_builder.py
31
8206
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Donut class which lets you build your Donut charts just passing the arguments to the Chart class and calling the proper functions. It also add a new chained stacked method. """ #---------------------...
bsd-3-clause
gnavvy/JellyFish
app.py
1
2566
__author__ = 'ywang' from gevent import monkey monkey.patch_all() from flask import Flask, render_template from flask_socketio import SocketIO, emit # from flask.ext import assets app = Flask(__name__) socketio = SocketIO(app) # import os # env = assets.Environment(app) # env.load_path = [ # os.path.join(os.pat...
mit
shusenl/scikit-learn
examples/manifold/plot_manifold_sphere.py
258
5101
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
bsd-3-clause
aabadie/scikit-learn
examples/ensemble/plot_gradient_boosting_oob.py
82
4768
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
bsd-3-clause
jbrundle/earthquake-forecasts
plot_Forecast_EPS_Region_Circle.py
1
1373
#!/opt/local/bin python ############################################################################## # Code plots Gutenberg-Richter relation for cumulative frequency-magnitude # Usage: python plot_ANSS_seismicity.py NELat NELng SWLat SWLng MagLo # # Where: Latitude in degrees # ...
mit
RPGOne/Skynet
scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/sklearn/tree/tree.py
9
29885
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Da...
bsd-3-clause
robcarver17/pysystemtrade
syscore/dateutils.py
1
20758
""" Various routines to do with dates """ from enum import Enum import datetime import time import calendar import numpy as np import pandas as pd from syscore.genutils import sign from syscore.objects import missing_data """ First some constants """ CALENDAR_DAYS_IN_YEAR = 365.25 BUSINESS_DAYS_IN_YEAR = 256.0 ROO...
gpl-3.0
jeffery-do/Vizdoombot
doom/lib/python3.5/site-packages/matplotlib/tests/test_bbox_tight.py
4
3861
from __future__ import (absolute_import, division, print_function, unicode_literals) from distutils.version import LooseVersion from matplotlib.externals import six from matplotlib.externals.six.moves import xrange import numpy as np from matplotlib import rcParams from matplotlib.testing.dec...
mit