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
jdmcbr/blaze
blaze/compute/tests/test_bcolz_compute.py
9
5874
from __future__ import absolute_import, division, print_function import pytest bcolz = pytest.importorskip('bcolz') from datashape import discover, dshape import numpy as np import pandas.util.testing as tm from odo import into from blaze import by from blaze.expr import symbol from blaze.compute.core import compu...
bsd-3-clause
Garrett-R/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
40
7535
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
bobrock/eden
controllers/msg.py
3
80604
# -*- coding: utf-8 -*- """ Messaging Module - Controllers """ module = request.controller resourcename = request.function if not settings.has_module(module): raise HTTP(404, body="Module disabled: %s" % module) # ----------------------------------------------------------------------------- def index(): ...
mit
diegocavalca/Studies
phd-thesis/nilmtk/nilmtk/tests/test_elecmeter.py
7
3716
#!/usr/bin/python from __future__ import print_function, division import unittest from os.path import join import pandas as pd from datetime import timedelta from .testingtools import data_dir, WarningTestMixin from ..datastore import HDFDataStore from ..elecmeter import ElecMeter, ElecMeterID from ..stats.tests.test_t...
cc0-1.0
zfrenchee/pandas
pandas/core/sparse/frame.py
1
35133
""" Data structures for sparse float data. Life is made simpler by dealing only with float64 data """ from __future__ import division # pylint: disable=E1101,E1103,W0231,E0202 import warnings from pandas.compat import lmap from pandas import compat import numpy as np from pandas.core.dtypes.missing import isna, notna...
bsd-3-clause
weissj3/MWTools
SGRBHB/RADECCUTSParabolas.py
1
9103
import sys sys.path.insert(0, '../Newby-tools/utilities') import math as ma import matplotlib.pyplot as plt import astro_coordinates as ac import operator def Create_Line(x0, x1, y0, y1): m = (y1 - y0)/(x1 - x0) b = y1 - m * x1 return m,b def ParabolaParams(x1, y1, x2, y2, x3, y3): a = (x3*(y2-y1) + ...
mit
ZhouJiaLinmumu/Grasp-and-lift-EEG-challenge
lvl1/genPreds_RNN.py
4
6756
# -*- coding: utf-8 -*- """ Created on Wed Jul 8 21:56:55 2015. @author: rc, alex """ import os import sys if __name__ == '__main__' and __package__ is None: filePath = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(filePath) import pandas as pd import numpy as np import yaml fro...
bsd-3-clause
CristianCantoro/thes-discover
utils/graph.py
1
2630
#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################### # Copyright (C) 2012 Cristian Consonni <cristian.consonni@gmail.com>. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License a...
mit
leaxp/mdl
LeNet/train_lenet.py
1
2033
# append the package folder to sys.path import sys sys.path.append("core") # import the necessary packages from core import LeNet from sklearn.cross_validation import train_test_split from sklearn.datasets.mldata import fetch_mldata from keras.optimizers import SGD from keras.utils import np_utils import numpy as np ...
gpl-3.0
LCAV/pyroomacoustics
examples/adaptive_filter_stft_domain.py
1
2975
''' Adaptive Filter in STFT Domain Example ====================================== In this example, we will run adaptive filters for system identification, but in the frequeny domain. ''' from __future__ import division, print_function import numpy as np from scipy.signal import fftconvolve import matplotlib.pyplot a...
mit
puruckertom/ubertool
ubertool/kabam/tests/test_kabam_integration.py
1
58707
from __future__ import division #brings in Python 3.0 mixed type calculation rules import datetime import inspect import numpy.testing as npt import os.path import pandas as pd import pkgutil import sys from tabulate import tabulate import unittest try: from StringIO import StringIO except ImportError: from io...
unlicense
ZENGXH/scikit-learn
examples/linear_model/plot_theilsen.py
232
3615
""" ==================== Theil-Sen Regression ==================== Computes a Theil-Sen Regression on a synthetic dataset. See :ref:`theil_sen_regression` for more information on the regressor. Compared to the OLS (ordinary least squares) estimator, the Theil-Sen estimator is robust against outliers. It has a breakd...
bsd-3-clause
agiliq/django-graphos
graphos/renderers/matplotlib_renderer.py
1
1757
#Named such to not clash with matplotlib from .base import BaseChart import matplotlib matplotlib.use('Agg') # http://stackoverflow.com/a/4706614/202168 import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter try: # python 2 from StringIO import StringIO except ImportError: # pyt...
bsd-2-clause
hlin117/scikit-learn
sklearn/setup.py
69
3201
import os from os.path import join import warnings from sklearn._build_utils import maybe_cythonize_extensions 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 lib...
bsd-3-clause
Xeralux/tensorflow
tensorflow/python/estimator/canned/dnn_linear_combined_test.py
11
33691
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
edonyM/emthesis
code/pca.py
1
3616
#!/usr/bin/env python3 # -*- coding: utf-8 -*- r""" # .---. .----------- # / \ __ / ------ # / / \( )/ ----- (`-') _ _(`-') <-. (`-')_ # ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .-> # //// / // : : --- (,------...
mit
SnowWalkerJ/quantlib
quant/common/decorators.py
1
4754
import os from inspect import signature from types import FunctionType from functools import wraps, singledispatch, update_wrapper import pandas as pd from tables.exceptions import HDF5ExtError from ..common.settings import DATA_PATH from ..common.logging import Logger class Localizer: """ 把DataFrame缓存到本地hdf5...
gpl-3.0
fenech/aubio
python/demos/demo_keyboard.py
14
2095
#! /usr/bin/env python def get_keyboard_edges(firstnote = 21, lastnote = 108): octaves = 10 # build template of white notes scalew = 12/7. xw_temp = [i*scalew for i in range(0,7)] # build template of black notes scaleb = 6/7. xb_temp = [i*scaleb for i in [1,3,7,9,11]] xb,xw = [],[] ...
gpl-3.0
paulmorio/grusData
gradientDescent/example.py
1
1349
""" Example function that we want to minimize/maximize """ def sum_of_squares(v): """ Computers the sum of squared elemetns in v """ return sum(v_i ** 2 for v_i in v) # Estimating the gradient def difference_quotient(f, x, h): return (f(x+h) - f(x))/h # as h approaches 0 # now for some basic understanding of d...
mit
sergpolly/Thermal_adapt_scripts
BOOTSTRAPS/compare_codon_bias.py
2
6501
import re import os import sys from Bio import Seq from Bio import SeqIO from Bio import SeqUtils import numpy as np import pandas as pd import cairi from multiprocessing import Pool import matplotlib.pyplot as plt #MAYBE WE DONT NEED THAT ANYMORE ... # # STUPID FIX TO AVOID OLDER PANDAS HERE ... # # PYTHONPATH seems ...
mit
donK23/shed01
PyBeispiele/SherlockRec/simulate_ratings.py
1
3646
""" Name: simulate_ratings Purpose: Create dummy data for a recommendation system based on collaborative filtering Author: Thomas Treml (datadonk23@gmail.com) Date: 31.08.2015 """ import numpy as np import pandas as pd from sqlalchemy import create_engine, MetaData, Table, Column, Integer, VARCHAR, TIMESTAMP """ DB ...
apache-2.0
jplourenco/bokeh
bokeh/compat/mplexporter/renderers/vega_renderer.py
54
5284
import warnings import json import random from .base import Renderer from ..exporter import Exporter class VegaRenderer(Renderer): def open_figure(self, fig, props): self.props = props self.figwidth = int(props['figwidth'] * props['dpi']) self.figheight = int(props['figheight'] * props['dp...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/pandas/io/clipboard/__init__.py
14
3443
""" Pyperclip A cross-platform clipboard module for Python. (only handles plain text for now) By Al Sweigart al@inventwithpython.com BSD License Usage: import pyperclip pyperclip.copy('The text to be copied to the clipboard.') spam = pyperclip.paste() if not pyperclip.copy: print("Copy functionality unav...
mit
liyu1990/sklearn
sklearn/metrics/pairwise.py
8
45133
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Robert Layton <robertlayton@gmail.com> # Andreas Mueller <amueller@ais.uni-bonn.de> # Philippe Gervais <philippe.gervais@inria.fr> # Lars Buitinck ...
bsd-3-clause
r39132/airflow
airflow/contrib/operators/hive_to_dynamodb.py
21
4084
# -*- coding: utf-8 -*- # # 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 #...
apache-2.0
lucidfrontier45/scikit-learn
examples/cluster/plot_dbscan.py
5
2629
# -*- coding: utf-8 -*- """ =================================== Demo of DBSCAN clustering algorithm =================================== Finds core samples of high density and expands clusters from them. """ print __doc__ import numpy as np from scipy.spatial import distance from sklearn.cluster import DBSCAN from sk...
bsd-3-clause
cactusbin/nyt
matplotlib/lib/matplotlib/compat/subprocess.py
4
2622
""" A replacement wrapper around the subprocess module, with a number of work-arounds: - Provides the check_output function (which subprocess only provides from Python 2.7 onwards). - Provides a stub implementation of subprocess members on Google App Engine (which are missing in subprocess). Instead of importing s...
unlicense
mizzao/ggplot
ggplot/scales/scale_colour_gradient.py
12
2017
from __future__ import (absolute_import, division, print_function, unicode_literals) from .scale import scale from copy import deepcopy import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap, rgb2hex, ColorConverter def colors_at_breaks(cmap, breaks=[0, 0.25, 0.5...
bsd-2-clause
tdhopper/scikit-learn
sklearn/datasets/tests/test_20news.py
280
3045
"""Test the 20news downloader, if the data is available.""" import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import SkipTest from sklearn import datasets def test_20news(): try: data = dat...
bsd-3-clause
andrewnc/scikit-learn
sklearn/linear_model/tests/test_passive_aggressive.py
169
8809
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_rais...
bsd-3-clause
unnikrishnankgs/va
venv/lib/python3.5/site-packages/IPython/lib/latextools.py
3
6248
# -*- coding: utf-8 -*- """Tools for handling LaTeX.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from io import BytesIO, open import os import tempfile import shutil import subprocess from base64 import encodebytes from IPython.utils.process import find_cmd...
bsd-2-clause
bsipocz/astropy
astropy/units/tests/test_quantity.py
1
53631
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test the Quantity class and related. """ import copy import pickle import decimal import numbers from fractions import Fraction import pytest import numpy as np from numpy.testing import (assert_allclose, assert_array_equal, ...
bsd-3-clause
biofilos/cluster_genomics
cluster_strips.py
1
4981
import pandas as pd from bokeh.plotting import figure, output_file, show, ColumnDataSource from bokeh.io import export_svgs from bokeh.models import HoverTool from bokeh import palettes import sys """ Cluster Strips Goal: Plot clusters of several species In order to reduce the clutter, information of every gene will b...
gpl-3.0
CVML/scikit-learn
sklearn/linear_model/omp.py
127
30417
"""Orthogonal matching pursuit algorithms """ # Author: Vlad Niculae # # License: BSD 3 clause import warnings from distutils.version import LooseVersion import numpy as np from scipy import linalg from scipy.linalg.lapack import get_lapack_funcs from .base import LinearModel, _pre_fit from ..base import RegressorM...
bsd-3-clause
HolgerPeters/scikit-learn
sklearn/externals/joblib/parallel.py
33
32728
""" 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 from math import sqrt import functools import time import threading import itertools fr...
bsd-3-clause
ylow/SFrame
oss_src/unity/python/sframe/test/test_sarray_sketch.py
5
12151
''' Copyright (C) 2016 Turi All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. ''' # from nose import with_setup # -*- coding: utf-8 -*- from ..data_structures.sarray import SArray import pandas as pd import numpy as np import unitte...
bsd-3-clause
sonnyhu/scikit-learn
sklearn/linear_model/tests/test_base.py
83
15089
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from itertools import product from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils...
bsd-3-clause
nixingyang/Kaggle-Competitions
Shelter Animal Outcomes/XGBoost.py
1
7423
from copy import deepcopy from sklearn.cross_validation import StratifiedKFold, StratifiedShuffleSplit from xgboost.sklearn import XGBClassifier import numpy as np N_FOLDS = 5 CV_NUM = 1 EVAL_METRIC = "mlogloss" EARLY_STOPPING_ROUNDS = 100 N_ESTIMATORS = 1000000 OBJECTIVE = "multi:softprob" GET_BEST_SCORE_INDEX = np.a...
mit
giorgiop/scikit-learn
examples/mixture/plot_gmm_sin.py
103
6101
""" ================================= Gaussian Mixture Model Sine Curve ================================= This example demonstrates the behavior of Gaussian mixture models fit on data that was not sampled from a mixture of Gaussian random variables. The dataset is formed by 100 points loosely spaced following a noisy ...
bsd-3-clause
costypetrisor/scikit-learn
examples/semi_supervised/plot_label_propagation_digits.py
268
2723
""" =================================================== Label Propagation digits: Demonstrating performance =================================================== This example demonstrates the power of semisupervised learning by training a Label Spreading model to classify handwritten digits with sets of very few labels....
bsd-3-clause
samsammurphy/ee-atmcorr-timeseries
atmcorr/plots.py
1
1623
import pandas as pd from matplotlib import pylab as plt import matplotlib.dates as mdates def figure_plotting_space(): """ defines the plotting space """ fig = plt.figure(figsize=(10,10)) bar_height = 0.04 mini_gap = 0.03 gap = 0.05 graph_height = 0.24 axH = fig.add_axes([0.1,ga...
apache-2.0
aestrivex/mne-python
examples/realtime/rt_feedback_server.py
8
4955
""" ============================================== Real-time feedback for decoding :: Server Side ============================================== This example demonstrates how to setup a real-time feedback mechanism using StimServer and StimClient. The idea here is to display future stimuli for the class which is pred...
bsd-3-clause
iandriver/RNA-sequence-tools
RNA_Seq_analysis/cluster.py
2
33129
import cPickle as pickle import numpy as np import pandas as pd import os from subprocess import call import matplotlib matplotlib.use('QT4Agg') import matplotlib.pyplot as plt from matplotlib.ticker import LinearLocator import scipy import json from sklearn.decomposition import PCA as skPCA from scipy.spatial.distance...
mit
SuLab/scheduled-bots
scheduled_bots/civic/make_drug_list.py
1
1969
from collections import defaultdict import requests from tqdm import tqdm import json r = requests.get('https://civic.genome.wustl.edu/api/variants?count=999999999') variants_data = r.json() records = variants_data['records'] all_data = dict() for record in tqdm(records): variant_id = str(record['id']) r = r...
mit
JeanKossaifi/scikit-learn
examples/decomposition/plot_ica_vs_pca.py
306
3329
""" ========================== FastICA on 2D point clouds ========================== This example illustrates visually in the feature space a comparison by results using two different component analysis techniques. :ref:`ICA` vs :ref:`PCA`. Representing ICA in the feature space gives the view of 'geometric ICA': ICA...
bsd-3-clause
cbrunet/fibermodes
plots/sio2geo2.py
2
1764
"""Plot refractive index as function of concentration and wavelength. Updated: 2015-10-15 """ from fibermodes.fiber.material import SiO2GeO2, Silica, Germania from fibermodes.fiber.material.sio2geo2cm import SiO2GeO2 as SiO2GeO2CM import numpy from matplotlib import pyplot def n_fx(): pyplot.figure() X = n...
gpl-3.0
aemerick/galaxy_analysis
examples/plot_time_series.py
1
9996
import numpy as np import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import glob import deepdish as dd import sys import os # some general plot styles for consistency from galaxy_analysis.plot import plot_styles as ps from galaxy_analysis.utilities import utilities colors = {'Disk' : ps.black, ...
mit
DavidLutton/EngineeringProject
examples/sweep.py
1
5327
#!/usr/bin/env python3 # Standard modules import logging # https://docs.python.org/3/library/logging.html import time # https://docs.python.org/3/library/time.html import statistics # https://docs.python.org/3/library/statistics.html # Functions or Classes from standard modules from pprint import pprint # https:/...
mit
meerkat-code/meerkat_api
meerkat_api/resources/completeness.py
1
21570
""" Data resource for completeness data """ import json import pandas as pd import meerkat_abacus.util as abacus_util from datetime import datetime, timedelta from dateutil.parser import parse from flask import jsonify, request, g from flask_restful import Resource, abort from pandas.tseries.offsets import CustomBusin...
mit
stuckeyr/sharkmap
sharkmap.py
1
6902
#!/usr/bin/env python import itertools import pandas as pd import numpy as np import re import sys import time from geopy.geocoders import GoogleV3 from geopy.geocoders import Nominatim reload(sys) sys.setdefaultencoding('utf8') # Clean our Fatal column up def clean_Fatal(x): if x == 'Y': return True ...
mit
lucidfrontier45/scikit-learn
examples/cluster/plot_lena_compress.py
5
2192
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Vector Quantization Example ========================================================= The classic image processing example, Lena, an 8-bit grayscale bit-depth, 512 x 512 sized image, is used here to illustrate how `...
bsd-3-clause
stetie/postpic
postpic/datahandling.py
1
89783
# # This file is part of postpic. # # postpic 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. # # postpic is distributed in the hope th...
gpl-3.0
croxis/SpaceDrive
spacedrive/renderpipeline/rpcore/mount_manager.py
1
12750
""" RenderPipeline Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the right...
mit
dssg/wikienergy
disaggregator/build/pandas/pandas/tseries/tests/test_plotting.py
3
41563
from datetime import datetime, timedelta, date, time import nose from pandas.compat import lrange, zip import numpy as np from numpy.testing.decorators import slow from numpy.testing import assert_array_equal from pandas import Index, Series, DataFrame from pandas.tseries.index import date_range, bdate_range from p...
mit
zorojean/scikit-learn
sklearn/metrics/metrics.py
233
1262
import warnings warnings.warn("sklearn.metrics.metrics is deprecated and will be removed in " "0.18. Please import from sklearn.metrics", DeprecationWarning) from .ranking import auc from .ranking import average_precision_score from .ranking import label_ranking_average_precision_score fro...
bsd-3-clause
yarikoptic/pystatsmodels
statsmodels/datasets/sunspots/data.py
3
2000
"""Yearly sunspots data 1700-2008""" __docformat__ = 'restructuredtext' COPYRIGHT = """This data is public domain.""" TITLE = __doc__ SOURCE = """ http://www.ngdc.noaa.gov/stp/SOLAR/ftpsunspotnumber.html The original dataset contains monthly data on sunspot activity in the file ./src/sunspots_yearly.dat...
bsd-3-clause
MJuddBooth/pandas
pandas/tests/io/test_compression.py
2
4797
import contextlib import os import warnings import pytest import pandas as pd import pandas.util.testing as tm import pandas.io.common as icom @contextlib.contextmanager def catch_to_csv_depr(): # Catching warnings because Series.to_csv has # been deprecated. Remove this context when # Series.to_csv ha...
bsd-3-clause
Wilee999/panda3d
makepanda/makepanda.py
1
322800
#!/usr/bin/env python ######################################################################## # # Caution: there are two separate, independent build systems: # 'makepanda', and 'ppremake'. Use one or the other, do not attempt # to use both. This file is part of the 'makepanda' system. # # To build panda using this s...
bsd-3-clause
zihua/scikit-learn
examples/linear_model/plot_sgd_comparison.py
112
1819
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
maubarsom/maars-shotgun
scripts/extract_samples.py
1
1368
""" Script to create a directory structure from selected samples and link the appropriate fastq files """ #!/usr/bin/python import os import subprocess import os.path import sys import pandas as pd import glob if len(sys.argv) != 4: sys.stderr.write("Number of arguments: {}\n".format(len(sys.argv))) sys.stderr...
apache-2.0
JeroenZegers/Nabu-MSSS
nabu/postprocessing/reconstructors/deepattractornet_noisefilter_reconstructor.py
1
4275
'''@file deepclustering_reconstructor.py contains the reconstor class using deep clustering''' from sklearn.cluster import KMeans import mask_reconstructor from nabu.postprocessing import data_reader import numpy as np import os import pdb class DeepattractornoisefilterReconstructor(mask_reconstructor.MaskReconstruct...
mit
idlead/scikit-learn
examples/calibration/plot_calibration.py
33
4794
""" ====================================== Probability calibration of classifiers ====================================== When performing classification you often want to predict not only the class label, but also the associated probability. This probability gives you some kind of confidence on the prediction. However,...
bsd-3-clause
MarcSpitz/ldebroux_kjadin_masters-thesis_2014
src/addition_removal_time.py
1
6966
#!/usr/bin/env python # -*- coding: utf-8 -*- # @author: Debroux Léonard <leonard.debroux@gmail.com> # @author: Jadin Kevin <contact@kjadin.com> import sys, os from utils import Utils from setup import Setup import logging as log from pylab import savefig, figure, plot, subplots, gca, tight_layout from matplotl...
gpl-2.0
kevin-intel/scikit-learn
sklearn/linear_model/_passive_aggressive.py
2
17461
# Authors: Rob Zinkov, Mathieu Blondel # License: BSD 3 clause from ._stochastic_gradient import BaseSGDClassifier from ._stochastic_gradient import BaseSGDRegressor from ._stochastic_gradient import DEFAULT_EPSILON class PassiveAggressiveClassifier(BaseSGDClassifier): """Passive Aggressive Classifier Read ...
bsd-3-clause
napjon/moocs_solution
Data_Science/project_1/custom_heuristics/assignment.py
1
3203
from __future__ import division import numpy import pandas import statsmodels.api as sm import sys def custom_heuristic(file_path): ''' You are given a list of Titantic passengers and their associating information. More information about the data can be seen at the link below: http://www.kaggle.com/c/...
mit
Vimos/scikit-learn
examples/neural_networks/plot_mlp_training_curves.py
58
3692
""" ======================================================== Compare Stochastic learning strategies for MLPClassifier ======================================================== This example visualizes some training loss curves for different stochastic learning strategies, including SGD and Adam. Because of time-constrai...
bsd-3-clause
spallavolu/scikit-learn
examples/decomposition/plot_image_denoising.py
181
5819
""" ========================================= Image denoising using dictionary learning ========================================= An example comparing the effect of reconstructing noisy fragments of the Lena image using firstly online :ref:`DictionaryLearning` and various transform methods. The dictionary is fitted o...
bsd-3-clause
dkaylor/datasciencebowl
train.py
1
9102
import os import numpy as np from data import load_images from realtime_augment import RealtimeAugment from pylearn2.datasets import preprocessing from pylearn2.training_algorithms import sgd, learning_rule from pylearn2.termination_criteria import EpochCounter from pylearn2.datasets.dense_design_matrix import DenseDe...
mit
dougthor42/OWT_WM_View
build_executables.py
1
4362
# -*- coding: utf-8 -*- """ Created on Mon Jun 22 13:08:24 2015 @author: dthor """ # --------------------------------------------------------------------------- ### Imports # --------------------------------------------------------------------------- # Standard Library import sys import logging import os...
gpl-3.0
drammock/mne-python
examples/stats/fdr_stats_evoked.py
20
2740
""" ======================================= FDR correction on T-test on sensor data ======================================= One tests if the evoked response significantly deviates from 0. Multiple comparison problem is addressed with False Discovery Rate (FDR) correction. """ # Authors: Alexandre Gramfort <alexandre....
bsd-3-clause
tavo91/NER-WNUT17
common/utilities.py
1
15371
import re import string import csv import numpy as np import matplotlib.pyplot as plt from collections import Counter from collections import defaultdict as ddict from embeddings.twitter.word2vecReader import Word2Vec from itertools import groupby from keras import backend as K from keras.preprocessing.text import Tok...
mit
liangz0707/scikit-learn
examples/svm/plot_separating_hyperplane_unbalanced.py
329
1850
""" ================================================= SVM: Separating hyperplane for unbalanced classes ================================================= Find the optimal separating hyperplane using an SVC for classes that are unbalanced. We first find the separating plane with a plain SVC and then plot (dashed) the ...
bsd-3-clause
Hemisphere-Project/Telemir-DatabitMe
Telemir-EEG/pyacq/pyacq/gui/timefreq.py
1
22106
# -*- coding: utf-8 -*- from PyQt4 import QtCore,QtGui import pyqtgraph as pg import zmq import time from .tools import RecvPosThread, MultiChannelParamsSetter from .guiutil import * from .multichannelparam import MultiChannelParam from matplotlib.cm import get_cmap from matplotlib.colors import ColorConverter fro...
gpl-2.0
JackDandy/SickGear
lib/dateutil/parser/_parser.py
2
60702
# -*- coding: utf-8 -*- """ This module offers a generic date/time string parser which is able to parse most known formats to represent a date and/or time. This module attempts to be forgiving with regards to unlikely input formats, returning a datetime object even for dates which are ambiguous. If an element o...
gpl-3.0
GaZ3ll3/scikit-image
skimage/viewer/canvastools/recttool.py
43
8886
from matplotlib.widgets import RectangleSelector from ...viewer.canvastools.base import CanvasToolBase from ...viewer.canvastools.base import ToolHandles __all__ = ['RectangleTool'] class RectangleTool(CanvasToolBase, RectangleSelector): """Widget for selecting a rectangular region in a plot. After making ...
bsd-3-clause
umuzungu/zipline
tests/test_history.py
1
65003
from textwrap import dedent from numbers import Real from nose_parameterized import parameterized import numpy as np from numpy import nan from numpy.testing import assert_almost_equal import pandas as pd from six import iteritems from zipline import TradingAlgorithm from zipline._protocol import handle_non_market_m...
apache-2.0
MaterialsDiscovery/PyChemia
pychemia/code/abinit/task/static.py
1
3422
import os import json import numpy as np from pychemia.crystal import KPoints from ...tasks import Task from ..abinit import AbinitJob __author__ = 'Guillermo Avendano-Franco' class StaticCalculation(Task): def __init__(self, structure, workdir='.', executable='abinit', ecut=50, kpoints=None, kp_density=1E4): ...
mit
n-west/gnuradio
gr-filter/examples/synth_filter.py
58
2552
#!/usr/bin/env python # # Copyright 2010,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
rajat1994/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
244
1593
import numpy as np import scipy.sparse as sp from nose.tools import assert_raises, assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.linear_model import SGD...
bsd-3-clause
bit-jmm/ttarm
result/plots/error_bar.py
1
1372
""" Demo of the errorbar function, including upper and lower limits """ import numpy as np import matplotlib.pyplot as plt # example data x = np.arange(0.5, 5.5, 0.5) y = np.exp(-x) xerr = 0.1 yerr = 0.2 ls = 'dotted' fig = plt.figure() ax = fig.add_subplot(1, 1, 1) # standard error bars plt.errorbar(x, y, xerr=xerr...
gpl-2.0
nburn42/tensorflow
tensorflow/python/estimator/inputs/queues/feeding_queue_runner_test.py
116
5164
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
mmacgilvray18/Phospho_Network
python/Kullback_Leibler_Module_toEachKinase.py
1
11649
import pandas as pd import numpy as np import glob import math '''This script is comparing each PWM from Mok et al to to each Module PWM using a method called Kullback-Leibler divergence (KLD). KLD(X,Y) = 1/2 (E Xalog(Xa/Ya) + E Yalog(Ya/Xa)) Where ‘X’ represents a query PWM position and ‘Y’ a comparison PWM posi...
gpl-3.0
miloharper/neural-network-animation
matplotlib/tests/test_path.py
9
2261
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from matplotlib.path import Path from matplotlib.patches import Polygon from nose.tools import assert_raises from matplotlib.testing.decorators import image_comparison import mat...
mit
DJArmstrong/autovet
Features/Centroiding/Centroiding_RDX.py
1
50983
# -*- coding: utf-8 -*- """ Created on Sun Aug 14 18:25:52 2016 @author: Maximilian N. Guenther Battcock Centre for Experimental Astrophysics, Cavendish Laboratory, JJ Thomson Avenue Cambridge CB3 0HE Email: mg719@cam.ac.uk """ import warnings import numpy as np import matplotlib.pyplot as plt import matplotlib.patch...
gpl-3.0
crichardson17/starburst_atlas
Low_resolution_sims/DustFree_LowRes/Geneva_Rot_inst/Geneva_Rot_inst_age4/UV2.py
33
7365
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
equialgo/scikit-learn
examples/feature_selection/plot_feature_selection.py
95
2847
""" =============================== Univariate Feature Selection =============================== An example showing univariate feature selection. Noisy (non informative) features are added to the iris data and univariate feature selection is applied. For each feature, we plot the p-values for the univariate feature s...
bsd-3-clause
jaeminSon/V-GAN
codes/utils.py
1
16560
import os import sys from PIL import Image, ImageEnhance from keras.preprocessing.image import Iterator from scipy.ndimage import rotate from skimage import filters from sklearn.metrics import auc from sklearn.metrics import confusion_matrix from sklearn.metrics import roc_curve, roc_auc_score, precision_recall_curve ...
mit
julietbravo/microhh
kernel_tuner/statistics.py
5
1185
import matplotlib.pyplot as pl import numpy as np import json import glob pl.close('all') pl.ion() def get_timings(kernel_name, gridsizes): dt = np.zeros_like(gridsizes, dtype=float) for i,gridsize in enumerate(gridsizes): with open( '{0}_{1:03d}.json'.format(kernel_name, gridsize) ) as f: ...
gpl-3.0
sudikrt/costproML
cost.py
1
1547
import pandas import numpy as np import matplotlib.pyplot as plt from sklearn.cross_validation import train_test_split from sklearn.metrics import mean_squared_error from sklearn.linear_model import LinearRegression from sklearn.naive_bayes import GaussianNB from sklearn.svm import SVC from datetime import timedelta ...
apache-2.0
sigmaroles/bpred
mlpredict.py
1
1388
import sys import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, accuracy_score, classification_report if __name__=='__main__': fname = sys.argv[1] data = [] labels = [] with op...
gpl-3.0
JWDebelius/scikit-bio
skbio/stats/distance/tests/test_mantel.py
1
22066
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
bsd-3-clause
dsquareindia/scikit-learn
sklearn/metrics/tests/test_regression.py
49
8058
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises, assert_raises_regex from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equa...
bsd-3-clause
chrsrds/scikit-learn
examples/classification/plot_lda_qda.py
25
5449
""" ==================================================================== Linear and Quadratic Discriminant Analysis with covariance ellipsoid ==================================================================== This example plots the covariance ellipsoids of each class and decision boundary learned by LDA and QDA. The...
bsd-3-clause
ephes/scikit-learn
examples/mixture/plot_gmm_sin.py
248
2747
""" ================================= Gaussian Mixture Model Sine Curve ================================= This example highlights the advantages of the Dirichlet Process: complexity control and dealing with sparse data. The dataset is formed by 100 points loosely spaced following a noisy sine curve. The fit by the GMM...
bsd-3-clause
lucashtnguyen/wqio
wqio/algo/ros.py
1
16320
from __future__ import division import pdb import os import sys if sys.version_info.major == 3: from io import StringIO else: from StringIO import StringIO import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats import pandas __all__ = ['rosSort', 'MR'] def rosSort(dataframe, resco...
bsd-3-clause
BhallaLab/moose-examples
tutorials/Electrophys/ephys1_cable.py
2
6794
######################################################################## # This example demonstrates a cable # Copyright (C) Upinder S. Bhalla NCBS 2018 # Released under the terms of the GNU Public License V3. ######################################################################## import matplotlib.pyplot as plt impor...
gpl-2.0
maxlikely/scikit-learn
sklearn/datasets/twenty_newsgroups.py
4
10030
"""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
LohithBlaze/scikit-learn
examples/cluster/plot_color_quantization.py
297
3443
# -*- coding: utf-8 -*- """ ================================== Color Quantization using K-Means ================================== Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace (China), reducing the number of colors required to show the image from 96,615 unique colors to 64, while pre...
bsd-3-clause
rsivapr/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
5
18632
""" Todo: cross-check the F-value with stats model """ import itertools import numpy as np from scipy import stats, sparse import warnings from nose.tools import assert_equal, assert_raises, assert_true from numpy.testing import assert_array_equal, assert_array_almost_equal from sklearn.utils.testing import assert_no...
bsd-3-clause
jungla/ICOM-fluidity-toolbox
Detectors/plot_Hovmuller_v.py
1
4493
#!~/python import fluidity_tools import matplotlib as mpl mpl.use('ps') import matplotlib.pyplot as plt import numpy as np import vtktools import myfun import os import spectrum exp = 'r_3k_B_1F0_s' filename ='/tamay2/mensa/fluidity/'+exp+'/ring_checkpoint.detectors' #filename2 = '/tamay2/mensa/fluidity/'+exp+'/ring_...
gpl-2.0