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
0asa/scikit-learn
examples/cluster/plot_digits_linkage.py
369
2959
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
bsd-3-clause
lukebarnard1/bokeh
sphinx/source/docs/tutorials/solutions/stocks.py
23
2799
### ### NOTE: This exercise requires a network connection ### import numpy as np import pandas as pd from bokeh.plotting import figure, output_file, show, VBox # Here is some code to read in some stock data from the Yahoo Finance API AAPL = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=...
bsd-3-clause
pravsripad/mne-python
tutorials/stats-source-space/plot_stats_cluster_time_frequency_repeated_measures_anova.py
16
10098
""" .. _tut-timefreq-twoway-anova: ==================================================================== Mass-univariate twoway repeated measures ANOVA on single trial power ==================================================================== This script shows how to conduct a mass-univariate repeated measures ANOVA. ...
bsd-3-clause
YihaoLu/statsmodels
statsmodels/sandbox/tests/test_predict_functional.py
29
12873
from statsmodels.sandbox.predict_functional import predict_functional import numpy as np import pandas as pd import statsmodels.api as sm from numpy.testing import dec # If true, the output is written to a multi-page pdf file. pdf_output = False try: import matplotlib.pyplot as plt import matplotlib have_...
bsd-3-clause
pubnub/Zopkio
zopkio/test_runner.py
1
22763
# Copyright 2015 LinkedIn Corp. # # 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....
apache-2.0
Sentient07/scikit-learn
sklearn/metrics/classification.py
7
72557
"""Metrics to assess performance on classification task given class prediction Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramf...
bsd-3-clause
jsamoocha/pysweat
pysweat/persistence/activities.py
1
2104
from pymongo import UpdateOne import pandas as pd import numpy as np import json import logging from pymongo.errors import BulkWriteError def load_activities(mongo, **query): return pd.DataFrame(list(mongo.db.activities.find(query))) def __should_write_field(key, value): if key != 'strava_id': try:...
apache-2.0
shahankhatch/scikit-learn
examples/missing_values.py
233
3056
""" ====================================================== 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
tynano/slicematrixIO-python
slicematrixIO/matrices.py
1
3516
from core import BasePipeline from utils import rando_name from uuid import uuid4 import pandas as pd class DistanceMatrixPipeline(BasePipeline): def __init__(self, name, kernel = "euclidean", geodesic = False, K = 5, kernel_params = {}, client = None): params = {"k": K, "kernel": kernel,...
mit
houghb/savvy
savvy/plotting.py
2
22776
""" This module creates plots for visualizing sensitivity analysis dataframes. `make_plot()` creates a radial plot of the first and total order indices. `make_second_order_heatmap()` creates a square heat map showing the second order interactions between model parameters. """ from collections import OrderedDict imp...
bsd-2-clause
leesavide/pythonista-docs
Documentation/matplotlib/mpl_examples/pylab_examples/legend_auto.py
3
2281
""" This file was written to test matplotlib's autolegend placement algorithm, but shows lots of different ways to create legends so is useful as a general examples Thanks to John Gill and Phil ?? for help at the matplotlib sprint at pycon 2005 where the auto-legend support was written. """ from pylab import * import ...
apache-2.0
pgdr/ert
share/workflows/jobs/internal-gui/scripts/gen_data_rft_export.py
1
8462
import os import re import numpy import pandas from PyQt4.QtGui import QCheckBox from ecl.ecl.rft import WellTrajectory from res.enkf import ErtPlugin, CancelPluginException from res.enkf import RealizationStateEnum from res.enkf.enums import EnkfObservationImplementationType from res.enkf.export import GenDataCollec...
gpl-3.0
nmartensen/pandas
pandas/tests/io/msgpack/test_unpack.py
22
1948
from io import BytesIO import sys from pandas.io.msgpack import Unpacker, packb, OutOfData, ExtType import pytest class TestUnpack(object): def test_unpack_array_header_from_file(self): f = BytesIO(packb([1, 2, 3, 4])) unpacker = Unpacker(f) assert unpacker.read_array_header() == 4 ...
bsd-3-clause
aruneral01/auto-sklearn
autosklearn/submit_process.py
5
5215
import shlex import os import subprocess import lockfile import autosklearn.cli.SMAC_cli_holdout from autosklearn.constants import * def submit_call(call, seed, log_dir=None): print "Calling: " + call call = shlex.split(call) if log_dir is None: proc = subprocess.Popen(call, stdout=open(os.devn...
bsd-3-clause
PyCQA/pydocstyle
src/tests/test_cases/canonical_numpy_examples.py
3
5315
"""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...
mit
wschenck/nest-simulator
examples/nest/Potjans_2014/spike_analysis.py
20
6437
# -*- coding: utf-8 -*- # # spike_analysis.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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 2 of the License,...
gpl-2.0
mohseniaref/PySAR-1
pysar/add.py
1
3771
#! /usr/bin/env python ############################################################ # Program is part of PySAR v1.0 # # Copyright(c) 2013, Heresh Fattahi # # Author: Heresh Fattahi # #####################################################...
mit
rc/gensei
volume_slicer.py
1
10647
#!/usr/bin/env python import os, glob, copy, time from optparse import OptionParser import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import colorConverter from gensei.base import * from gensei import Objects, Box from gensei.utils import get_suffix def generate_slices(objects, box, options, o...
bsd-3-clause
tareqmalas/girih
scripts/sisc/paper_energy_analysis.py
2
3824
#!/usr/bin/env python def main(): import sys raw_data = load_csv(sys.argv[1]) create_table(raw_data) def get_stencil_num(k): # add the stencil operator if k['Stencil Kernel coefficients'] in 'constant': if int(k['Stencil Kernel semi-bandwidth'])==4: stencil = '25pt_const' ...
bsd-3-clause
Pinafore/qb
protobowl_user.py
2
3709
import os import itertools import numpy as np import pandas as pd import matplotlib matplotlib.use("Agg") from multiprocessing import Pool from datetime import datetime from plotnine import ( ggplot, aes, theme, geom_density, geom_histogram, geom_point, scale_color_gradient, ) from qanta.b...
mit
MingdaZhou/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
chvogl/tardis
tardis/util.py
7
13796
# Utilities for TARDIS from astropy import units as u, constants, units import numpy as np import os import yaml import re import logging import atomic k_B_cgs = constants.k_B.cgs.value c_cgs = constants.c.cgs.value h_cgs = constants.h.cgs.value m_e_cgs = constants.m_e.cgs.value e_charge_gauss = constants.e.gauss.v...
bsd-3-clause
hposborn/Namaste
namaste/run.py
1
66119
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' :py:mod:`Namaste.py` - Single transit fitting code ------------------------------------- ''' import numpy as np import pylab as plt import scipy.optimize as optimize from os import sys, path import datetime import logging import pandas as pd import click import emcee...
mit
rallured/PyXFocus
examples/axro/retraceError.py
1
1996
import numpy as np import matplotlib.pyplot as plt import pdb import scipy.optimize as opt import traces.surfaces as surf import traces.transformations as tran import traces.analyses as anal import traces.sources as sources import traces.conicsolve as conic pcoeff,pax,paz = np.genfromtxt('/home/rallured/Dropbox/AXRO/...
mit
xmnlab/minilab
labtrans/daq/prepare_data.py
1
2713
from __future__ import division from datetime import timedelta, datetime from collections import defaultdict from matplotlib.ticker import EngFormatter import matplotlib.pyplot as plt import pickle import sys from copy import deepcopy import numpy as np # mswim module path sys.path.insert(0, '/var/www/mswim/') # msw...
gpl-3.0
vigilv/scikit-learn
examples/svm/plot_svm_margin.py
318
2328
#!/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
fabioticconi/scikit-learn
sklearn/datasets/lfw.py
31
19544
"""Loader for the Labeled Faces in the Wild (LFW) dataset This dataset is a collection of JPEG pictures of famous people collected over the internet, all details are available on the official website: http://vis-www.cs.umass.edu/lfw/ Each picture is centered on a single face. The typical task is called Face Veri...
bsd-3-clause
mjgrav2001/scikit-learn
examples/manifold/plot_lle_digits.py
181
8510
""" ============================================================================= Manifold learning on handwritten digits: Locally Linear Embedding, Isomap... ============================================================================= An illustration of various embeddings on the digits dataset. The RandomTreesEmbed...
bsd-3-clause
sebalander/sebaPhD
resources/PTZgrid/cornerFinderPtzGrid.py
1
2649
# -*- coding: utf-8 -*- """ Created on Wed Jul 27 13:34:13 2016 @author: sebalander """ # %% import cv2 import numpy as np import matplotlib.pyplot as plt # %% # input # 6x9 chessboard #imageFile = "./resources/fishChessboard/Screenshot from fishSeba.mp4 - 12.png" # 8x11 A4 shetts chessboard imageFile = "ptz_(0....
bsd-3-clause
LouisPlisso/analysis_tools
cdfplot-tools/cdfplot_1.3.py
1
13501
#!/usr/bin/env python "Module to plot cdf from data or file. Can be called directly." from __future__ import division, print_function from optparse import OptionParser import sys import pylab from matplotlib.font_manager import FontProperties _VERSION = '1.2' #TODO: possibility to place legend outside graph: #pylab...
gpl-3.0
jgomezc1/FEM-Notes
scripts/SPRINGS/springs.py
1
4460
# -*- coding: utf-8 -*- """ Computes the displacements and internal forces for a mass-springs system under static loads. Variables ---------- ne : number of elements nn : number of nodes nm : number of material profiles nl : number of point loads IDN[] : Stores the nodal indentifier IBC[] : Stores the nodal boundary...
mit
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/sklearn/neighbors/regression.py
8
10967
"""Nearest Neighbor Regression""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck # Multi-output support by Arnaud Joly <a.joly@ulg.ac...
mit
daodaoliang/neural-network-animation
matplotlib/texmanager.py
11
25173
""" This module supports embedded TeX expressions in matplotlib via dvipng and dvips for the raster and postscript backends. The tex and dvipng/dvips information is cached in ~/.matplotlib/tex.cache for reuse between sessions Requirements: * latex * \*Agg backends: dvipng * PS backend: latex w/ psfrag, dvips, and Gh...
mit
hmmlearn/hmmlearn
examples/plot_hmm_sampling.py
1
1974
""" Sampling from HMM ----------------- This script shows how to sample points from a Hidden Markov Model (HMM): we use a 4-state model with specified mean and covariance. The plot show the sequence of observations generated with the transitions between them. We can see that, as specified by our transition matrix, th...
bsd-3-clause
elijah513/scikit-learn
examples/linear_model/plot_logistic.py
312
1426
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logit function ========================================================= Show in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or two, u...
bsd-3-clause
zctea/biocode
sandbox/jorvis/summarize_vcfannotator.py
3
4385
#!/usr/bin/env python3.2 ''' The goal here is to take any VCF file output by VCFannotator and summarize the SNPs contained there by type. INPUT The input expected is from the VCFannotator documentation: An example output line transposed to a column format would look like so (taken from the sample data): 0 TY-...
gpl-3.0
zmlabe/IceVarFigs
Scripts/SeaIce/plot_Walsh_ExtendedSeaIceConc_v2.py
1
5055
""" Plot sea ice concentration from last 100 years using the Walsh reconstruction for version 2 Website : https://nsidc.org/data/g10010 Author : Zachary M. Labe Date : 2 June 2020 """ from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, addcyclic, shiftgrid i...
mit
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/core/reshape/concat.py
2
21484
""" concat routines """ import numpy as np from pandas import compat, DataFrame, Series, Index, MultiIndex from pandas.core.index import (_get_objs_combined_axis, _ensure_index, _get_consensus_names, _all_indexes_same) from pandas.core.categorical import (_...
apache-2.0
bilgili/nest-simulator
testsuite/manualtests/test_tsodyks_depr_fac.py
13
1136
# -*- coding: utf-8 -*- # # test_tsodyks_depr_fac.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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 2 of the L...
gpl-2.0
marcocaccin/scikit-learn
sklearn/manifold/setup.py
99
1243
import os from os.path import join import numpy from numpy.distutils.misc_util import Configuration from sklearn._build_utils import get_blas_info def configuration(parent_package="", top_path=None): config = Configuration("manifold", parent_package, top_path) libraries = [] if os.name == 'posix': ...
bsd-3-clause
cwebster2/pyMeteo
pymeteo/skewt.py
1
45186
#!/usr/bin/env python """ .. module:: pymeteo.skewt :platform: Unix, Windows :synopsis: Skew-T/Log-P plotting .. moduleauthor:: Casey Webster <casey.webster@gmail.com> This module allows plotting Skew-T/Log-P diagrams and hodographs from arrays of data with helper functions to plot directly from CM1 output fi...
bsd-3-clause
sauloal/cnidaria
scripts/venv/lib/python2.7/site-packages/matplotlib/rcsetup.py
10
33270
""" The rcsetup module contains the default values and the validation code for customization using matplotlib's rc settings. Each rc setting is assigned a default value and a function used to validate any attempted changes to that setting. The default values and validation functions are defined in the rcsetup module, ...
mit
cavestruz/L500analysis
plotting/profiles/T_evolution/T_halo_overdensity/Tnt/plot_Tnt_mean.py
1
3362
from L500analysis.data_io.get_cluster_data import GetClusterData from L500analysis.utils.utils import aexp2redshift,redshift2aexp from L500analysis.plotting.tools.figure_formatting import * from L500analysis.plotting.profiles.tools.profiles_percentile \ import * from L500analysis.utils.constants import rbins from d...
mit
datapythonista/pandas
pandas/tests/tseries/offsets/test_ticks.py
4
10779
""" Tests for offsets.Tick and subclasses """ from datetime import ( datetime, timedelta, ) from hypothesis import ( assume, example, given, settings, strategies as st, ) import numpy as np import pytest from pandas._libs.tslibs.offsets import delta_to_tick from pandas import ( Timede...
bsd-3-clause
robbymeals/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
103
41083
from itertools import product import numpy as np from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dok_matrix, lil_matrix) from sklearn.cross_validation import train_test_split from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
hugobowne/scikit-learn
sklearn/linear_model/tests/test_ransac.py
52
17482
from scipy import sparse import numpy as np from scipy import sparse from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from sklearn.utils import check_random_state from sklearn.utils.testing import assert_raises_rege...
bsd-3-clause
nzavagli/UnrealPy
UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/numpy-1.9.2/numpy/core/function_base.py
23
6262
from __future__ import division, absolute_import, print_function __all__ = ['logspace', 'linspace'] from . import numeric as _nx from .numeric import array, result_type def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None): """ Return evenly spaced numbers over a specified interval. ...
mit
CompPhysics/ThesisProjects
doc/MSc/msc_students/former/sean/Thesis/Codes/PythonCode/MBPT4.py
1
4664
from sympy import * from pylab import * import matplotlib.pyplot as plt #below_fermi = (0,1,2,3) #above_fermi = (4,5,6,7) #states = [(1,1),(1,-1),(2,1),(2,-1),(3,1),(3,-1),(4,1),(4,-1)] N = 4 NB = 8 g = Symbol('g') #linear in energy (not box potential) def makeStateSpace(N,NB): #N = num of particles, NB = size of bas...
cc0-1.0
humdings/zipline
tests/utils/test_pandas_utils.py
3
6827
""" Tests for zipline/utils/pandas_utils.py """ import pandas as pd from zipline.testing import parameter_space, ZiplineTestCase from zipline.testing.predicates import assert_equal from zipline.utils.pandas_utils import ( categorical_df_concat, nearest_unequal_elements ) class TestNearestUnequalElements(Zipl...
apache-2.0
ApolloAuto/apollo
modules/tools/prediction/data_pipelines/cruise_models.py
3
5275
#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo 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...
apache-2.0
stober/utils
src/plot_utils.py
1
3102
#! /usr/bin/env python """ Author: Jeremy M. Stober Program: PLOTUTILS.PY Date: Wednesday, April 21 2010 Description: Routines for common plot operations. """ import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d import art3d import matplotlib.pyplot as plt from matplotlib.path imp...
bsd-2-clause
vivekmishra1991/scikit-learn
examples/cluster/plot_ward_structured_vs_unstructured.py
320
3369
""" =========================================================== Hierarchical clustering: structured vs unstructured ward =========================================================== Example builds a swiss roll dataset and runs hierarchical clustering on their position. For more information, see :ref:`hierarchical_clus...
bsd-3-clause
jseabold/scikit-learn
examples/cluster/plot_kmeans_digits.py
230
4524
""" =========================================================== A demo of K-Means clustering on the handwritten digits data =========================================================== In this example we compare the various initialization strategies for K-means in terms of runtime and quality of the results. As the gr...
bsd-3-clause
crazy-cat/incubator-mxnet
example/speech_recognition/stt_utils.py
44
5892
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
iABC2XYZ/abc
Epics/DataAna10.1.py
1
5064
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Oct 27 15:44:34 2017 @author: p """ import numpy as np import tensorflow as tf import matplotlib.pyplot as plt plt.close('all') def GenWeight(shape): initial = tf.truncated_normal(shape, stddev=1.) return tf.Variable(initial) def GenBias(shap...
gpl-3.0
xzh86/scikit-learn
sklearn/tests/test_base.py
216
7045
# Author: Gael Varoquaux # License: BSD 3 clause import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn.utils.testing impo...
bsd-3-clause
alisidd/tensorflow
tensorflow/examples/learn/wide_n_deep_tutorial.py
29
8985
# 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
re-innovation/CSVviewer
windrose.py
1
20019
#!/usr/bin/env python # -*- coding: utf-8 -*- """ application.py @author: James Fowkes Adapted from Lionel Roubeyrie as below. Generates windrose plot of speed/direction data """ __version__ = '1.4' __author__ = 'Lionel Roubeyrie' __mail__ = 'lionel.roubeyrie@gmail.com' __license__ = 'CeCILL-B' # This module uses...
gpl-2.0
gdooper/scipy
scipy/signal/waveforms.py
11
17267
# Author: Travis Oliphant # 2003 # # Feb. 2010: Updated by Warren Weckesser: # Rewrote much of chirp() # Added sweep_poly() from __future__ import division, print_function, absolute_import import numpy as np from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \ exp, cos, sin, polyval, po...
bsd-3-clause
kyleabeauchamp/HMCNotes
code/old/test_ghmc_respa.py
1
1175
import lb_loader import numpy as np import pandas as pd import simtk.openmm as mm from simtk import unit as u from openmmtools import hmc_integrators, testsystems pd.set_option('display.width', 1000) platform = mm.Platform_getPlatformByName("CUDA") platform_properties = dict(CudaPrecision="single") n_steps = 2500 tem...
gpl-2.0
accpy/accpy
accpy/gui/simulate.py
2
14528
# -*- coding: utf-8 -*- ''' accpy.gui.simulate author: felix.kramer(at)physik.hu-berlin.de ''' from __future__ import division try: from Tkinter import N, E, S, W, LabelFrame, _setit, BOTH from tkFileDialog import askopenfilename from tkMessageBox import showerror except: from tkinter import N, E, S...
gpl-3.0
miti0/mosquito
market_stats.py
1
15543
""" import configargparse from stats.stats import Stats def main(): stats = Stats() stats.run() if __name__ == "__main__": arg_parser = configargparse.get_argument_parser() arg_parser.add('-c', '--config', is_config_file=True, help='config file path', default='mosquito.ini') arg_parser.add("--li...
gpl-3.0
scienceopen/madrigalgps
dev/full2.py
1
8980
from __future__ import division from datetime import datetime from ephem import readtle,Observer import numpy as np from pandas import date_range, DataFrame,Panel from pandas.io.pytables import read_hdf from re import search import h5py import matplotlib.pyplot as plt from time import time from glob import gl...
gpl-3.0
Srisai85/scikit-learn
sklearn/cluster/birch.py
207
22706
# Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Joel Nothman <joel.nothman@gmail.com> # License: BSD 3 clause from __future__ import division import warnings import numpy as np from scipy import sparse from math import sqrt fro...
bsd-3-clause
qifeigit/scikit-learn
examples/model_selection/plot_validation_curve.py
229
1823
""" ========================== Plotting Validation Curves ========================== In this plot you can see the training scores and validation scores of an SVM for different values of the kernel parameter gamma. For very low values of gamma, you can see that both the training score and the validation score are low. ...
bsd-3-clause
russel1237/scikit-learn
examples/tree/plot_tree_regression_multioutput.py
206
1800
""" =================================================================== Multi-output Decision Tree Regression =================================================================== An example to illustrate multi-output regression with decision tree. The :ref:`decision trees <tree>` is used to predict simultaneously the ...
bsd-3-clause
0asa/scikit-learn
examples/ensemble/plot_gradient_boosting_regularization.py
355
2843
""" ================================ Gradient Boosting regularization ================================ Illustration of the effect of different regularization strategies for Gradient Boosting. The example is taken from Hastie et al 2009. The loss function used is binomial deviance. Regularization via shrinkage (``lear...
bsd-3-clause
karvenka/sp17-i524
project/S17-IO-3012/code/bin/benchmark_replicas_import.py
19
5474
import matplotlib.pyplot as plt import sys import pandas as pd def get_parm(): """retrieves mandatory parameter to program @param: none @type: n/a """ try: return sys.argv[1] except: print ('Must enter file name as parameter') exit() def read_file(filename): """...
apache-2.0
ToniRV/Learning-to-navigate-without-a-map
rlvision/exps/pg_16_exp.py
1
7091
"""Policy Gradient for Grid 16x16. It's Keras 2! Author: Yuhuang Hu Email : duguyue100@gmail.com """ from __future__ import print_function import os import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers import Dense, Flatten, InputLayer from keras.layers import Conv...
mit
SchadkoAO/FDTD_Solver
postprocessing/calculate_max.py
2
3747
import numpy as np import matplotlib.pyplot as plt import argparse import traceback import tarfile import os import re import time def read_tarinfo(fname): tar = tarfile.open(fname) return list(tar.getmembers()), tar def read(file, tar_info): f = file.extractfile(tar_info) if f is None: retu...
mit
beepee14/scikit-learn
examples/classification/plot_digits_classification.py
289
2397
""" ================================ Recognizing hand-written digits ================================ An example showing how the scikit-learn can be used to recognize images of hand-written digits. This example is commented in the :ref:`tutorial section of the user manual <introduction>`. """ print(__doc__) # Autho...
bsd-3-clause
saketkc/statsmodels
statsmodels/sandbox/examples/thirdparty/findow_0.py
33
2147
# -*- coding: utf-8 -*- """A quick look at volatility of stock returns for 2009 Just an exercise to find my way around the pandas methods. Shows the daily rate of return, the square of it (volatility) and a 5 day moving average of the volatility. No guarantee for correctness. Assumes no missing values. colors of lines...
bsd-3-clause
TomAugspurger/pandas
pandas/tests/frame/methods/test_at_time.py
1
3150
from datetime import time import numpy as np import pytest import pytz from pandas import DataFrame, date_range import pandas._testing as tm class TestAtTime: def test_at_time(self): rng = date_range("1/1/2000", "1/5/2000", freq="5min") ts = DataFrame(np.random.randn(len(rng), 2), index=rng) ...
bsd-3-clause
zuku1985/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
78
17611
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from numpy.random import RandomState from sklearn.datasets import make_classification from sklearn.utils.s...
bsd-3-clause
mxjl620/scikit-learn
sklearn/feature_selection/rfe.py
64
17509
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import warnings import numpy as np from ..utils import check_X_y, safe_sqr fro...
bsd-3-clause
elisamussumeci/InfoDenguePredict
infodenguepredict/models/deeplearning/mlp.py
2
2833
""" Created on 27/01/17 by fccoelho license: GPL V3 or Later adapted from this example: http://machinelearningmastery.com/time-series-prediction-with-deep-learning-in-python-with-keras/ """ import numpy as np import pandas as pd from time import time from matplotlib import pyplot as P from sklearn import preprocessing...
gpl-3.0
plotly/dash-core-components
tests/integration/graph/test_graph_basics.py
1
4985
import pytest import pandas as pd from multiprocessing import Value, Lock import numpy as np from time import sleep import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output import dash.testing.wait as wait @pytest.mark.parametrize("is_eager", [Tru...
mit
karthikvadla16/spark-tk
regression-tests/sparktkregtests/testcases/scoretests/logistic_regression_test.py
12
2456
# 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
apache/flink
flink-python/pyflink/table/tests/test_pandas_udaf.py
5
37026
################################################################################ # 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...
apache-2.0
jzt5132/scikit-learn
sklearn/ensemble/weight_boosting.py
71
40664
"""Weight Boosting This module contains weight boosting estimators for both classification and regression. The module structure is the following: - The ``BaseWeightBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regression and classification only differ from each ot...
bsd-3-clause
miloharper/neural-network-animation
matplotlib/sphinxext/plot_directive.py
11
26894
""" A directive for including a matplotlib plot in a Sphinx document. By default, in HTML output, `plot` will include a .png file with a link to a high-res .png and .pdf. In LaTeX output, it will include a .pdf. The source code for the plot may be included in one of three ways: 1. **A path to a source file** as t...
mit
scribble/scribble.github.io
src/main/jbake/assets/docs/lchannels/scripts/plot-benchmark.py
2
2325
#!/usr/bin/env python import matplotlib.pyplot as plotlib import numpy import sys DELIMITER = ',' def makePlot(infile, outfile): import matplotlib matplotlib.rcParams.update({'font.size': 12}) (title, headers) = readTitleAndHeaders(infile) data = numpy.genfromtxt(infile, ...
apache-2.0
ContinuumIO/blaze
blaze/compute/tests/test_numpy_compute.py
3
20852
from __future__ import absolute_import, division, print_function import pytest import itertools import numpy as np import pandas as pd from datetime import datetime, date from blaze.compute.core import compute, compute_up from blaze.expr import symbol, by, exp, summary, Broadcast, join, concat from blaze.expr impo...
bsd-3-clause
teasherm/models
vanilla_gan/main.py
1
1943
import os import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np import tensorflow as tf from tqdm import tqdm from datasets.mnist import load as load_mnist from lib.utils import get_batches_per_epoch from vanilla_gan import model def sample_z(batch_size, z_dim): return np.rando...
unlicense
AnasGhrab/scikit-learn
examples/linear_model/plot_sgd_comparison.py
167
1659
""" ================================== 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
TomAugspurger/pandas
pandas/core/indexes/range.py
1
27484
from datetime import timedelta import operator from sys import getsizeof from typing import Any, Optional import warnings import numpy as np from pandas._libs import index as libindex from pandas._libs.lib import no_default from pandas._typing import Label import pandas.compat as compat from pandas.compat.numpy impor...
bsd-3-clause
WayneDW/Sentiment-Analysis-in-Event-Driven-Stock-Price-Movement-Prediction
archived/tfidf_tsne.py
1
1827
# Adopted from https://github.com/lazyprogrammer/machine_learning_examples/blob/master/nlp_class2/tfidf_tsne.py import json import numpy as np import matplotlib.pyplot as plt from sklearn.utils import shuffle from sklearn.manifold import TSNE from datetime import datetime # import os # import sys # sys.path.append(os...
mit
leonth/bulk-download-quandl
bulkdlquandl.py
1
3384
import itertools import logging import io import os import asyncio as aio import aiohttp import pandas as pd logger = logging.getLogger(__name__) logging.basicConfig(level=logging.DEBUG) logging.getLogger('asyncio').setLevel(logging.WARNING) # tone down asyncio debug messages from settings import DL_DIR, AUTH_TOKEN...
mit
halwai/cvxpy
examples/extensions/kmeans.py
11
3555
import cvxpy as cvx import mixed_integer as mi print(__doc__) from time import time import numpy as np import matplotlib.pyplot as plt from sklearn import metrics from sklearn.cluster import KMeans from sklearn.datasets import load_digits from sklearn.decomposition import PCA from sklearn.preprocessing import scale ...
gpl-3.0
larroy/mxnet
example/rcnn/symdata/vis.py
11
1559
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
crichardson17/starburst_atlas
Low_resolution_sims/DustFree_LowRes/Padova_cont/padova_cont_4/peaks_reader.py
33
2761
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
parantapa/seaborn
seaborn/timeseries.py
13
15218
"""Timeseries plotting functions.""" from __future__ import division import numpy as np import pandas as pd from scipy import stats, interpolate import matplotlib as mpl import matplotlib.pyplot as plt from .external.six import string_types from . import utils from . import algorithms as algo from .palettes import c...
bsd-3-clause
holdenk/spark
python/pyspark/sql/tests/test_pandas_udf_typehints.py
22
9603
# # 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
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/pandas/tseries/index.py
9
75758
# pylint: disable=E1101 from __future__ import division import operator import warnings from datetime import time, datetime from datetime import timedelta import numpy as np from pandas.core.common import (_NS_DTYPE, _INT64_DTYPE, _values_from_object, _maybe_box, ...
gpl-2.0
gfyoung/pandas
pandas/tests/series/methods/test_clip.py
2
3378
import numpy as np import pytest import pandas as pd from pandas import Series, Timestamp, isna, notna import pandas._testing as tm class TestSeriesClip: def test_clip(self, datetime_series): val = datetime_series.median() assert datetime_series.clip(lower=val).min() == val assert dateti...
bsd-3-clause
bcharlas/mytrunk
doc/sphinx/ipython_directive.py
8
18579
# -*- coding: utf-8 -*- """Sphinx directive to support embedded IPython code. This directive allows pasting of entire interactive IPython sessions, prompts and all, and their code will actually get re-executed at doc build time, with all prompts renumbered sequentially. To enable this directive, simply list it in you...
gpl-2.0
krisaju95/NewsArticleClustering
module7_skMeansClustering.py
1
7438
import pickle import numpy as np import pandas as pd import os import math path = "C:/Users/hp/Desktop/FINAL YEAR PROJECT/S8/" D = set() A = [] words = set() dataFrame2 = pickle.load( open(os.path.join(path, 'Feature Set','dataFrame2.p'), "rb" )) dataFrame3 = pickle.load( open(os.path.join(path, 'Feature ...
gpl-3.0
nlholdem/icodoom
ICO1/deep_feedback_learning_old/plotOutputs.py
4
2070
import numpy as np from numpy import genfromtxt import matplotlib.pyplot as plt #data_or = genfromtxt("test_deep_fbl_cpp_feedback_learning_or.dat", delimiter=" ") #data_xor = genfromtxt("test_deep_fbl_cpp_feedback_learning_xor.dat", delimiter=" ") #data_and = genfromtxt("test_deep_fbl_cpp_feedback_learning_and.dat", d...
gpl-3.0
ericdill/PyXRF
pyxrf/model/fit_spectrum.py
1
24546
# ###################################################################### # Copyright (c) 2014, Brookhaven Science Associates, Brookhaven # # National Laboratory. All rights reserved. # # # # Redistribution and use in ...
bsd-3-clause
sumspr/scikit-learn
sklearn/tests/test_cross_validation.py
27
41664
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy import stats from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn...
bsd-3-clause