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
coolsgupta/machine_learning_nanodegree
Model_Evaluation_and_Validation/numpy_and_pandas_tutorial/eg_6.py
1
1951
from pandas import DataFrame, Series import numpy def avg_medal_count(): ''' Compute the average number of bronze medals earned by countries who earned at least one gold medal. Save this to a variable named avg_bronze_at_least_one_gold. You do not need to call the function in your code when runni...
mit
mne-tools/mne-python
mne/preprocessing/maxwell.py
1
103928
# -*- coding: utf-8 -*- # Authors: Mark Wronkiewicz <wronk.mark@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # Jussi Nurminen <jnu@iki.fi> # License: BSD (3-clause) from collections import Counter, OrderedDict from functools import partial from math import factorial from os import path as op ...
bsd-3-clause
ddenhartog/quantstart-backtester
backtester/portfolio.py
1
4844
#PYTHON from abc import ( ABCMeta, abstractmethod ) from math import copysign #PROJECT from .events import ( SignalEvent, OrderEvent ) from .performance import ( create_sharpe_ratio, create_drawdowns ) class PortfolioMetaclass(metaclass=ABCMeta): @abstractmethod def update_signal(self...
mit
GRAAL-Research/domain_adversarial_neural_network
experiments_amazon.py
1
5516
import numpy as np from DANN import DANN from mSDA import compute_msda_representation from sklearn.datasets import load_svmlight_files from sklearn import svm def main(): data_folder = './data/' # where the datasets are source_name = 'dvd' # source domain: books, dvd, kitchen, or electronics t...
bsd-2-clause
acorg/dark-matter
bin/alignment-panel-civ.py
1
16440
#!/usr/bin/env python """ Given a BLAST or DIAMOND JSON output files, the corresponding FASTA (or FASTQ) sequence files, and filtering criteria, produce a summary of matched titles and (optionally) an alignment panel. Run with --help for help. """ from __future__ import print_function import os import sys import ar...
mit
PredictionIO/open-academy
KairatAshim/pio_assignment2/problem3/problem3.py
1
3875
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np import matplotlib.mlab as mlab import math import scipy.special as sps import scipy.stats as stats from scipy.stats import invgamma pathToFile = "/Users/kairat/Desktop/pio_assignment/positiveSixMonthRevenue.csv" bins_value = 500 #############...
apache-2.0
tomlof/scikit-learn
sklearn/feature_extraction/text.py
19
52042
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gmail.com> # # License: B...
bsd-3-clause
impactlab/eemeter
tests/modeling/test_split_modeled_energy_trace.py
1
3467
import tempfile from datetime import datetime import pandas as pd import numpy as np import pytest import pytz from eemeter.modeling.formatters import ModelDataFormatter from eemeter.modeling.models.seasonal import SeasonalElasticNetCVModel from eemeter.modeling.split import SplitModeledEnergyTrace from eemeter.struc...
mit
trungnt13/scikit-learn
sklearn/linear_model/tests/test_ransac.py
16
12745
import numpy as np from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from scipy import sparse from sklearn.utils.testing import assert_less from sklearn.linear_model import LinearRegression, RANSACRegressor from sklearn.linear_model.ransac import _dynamic_max_tri...
bsd-3-clause
joferkington/mplstereonet
examples/fault_slip_plot.py
3
2875
""" Illustrates two different methods of plotting fault slip data. A fault-and-striae diagram is the traditional method. The tangent-lineation diagram follows Twiss & Unruh, 1988 (this style was originally introduced by Goldstein & Marshak, 1988 and also by Hoeppener, 1955, but both used the opposite convention for a...
mit
elijah513/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
fengzhyuan/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
jzt5132/scikit-learn
sklearn/svm/setup.py
321
3157
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('svm', parent_package, top_path) config.add_subpackage('tests') # Section L...
bsd-3-clause
binghongcha08/pyQMD
GWP/QTGB/resample/c.py
28
1767
##!/usr/bin/python import numpy as np import pylab as plt import seaborn as sns sns.set_context('poster') #with open("traj.dat") as f: # data = f.read() # # data = data.split('\n') # # x = [row.split(' ')[0] for row in data] # y = [row.split(' ')[1] for row in data] # # fig = plt.figure() # # ax1 ...
gpl-3.0
gdsglgf/tutorials
python/pillow/array_to_image.py
1
1062
from PIL import Image import numpy as np from matplotlib import pyplot as plt def saveImage(data, mode, filename): img = Image.fromarray(data, mode) img.save(filename) def createRGBImage(): h, w = 128, 128 data = np.zeros((h, w, 3), dtype=np.uint8) data[64, 64] = [255, 0, 0] return data def createGreyscaleIma...
mit
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/scipy/interpolate/_bsplines.py
15
29415
from __future__ import division, print_function, absolute_import import functools import operator import numpy as np from scipy.linalg import (get_lapack_funcs, LinAlgError, cholesky_banded, cho_solve_banded) from . import _bspl from . import _fitpack_impl from . import _fitpack as _dierckx ...
mit
lpenguin/pandas-qt
pandasqt/models/ColumnDtypeModel.py
3
9494
# -*- coding: utf-8 -*- """Easy integration of DataFrame into pyqt framework @author: Matthias Ludwig - Datalyze Solutions """ from pandasqt.compat import Qt, QtCore, QtGui, Slot, Signal import pandas import numpy as np from pandasqt.models.SupportedDtypes import SupportedDtypes DTYPE_ROLE = Qt.UserRole + 1 DTYPE...
mit
dsockwell/trading-with-python
lib/functions.py
76
11627
# -*- coding: utf-8 -*- """ twp support functions @author: Jev Kuznetsov Licence: GPL v2 """ from scipy import polyfit, polyval import datetime as dt #from datetime import datetime, date from pandas import DataFrame, Index, Series import csv import matplotlib.pyplot as plt import numpy as np import p...
bsd-3-clause
HolgerPeters/scikit-learn
examples/plot_digits_pipe.py
65
1652
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Pipelining: chaining a PCA and a logistic regression ========================================================= The PCA does an unsupervised dimensionality reduction, while the logistic regression does the predictio...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/matplotlib/examples/api/custom_scale_example.py
1
7424
""" ============ Custom scale ============ This example showcases how to create a custom scale, by implementing the scaling use for latitude data in a Mercator Projection. """ from __future__ import unicode_literals import numpy as np from numpy import ma from matplotlib import scale as mscale from matplotlib impor...
mit
mifox/html
d3test/netspider.py
1
3539
# -*- coding: utf-8 -*- """ Created on Wed Sep 28 09:06:01 2016 @author: dingchaoqun """ #encoding:UTF-8 import urllib.request import pandas as pd from bs4 import BeautifulSoup def getcontrolgraghbyOnestockcode(stockcode,bx): global url print(stockcode) url = "http://basic.10jqka.com.cn/16/%s/holder.html"...
gpl-3.0
cl4rke/scikit-learn
sklearn/utils/tests/test_estimator_checks.py
202
3757
import scipy.sparse as sp import numpy as np import sys from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.testing import assert_raises_regex, assert_true from sklearn.utils.estimator_checks import check_estimator from sklearn.utils....
bsd-3-clause
huongttlan/mpld3
mpld3/_display.py
15
16996
import warnings import random import json import jinja2 import numpy import re import os from ._server import serve from .utils import deprecated, get_id, write_ipynb_local_js from .mplexporter import Exporter from .mpld3renderer import MPLD3Renderer from . import urls __all__ = ["fig_to_html", "fig_to_dict", "fig_to_...
bsd-3-clause
lukeiwanski/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py
39
32726
# 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
anirudhjayaraman/scikit-learn
sklearn/cluster/mean_shift_.py
96
15434
"""Mean shift clustering algorithm. Mean shift clustering aims to discover *blobs* in a smooth density of samples. It is a centroid based algorithm, which works by updating candidates for centroids to be the mean of the points within a given region. These candidates are then filtered in a post-processing stage to elim...
bsd-3-clause
hmendozap/auto-sklearn
autosklearn/pipeline/components/regression/gradient_boosting.py
1
6605
import numpy as np from HPOlibConfigSpace.configuration_space import ConfigurationSpace from HPOlibConfigSpace.hyperparameters import UniformFloatHyperparameter, \ UniformIntegerHyperparameter, CategoricalHyperparameter, Constant, \ UnParametrizedHyperparameter from HPOlibConfigSpace.conditions import InCondit...
bsd-3-clause
StratsOn/zipline
tests/test_batchtransform.py
2
9818
# # Copyright 2013 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
aiguofer/bokeh
bokeh/util/serialization.py
2
8701
""" Functions for helping with serialization and deserialization of Bokeh objects. Certain NunPy array dtypes can be serialized to a binary format for performance and efficiency. The list of supported dtypes is: %s """ from __future__ import absolute_import import base64 from six import iterkeys from .dependencie...
bsd-3-clause
kennethdecker/MagnePlane
src/hyperloop/Python/mission/tests/test_straight_track.py
3
6317
from __future__ import division, print_function, absolute_import import unittest import numpy as np try: from openmdao.api import pyOptSparseDriver except: pyOptSparseDriver = None from openmdao.api import ScipyOptimizer from pointer.components import Problem, Trajectory, CollocationPhase from hyperloop.Py...
apache-2.0
huongttlan/statsmodels
statsmodels/examples/ex_proportion.py
33
1918
# -*- coding: utf-8 -*- """ Created on Sun Apr 21 07:59:26 2013 Author: Josef Perktold """ from __future__ import print_function from statsmodels.compat.python import lmap import numpy as np import statsmodels.stats.proportion as sms import statsmodels.stats.weightstats as smw from numpy.testing import assert_almos...
bsd-3-clause
rbalda/neural_ocr
env/lib/python2.7/site-packages/matplotlib/axes/_subplots.py
8
8357
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six from matplotlib.externals.six.moves import map from matplotlib.gridspec import GridSpec, SubplotSpec from matplotlib import docstring import matplotlib.artist as martist fr...
mit
GrumpyNounours/PySeidon
setup.py
2
1640
#!/usr/bin/python2.7 # encoding: utf-8 from setuptools import setup, find_packages from numpy.distutils.misc_util import Configuration def readme(): with open('README.md') as f: return f.read() option = raw_input("Resolve dependencies (y) or (n): ") option = option.lower() if option=='n': setup(name=...
agpl-3.0
wavelets/hyperopt-sklearn
hpsklearn/tests/test_estimator.py
4
1604
try: import unittest2 as unittest except: import unittest import numpy as np from hpsklearn.estimator import hyperopt_estimator from hpsklearn import components class TestIter(unittest.TestCase): def setUp(self): np.random.seed(123) self.X = np.random.randn(1000, 2) self.Y = (sel...
bsd-3-clause
GuessWhoSamFoo/pandas
pandas/tests/frame/test_block_internals.py
1
21539
# -*- coding: utf-8 -*- from __future__ import print_function from datetime import datetime, timedelta import itertools import numpy as np import pytest from pandas.compat import StringIO import pandas as pd from pandas import ( Categorical, DataFrame, Series, Timestamp, compat, date_range, option_context)...
bsd-3-clause
ankurankan/scikit-learn
sklearn/neighbors/tests/test_ball_tree.py
30
9727
import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dist_metrics impo...
bsd-3-clause
TomAugspurger/pandas
pandas/tests/dtypes/cast/test_downcast.py
2
2790
import decimal import numpy as np import pytest from pandas.core.dtypes.cast import maybe_downcast_to_dtype from pandas import DatetimeIndex, Series, Timestamp import pandas._testing as tm @pytest.mark.parametrize( "arr,dtype,expected", [ ( np.array([8.5, 8.6, 8.7, 8.8, 8.9999999999995]...
bsd-3-clause
alphaBenj/zipline
zipline/data/treasuries.py
4
3414
# # Copyright 2013 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
aflaxman/scikit-learn
sklearn/model_selection/tests/test_validation.py
6
53244
"""Test the validation module""" from __future__ import division import sys import warnings import tempfile import os from time import sleep import numpy as np from scipy.sparse import coo_matrix, csr_matrix from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.uti...
bsd-3-clause
Haunter17/MIR_SU17
exp3/exp3c/exp3c.py
1
21749
import numpy as np import tensorflow as tf import h5py import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import sys # Functions for initializing neural nets parameters def init_weight_variable(shape, nameIn): initial = tf.truncated_normal(shape, stddev=0.1, dtype=tf.float32) retu...
mit
krischer/mtspec
mtspec/multitaper.py
1
31582
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Main functions of mtspec. :copyright: Lion Krischer (krischer@geophysik.uni-muenchen.de) and Moritz Beyreuther, 2010-2016 :license: GNU General Public License, Version 3 (http://www.gnu.org/copyleft/gpl.html) """ import ctypes as C import numpy as np f...
gpl-3.0
marqh/cartopy
lib/cartopy/tests/mpl/test_caching.py
1
6536
# (C) British Crown Copyright 2011 - 2012, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option)...
gpl-3.0
cogmission/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/pylab.py
70
10245
""" This is a procedural interface to the matplotlib object-oriented plotting library. The following plotting commands are provided; the majority have Matlab(TM) analogs and similar argument. _Plotting commands acorr - plot the autocorrelation function annotate - annotate something in the figure arrow ...
agpl-3.0
tkaitchuck/nupic
external/darwin64/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py
70
4184
""" Render to gtk from agg """ from __future__ import division import os import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ show, draw_if_interactive,\ error_ms...
gpl-3.0
clemkoa/scikit-learn
sklearn/tests/test_metaestimators.py
30
5040
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.utils.validation import...
bsd-3-clause
BarrelfishOS/barrelfish
tools/harness/tests/distopsbench.py
1
12343
import tests, debug from common import TestCommon from results import PassFailResult, RowResults import sys, re, numpy, os, datetime has_mpl = True try: import matplotlib.pyplot as plt except: has_mpl = False OPERATIONHEADER = re.compile("^# Benchmarking ([A-Z 0-9]+): nodes=(\d+).*$") DATAHEADER = re.compile...
mit
massmutual/scikit-learn
examples/svm/plot_iris.py
225
3252
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only consider the first 2 features of this dataset: - Sepal length - Se...
bsd-3-clause
homeslike/OpticalTweezer
scripts/data2/vCOMhistogramMass.py
27
3006
import math import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab from subprocess import call from scipy.stats import norm # proc = call("ls *.dat",shell=True) # datetime = "170123_2033_" datetime = sys.argv[1]+"_" gasTempDataIn = np.genfromtxt(datetime+"gasTempData.dat",usecols...
mit
ykashou92/PyScraping
webscraper_2.py
1
2246
# Run if packages not yet installed. (Usually installed if using Anaconda distribution) ! pip install pandas ! pip install bs4 # Import necessary Libraries import pandas as pd import urllib.request from bs4 import BeautifulSoup # Specify target URL # Wikipedia has list pages, for an exmaple we will access the list of...
mit
g0v/sunshine.cy
parser/property/stock_symbol.py
1
1163
#! /usr/bin/env python # -*- coding: utf-8 -*- import re import json import pandas as pd import common import db_settings def stock(): c.execute(''' SELECT id, name FROM property_stock ''') return c.fetchall() def update_symbol(symbol, fullname, id): c.execute(''' UPDATE prope...
cc0-1.0
zzw0929/deeplearning
tensorflow/neuralNet/mofan/addLayer.py
1
2150
# coding:utf-8 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(inputs, in_size, out_size, activation_function=None): with tf.name_scope('layer'): with tf.name_scope('weights'): Weights = tf.Variable(tf.random_normal([in_size, out_size])) ...
apache-2.0
simon-pepin/scikit-learn
sklearn/datasets/tests/test_base.py
205
5878
import os import shutil import tempfile import warnings import nose import numpy from pickle import loads from pickle import dumps from sklearn.datasets import get_data_home from sklearn.datasets import clear_data_home from sklearn.datasets import load_files from sklearn.datasets import load_sample_images from sklearn...
bsd-3-clause
RethinkRobotics/intera_sdk
intera_interface/src/intera_joint_trajectory_action/minjerk.py
1
10210
#! /usr/bin/env python# Software License Agreement (BSD License) # # Copyright (c) 2016, Kei Okada # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must reta...
apache-2.0
sam81/eegutils
eegutils.py
1
54478
# -*- coding: utf-8 -*- # Copyright (C) 2012-2015 Samuele Carcagno <sam.carcagno@gmail.com> # This file is part of eegutils # eegutils 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 versi...
gpl-3.0
Sentient07/scikit-learn
sklearn/utils/random.py
46
10523
# Author: Hamzeh Alsalhi <ha258@cornell.edu> # # License: BSD 3 clause from __future__ import division import numpy as np import scipy.sparse as sp import operator import array from sklearn.utils import check_random_state from sklearn.utils.fixes import astype from ._random import sample_without_replacement __all__ =...
bsd-3-clause
cbonnett/SkyNet_wrapper
src/test.py
1
1208
from sklearn.datasets import load_boston from sklearn.datasets import load_iris from sklearn.utils import shuffle from SkyNet import SkyNetRegressor from SkyNet import SkyNetClassifier try: import seaborn as sns except: pass X,y = shuffle(load_boston().data,load_boston().target) X_train = X[0:200] y_train =...
gpl-3.0
jrleeman/MetPy
setup.py
1
3270
# Copyright (c) 2008,2010,2015,2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Setup script for installing MetPy.""" from __future__ import print_function from setuptools import find_packages, setup import versioneer ver = versioneer.get_ve...
bsd-3-clause
ashmanmode/TTSDNNRepo
src/a_addsamplefeats.py
1
58162
import cPickle import gzip import os, sys, errno import time import math import subprocess import socket # only for socket.getfqdn() # numpy & theano imports need to be done in this order (only for some numpy installations, not sure why) import numpy #import gnumpy as gnp # we need to explicitly import this in some...
apache-2.0
sonnyhu/scikit-learn
sklearn/decomposition/truncated_svd.py
13
7868
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sparse.linalg import svd...
bsd-3-clause
qifeigit/scikit-learn
examples/semi_supervised/plot_label_propagation_digits_active_learning.py
294
3417
""" ======================================== Label Propagation digits active learning ======================================== Demonstrates an active learning technique to learn handwritten digits using label propagation. We start by training a label propagation model with only 10 labeled points, then we select the t...
bsd-3-clause
zihua/scikit-learn
sklearn/neural_network/tests/test_stochastic_optimizers.py
146
4310
import numpy as np from sklearn.neural_network._stochastic_optimizers import (BaseOptimizer, SGDOptimizer, AdamOptimizer) from sklearn.utils.testing import (assert_array_equal, assert_true, ...
bsd-3-clause
JackIron/Q_Learning_Games
Second_Q_Learning_Game/Roulette.py
1
1368
import gym #import roulette env from gym.envs.toy_text import roulette #import del tabular q agent import tabular_q_agent_roulette #libreria per generare grafici import matplotlib.pyplot as plt #lib to remove files import os wheel=roulette.RouletteEnv()#make the env agent=tabular_q_agent_roulette.TabularQAgent(wheel...
mit
yarikoptic/seaborn
seaborn/tests/test_linearmodels.py
1
30323
import numpy as np import matplotlib.pyplot as plt import pandas as pd import nose.tools as nt import numpy.testing as npt import pandas.util.testing as pdt from numpy.testing.decorators import skipif try: import statsmodels.api as sm _no_statsmodels = False except ImportError: _no_statsmodels = True fro...
bsd-3-clause
winklerand/pandas
pandas/tests/frame/test_quantile.py
10
15893
# -*- coding: utf-8 -*- from __future__ import print_function import pytest import numpy as np from pandas import (DataFrame, Series, Timestamp, _np_version_under1p11) import pandas as pd from pandas.util.testing import assert_series_equal, assert_frame_equal import pandas.util.testing as tm from pandas.tests.fr...
bsd-3-clause
manjunaths/tensorflow
tensorflow/contrib/learn/python/learn/grid_search_test.py
18
2259
# 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
schets/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
248
6359
r""" ======================================= Robust vs Empirical covariance estimate ======================================= The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers in the data set. In such a case, it would be better to use a robust estimator of covariance to guar...
bsd-3-clause
mahak/spark
python/pyspark/pandas/config.py
14
15723
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
gplepage/lsqfit
examples/bayes.py
1
3318
# Copyright (c) 2017-20 G. Peter Lepage. # # 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 # any later version (see <http://www.gnu.org/licenses/>). # # This ...
gpl-3.0
seokjunbing/cs75
src/ml/svm.py
1
2386
from sklearn import svm from sklearn.model_selection import cross_val_score import sys sys.path.append('/Users/imac/Documents/CS75/liblinear/python') sys.path.append('../') from liblinearutil import * from data_processing.read_data import read_preprocessed_data INPUT_FILE = '../../data/plants/label_scores.txt' FEATURE...
gpl-3.0
MartinSavc/scikit-learn
examples/model_selection/randomized_search.py
201
3214
""" ========================================================================= Comparing randomized search and grid search for hyperparameter estimation ========================================================================= Compare randomized search and grid search for optimizing hyperparameters of a random forest. ...
bsd-3-clause
IndraVikas/scikit-learn
sklearn/calibration.py
137
18876
"""Calibration of predicted probabilities.""" # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Balazs Kegl <balazs.kegl@gmail.com> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Mathieu Blondel <mathieu@mblondel.org> # # License: BSD 3 clause from __future__ impo...
bsd-3-clause
Caranarq/01_Dmine
01_Agua/P0109/P0109.py
1
2757
# -*- coding: utf-8 -*- """ Started on wed, may 9th, 2018 @author: carlos.arana """ # Librerias utilizadas import pandas as pd import sys module_path = r'D:\PCCS\01_Dmine\Scripts' if module_path not in sys.path: sys.path.append(module_path) from VarInt.VarInt import VarInt from classes.Meta import Meta from Compi...
gpl-3.0
NWine/trading-with-python
lib/qtpandas.py
77
7937
''' Easy integration of DataFrame into pyqt framework Copyright: Jev Kuznetsov Licence: BSD ''' from PyQt4.QtCore import (QAbstractTableModel,Qt,QVariant,QModelIndex,SIGNAL) from PyQt4.QtGui import (QApplication,QDialog,QVBoxLayout, QHBoxLayout, QTableView, QPushButton, QWidget,QTabl...
bsd-3-clause
lzamparo/SdA_reduce
utils/sample_h5_SdA_csv.py
1
5280
""" Read the given .h5 files containing SdA reduced data (for a given dimension), and sample a number of labeled points and pack into a data frame. """ ### N.B: this is meant to run in python 3! import sys, re, os import numpy as np import pandas as pd from collections import OrderedDict from tables import * from s...
bsd-3-clause
sumspr/scikit-learn
sklearn/manifold/tests/test_mds.py
324
1862
import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_raises from sklearn.manifold import mds def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
yask123/scikit-learn
sklearn/utils/tests/test_murmurhash.py
261
2836
# Author: Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import numpy as np from sklearn.externals.six import b, u from sklearn.utils.murmurhash import murmurhash3_32 from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from nose.tools import assert_equa...
bsd-3-clause
luo66/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
230
2649
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
glennq/scikit-learn
sklearn/ensemble/tests/test_forest.py
22
41796
""" Testing for the forest module (sklearn.ensemble.forest). """ # Authors: Gilles Louppe, # Brian Holt, # Andreas Mueller, # Arnaud Joly # License: BSD 3 clause import pickle from collections import defaultdict from itertools import combinations from itertools import product import numpy ...
bsd-3-clause
Clyde-fare/scikit-learn
sklearn/decomposition/tests/test_factor_analysis.py
222
3055
# Author: Christian Osendorfer <osendorf@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Licence: BSD3 import numpy as np from sklearn.utils.testing import assert_warns from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing im...
bsd-3-clause
aaltay/beam
sdks/python/apache_beam/runners/interactive/recording_manager.py
1
15752
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
dongjoon-hyun/spark
python/pyspark/pandas/tests/test_dataframe.py
14
222596
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
cleinias/Homeo
src/Helpers/StatsAnalyzer.py
1
11517
''' Created on Jan 4, 2015 Functions that read the logbook produced by a DEAP GA simulation and provide info, stats, and charts about the GA run @author: stefano ''' from deap import tools import pickle import os import matplotlib.pyplot as plt from Helpers.ExceptionAndDebugClasses import hDebug from Helpers.GenomeDe...
gpl-3.0
luo66/scikit-learn
sklearn/tests/test_dummy.py
186
17778
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
soft-matter/mr
vb_suite/benchmarks.py
5
3199
from vbench.api import Benchmark, BenchmarkRunner from datetime import datetime common_setup = """ import mr import numpy as np import pandas as pd from pandas import DataFrame, Series def random_walk(N): return np.cumsum(np.random.randn(N)) """ setup = common_setup + """ def draw_gaussian_spot(image, pos, r): ...
gpl-3.0
tonnrueter/pymca_devel
cx_setup.py
1
16231
# A cx_freeze setup script to create PyMca executables # # Use "python cx_setup.py install" # # It expects a properly configured compiler. # # Under windows you may need to set MINGW = True (untested) if you are # not using VS2003 (python 2.5) or VS2008 (python > 2.5) # # If everything works well one should find a dire...
gpl-2.0
marionleborgne/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/table.py
69
16757
""" Place a table below the x-axis at location loc. The table consists of a grid of cells. The grid need not be rectangular and can have holes. Cells are added by specifying their row and column. For the purposes of positioning the cell at (0, 0) is assumed to be at the top left and the cell at (max_row, max_col) i...
agpl-3.0
jvivian/rnaseq-lib
src/rnaseq_lib/dim_red/__init__.py
1
1376
import numpy as np import pandas as pd from sklearn.manifold import TSNE from trimap import trimap def run_trimap(df, num_dims=2, kin=50, kout=5, krand=5, eta=10000.0): """ Runs t-ETE dimensionality reduction :param pd.DataFrame df: Dataframe or numpy array. Features need to be columns. :param int n...
mit
simonvh/fluff
fluff/color.py
1
3291
# Define colors and color utilities for plots # # Copyright (c) 2012-2013 Simon van Heeringen <s.vanheeringen@ncmls.ru.nl> # # This script is free software. You can redistribute it and/or modify it under # the terms of the MIT License # use pallettable to use colorbrewer from functools import reduce from palettable i...
mit
garaud/ezhc
ezhc/samples/build_samples.py
2
50033
import numpy as np import pandas as pd import json def df_one_idx_several_col(): dic = {'John': [5, 3, 4, 7, 2], 'Jane': [2, 2, 3, 2, 1], 'Joe': [3, 4, 4, 2, 5]} df = pd.DataFrame.from_dict(dic) df.index = ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] df.index.name = 'F...
mit
AWNystrom/SparseInteraction
paper/Final/code/simple_plots.py
1
6590
from scipy.sparse import random, vstack from sparse_polynomial_features import SparsePolynomialFeatures from dense_polynomial_features import DensePolynomialFeatures as PolynomialFeatures from time import time import numpy as np import matplotlib.pyplot as plt from code import interact import cPickle from sys import ar...
apache-2.0
jdavidrcamacho/Tests_GP
03 - RV tests/RV_function.py
1
3896
# -*- coding: utf-8 -*- """ Created on Fri Feb 3 11:36:58 2017 @author: camacho """ import numpy as np import matplotlib.pyplot as pl pl.close("all") ##### RV FUNCTION 1 - circular orbit def RV_circular(P=365,K=0.1,T=0,gamma=0,time=100,space=20): #parameters #P = period in days #K = semi-amplitude of t...
mit
ningchi/scikit-learn
examples/linear_model/plot_ols.py
45
1985
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Linear Regression Example ========================================================= This example uses the only the first feature of the `diabetes` dataset, in order to illustrate a two-dimensional plot of this regre...
bsd-3-clause
wzbozon/scikit-learn
sklearn/linear_model/logistic.py
57
65098
""" Logistic Regression """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # Fabian Pedregosa <f@bianp.net> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Manoj Kumar <manojkumarsivaraj334@gmail.com> # Lars Buitinck # Simon Wu <s8wu@uwaterloo.ca> imp...
bsd-3-clause
jayflo/scikit-learn
sklearn/neighbors/base.py
115
29783
"""Base and mixin classes for nearest neighbors""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output...
bsd-3-clause
DonBeo/scikit-learn
sklearn/datasets/tests/test_mldata.py
384
5221
"""Test functionality of mldata fetching utilities.""" import os import shutil import tempfile import scipy as sp from sklearn import datasets from sklearn.datasets import mldata_filename, fetch_mldata from sklearn.utils.testing import assert_in from sklearn.utils.testing import assert_not_in from sklearn.utils.test...
bsd-3-clause
Sentient07/scikit-learn
examples/missing_values.py
71
3055
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause
jakevdp/scipy
doc/source/tutorial/stats/plots/kde_plot4.py
142
1457
from functools import partial import numpy as np from scipy import stats import matplotlib.pyplot as plt def my_kde_bandwidth(obj, fac=1./5): """We use Scott's Rule, multiplied by a constant factor.""" return np.power(obj.n, -1./(obj.d+4)) * fac loc1, scale1, size1 = (-2, 1, 175) loc2, scale2, size2 = (2, ...
bsd-3-clause
VoigtLab/dnaplotlib
gallery/sbol_interactive/sbol_viewer.py
1
3526
#!/usr/bin/env python """ Recombinase NOT-gate """ PROMOTER = "http://purl.obolibrary.org/obo/SO_0000167" RBS = "http://purl.obolibrary.org/obo/SO_0000552" CDS = "http://purl.obolibrary.org/obo/SO_0000316" TERMINATOR = "http://purl.obolibrary.org/obo/SO_0000139" import sbol import assembly import math import dnaplo...
mit
pratapvardhan/pandas
pandas/core/indexes/multi.py
1
103821
# pylint: disable=E1101,E1103,W0232 import datetime import warnings from sys import getsizeof import numpy as np from pandas._libs import algos as libalgos, index as libindex, lib, Timestamp from pandas.compat import range, zip, lrange, lzip, map from pandas.compat.numpy import function as nv from pandas import comp...
bsd-3-clause
laserson/vdj
analysis.py
2
34178
# Copyright 2014 Uri Laserson # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
apache-2.0
hsuantien/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause