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
tim777z/opencog
opencog/python/spatiotemporal/demo.py
33
1221
__author__ = 'sebastian' from spatiotemporal.temporal_events.trapezium import TemporalEventTrapezium from spatiotemporal.temporal_events.relation_formulas import FormulaCreator from spatiotemporal.temporal_events.composition.non_linear_least_squares import DecompositionFitter import matplotlib.pyplot as plt all_rel...
agpl-3.0
phoebe-project/phoebe2-docs
2.2/tutorials/requiv.py
1
3172
#!/usr/bin/env python # coding: utf-8 # Equivalent Radius # ============================ # # Setup # ----------------------------- # Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the lates...
gpl-3.0
dgketchum/MT_Rsense
obspnts/obsio/providers/ghcnd.py
1
21917
from .. import LOCAL_DATA_PATH from ..util.misc import download_if_new_ftp, open_remote_file from .generic import ObsIO from ftplib import FTP from multiprocessing.pool import Pool import gc import numpy as np import os import pandas as pd import sys import tarfile _NETWORK_CODE_TO_SUBPROVIDER = {'0': '', '1': 'CoCoRa...
apache-2.0
henningjp/CoolProp
dev/scripts/ideal_curves.py
2
5121
import numpy as np import matplotlib.pyplot as plt import CoolProp, scipy.optimize class CurveTracer(object): def __init__(self, backend, fluid, p0, T0): """ p0 : Initial pressure [Pa] T0 : Initial temperatrure [K] """ self.P = [p0] self.T = [] self.AS = Co...
mit
paulsbrookes/cqed_sims_qutip
monte/stochastic_solve.py
1
3579
import numpy as np from qutip import * from pylab import * from scipy.fftpack import fft import matplotlib.pyplot as plt from datetime import datetime import os # runfile('C:/Users/User/Documents/Python Scripts/untitled3.py', # wdir='C:/Users/User/Documents/Python Scripts', # args="5450...
apache-2.0
chaowu2009/stereo-vo
tools/testPoseEstimation.py
1
2875
#!/usr/bin/env python import cv2 import numpy as np from matplotlib import pylab as plt # Camera internals focal_length = 718.856 center = (607.1928, 185.2157) camera_matrix = np.array( [[focal_length, 0, center[0]], [0, focal_length, center[1]], ...
mit
pypot/scikit-learn
sklearn/linear_model/tests/test_passive_aggressive.py
121
6117
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_raises from sklearn.base import ClassifierMixin from skle...
bsd-3-clause
openDAQ/opendaq-gui
daq_control/main.py
1
42392
#!/usr/bin/env python # Copyright 2012 # Adrian Alvarez <alvarez@ingen10.com> and Juan Menendez <juanmb@ingen10.com> # # This file is part of opendaq. # # opendaq 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 So...
lgpl-3.0
nasa/mplStyle
mplStyle/MplFontStyle.py
1
5937
#=========================================================================== # # Copyright (c) 2014, California Institute of Technology. # U.S. Government Sponsorship under NASA Contract NAS7-03001 is # acknowledged. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modific...
bsd-3-clause
caisq/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator.py
14
62939
# 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
walterreade/scikit-learn
examples/gaussian_process/plot_gpr_noisy_targets.py
45
3680
""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression example computed in two different ways: 1. A noise-free case 2. A noisy case with known noise-level per ...
bsd-3-clause
wkentaro/chainer
examples/vae/train_vae.py
5
7083
#!/usr/bin/env python """Chainer example: train a VAE on MNIST """ import argparse import os import warnings import matplotlib.pyplot as plt import numpy as np import chainer from chainer import training from chainer.training import extensions import chainerx import net import matplotlib matplotlib.use('Agg') def...
mit
CasperTheCat/D3D11Wrapper
Tools/GenTimingGraph.py
1
3044
import sys import matplotlib.pyplot import pandas import numpy import struct import os data = None with open(sys.argv[1], "rb") as f: data = f.read() data = struct.unpack("{}Q".format(len(data) // 8), data) data = numpy.array(data, dtype=numpy.uint64)[1:] data = numpy.array([x for x in data if x < 100000]) rt ...
apache-2.0
Jimmy-Morzaria/scikit-learn
examples/svm/plot_svm_kernels.py
329
1971
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= SVM-Kernels ========================================================= Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially useful when the data-points are not linearly sep...
bsd-3-clause
vibhorag/scikit-learn
sklearn/cross_decomposition/cca_.py
209
3150
from .pls_ import _PLS __all__ = ['CCA'] class CCA(_PLS): """CCA Canonical Correlation Analysis. CCA inherits from PLS with mode="B" and deflation_mode="canonical". Read more in the :ref:`User Guide <cross_decomposition>`. Parameters ---------- n_components : int, (default 2). numb...
bsd-3-clause
rgommers/pywt
demo/wp_scalogram.py
3
1476
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import pywt x = np.linspace(0, 1, num=512) data = np.sin(250 * np.pi * x**2) wavelet = 'db2' level = 4 order = "freq" # other option is "normal" interpolation = 'nearest' cmap = plt.cm.cool # Construct wavelet packet...
mit
lucabaldini/ximpol
ximpol/examples/cena_c2x.py
1
8614
#!/usr/bin/env python # # Copyright (C) 2016, the ximpol team. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # Thi...
gpl-3.0
liberatorqjw/scikit-learn
examples/decomposition/plot_ica_vs_pca.py
43
3343
""" ========================== 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
UCSC-MedBook/MedBook_
tools/old-external-tools/shazam/layoutCytoscapeWeb.py
1
16284
#!/usr/bin/env python """layoutCytoscapeWeb.py Author: Sam Ng Last Updated: 2014-06-13 """ import math, os, re, shutil, sys from copy import deepcopy import pandas import pandas from PATHMARK import Pathway from optparse import OptionParser html_link = """<a href="%s">%s</a>""" html_head = """<!DOCTYPE html PUBLIC...
bsd-3-clause
liangz0707/scikit-learn
examples/svm/plot_svm_regression.py
249
1451
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
bsd-3-clause
potash/scikit-learn
benchmarks/bench_plot_omp_lars.py
28
4471
"""Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle regression (:ref:`least_angle_regression`) The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function import gc import sys from time import time import numpy as np from sklearn.linear_model impo...
bsd-3-clause
yonglehou/scikit-learn
sklearn/metrics/tests/test_classification.py
83
49782
from __future__ import division, print_function import numpy as np from scipy import linalg from functools import partial from itertools import product import warnings from sklearn import datasets from sklearn import svm from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import la...
bsd-3-clause
thekingofkings/chicago-crime
python/preliminary_study.py
2
2212
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Preliminary study on the relation between taxi flow and crime rate difference. Created on Sat May 20 16:30:33 2017 @author: hxw186 """ from FeatureUtils import retrieve_crime_count, generate_corina_features from taxiFlow import getTaxiFlow import matplotlib.pyplot...
mit
arokem/pyAFQ
examples/plot_callosal_tract_profile.py
2
17674
""" ============================== Plotting Novel Tract Profiles: ============================== The following is an example of tractometry for a novel bundle and plotting the resulting FA tract profile. We will run tractometry for the *anterior forceps* using waypoint ROIs. **AFQ Waypoint ROI Tractometry:** .. note...
bsd-2-clause
afgaron/rgz-analysis
python/component_distribution.py
2
1504
# What is the distribution of the number of radio components per image? import rgz subjects,classifications = rgz.load_rgz_data() cc_list = list(subjects.find()) cc_all = [x['metadata']['contour_count'] for x in cc_list] cc_complete = [x['metadata']['contour_count'] if x['state'] == 'complete' else -999 for x in c...
mit
siutanwong/scikit-learn
sklearn/utils/tests/test_extmath.py
130
16270
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import assert_eq...
bsd-3-clause
jayrambhia/SimpleCV2
SimpleCV/MachineLearning/ShapeContextClassifier.py
12
6161
from SimpleCV.base import * from SimpleCV.Features.Features import Feature, FeatureSet from SimpleCV.Color import Color from SimpleCV.ImageClass import Image from SimpleCV.Features.Detection import ShapeContextDescriptor import math import scipy.stats as sps """ Classify an object based on shape context """ class Sha...
bsd-3-clause
fovtran/pyoptools
pyoptools/gui/glwindow.py
9
19554
#!/usr/bin/env python # This includes the two classes wxGLWindow and wxAdvancedGLWindow # from OpenGL.TK in the PyOpenGL distribution # ported to wxPython by greg Landrum # modified by Y. Wong # modified by R. Amezquita # modified by O. Olarte from OpenGL.GL import * from OpenGL.GLU import * from wx import * from wx....
bsd-3-clause
rohitgirdhar-cmu-experimental/fast-rcnn-with3D
lib/fast_rcnn/test.py
43
11975
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Test a Fast R-CNN network on an imdb (image database).""" from fast...
mit
OliverEvans96/rte_matrix
gen_matrices/gen_ddom.py
1
5333
# File Name: gen_ddmo.py # Description: Generate diagonally dominant matrix with gen_matrix_2d.py # Created: Mon Apr 10, 2017 | 10:00am EDT # Last Modified: Thu May 04, 2017 | 06:40am EDT #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- # GNU GPL LICENSE ...
gpl-3.0
coolsgupta/machine_learning_nanodegree
Model_Evaluation_and_Validation/evaluation_metrics/precision_vs_recall.py
1
1439
# As with the previous exercises, let's look at the performance of a couple of classifiers # on the familiar Titanic dataset. Add a train/test split, then store the results in the # dictionary provided. import numpy as np import pandas as pd # Load the dataset X = pd.read_csv('titanic_data.csv') X = X._get_numeric_d...
mit
evidation-health/bokeh
bokeh/_legacy_charts/tests/test_legacy_data_adapter.py
6
3293
""" This is the Bokeh charts testing interface. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with thi...
bsd-3-clause
bloyl/mne-python
examples/time_frequency/source_label_time_frequency.py
20
3702
""" ========================================================= Compute power and phase lock in label of the source space ========================================================= Compute time-frequency maps of power and phase lock in the source space. The inverse method is linear based on dSPM inverse operator. The ex...
bsd-3-clause
sunzhxjs/JobGIS
lib/python2.7/site-packages/pandas/io/ga.py
9
16202
""" 1. Goto https://code.google.com/apis/console 2. Create new project 3. Goto APIs and register for OAuth2.0 for installed applications 4. Download JSON secret file and move into same directory as this file """ from datetime import datetime import re from pandas import compat import numpy as np from pandas import Data...
mit
sarahgrogan/scikit-learn
sklearn/utils/__init__.py
79
14202
""" The :mod:`sklearn.utils` module includes various utilities. """ from collections import Sequence import numpy as np from scipy.sparse import issparse import warnings from .murmurhash import murmurhash3_32 from .validation import (as_float_array, assert_all_finite, ...
bsd-3-clause
czhuang/ChordRipple
chord2vec/plot_utilities.py
1
17153
from copy import copy import numpy as np import pylab as plt from pylab import setp from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d import proj3d from music_theory_tools import RELATIVE_MINOR, CIRCLE_OF_FIFTHS_MINOR_DICT, CIRCLE_OF_FIFTHS_MAJOR_DICT from load_songs_tools import get_raw_data, get_co...
mit
nvoron23/scikit-learn
examples/decomposition/plot_kernel_pca.py
353
2011
""" ========== Kernel PCA ========== This example shows that Kernel PCA is able to find a projection of the data that makes data linearly separable. """ print(__doc__) # Authors: Mathieu Blondel # Andreas Mueller # License: BSD 3 clause import numpy as np import matplotlib.pyplot as plt from sklearn.decomp...
bsd-3-clause
belltailjp/scikit-learn
examples/cluster/plot_birch_vs_minibatchkmeans.py
333
3694
""" ================================= Compare BIRCH and MiniBatchKMeans ================================= This example compares the timing of Birch (with and without the global clustering step) and MiniBatchKMeans on a synthetic dataset having 100,000 samples and 2 features generated using make_blobs. If ``n_clusters...
bsd-3-clause
anurag313/scikit-learn
sklearn/neighbors/tests/test_kde.py
208
5556
import numpy as np from sklearn.utils.testing import (assert_allclose, assert_raises, assert_equal) from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors from sklearn.neighbors.ball_tree import kernel_norm from sklearn.pipeline import make_pipeline from sklearn.dataset...
bsd-3-clause
stevenzhang18/Indeed-Flask
lib/pandas/sparse/series.py
9
26315
""" Data structures for sparse float data. Life is made simpler by dealing only with float64 data """ # pylint: disable=E1101,E1103,W0231 from numpy import nan, ndarray import numpy as np import warnings import operator from pandas.core.common import isnull, _values_from_object, _maybe_match_name from pandas.core.in...
apache-2.0
ajrichards/htsint
htsint/blast/BlastMapper.py
1
16495
#!/usr/bin/env python """ a class to handle results from BLAST searches the parsed file that BlastMapper handles is a csv file with the following rows query,hit-identifier,hit-identifier-long,e-score,bit-score query is specific to the assembly HitId is a RefSeq there is an example of this file in the uni...
bsd-3-clause
emon10005/scikit-image
skimage/filters/_gabor.py
10
6966
import numpy as np from scipy import ndimage as ndi from .._shared.utils import assert_nD __all__ = ['gabor_kernel', 'gabor_filter'] def _sigma_prefactor(bandwidth): b = bandwidth # See http://www.cs.rug.nl/~imaging/simplecell.html return 1.0 / np.pi * np.sqrt(np.log(2) / 2.0) * \ (2.0 ** b + 1)...
bsd-3-clause
StefanD986/peregrine
peregrine/sig_gen.py
3
18840
#!/usr/bin/env python # Copyright (C) 2012 - 2016 Swift Navigation Inc. # Contact: Fergus Noble <fergus@swiftnav.com> # # This source is subject to the license found in the file 'LICENSE' which must # be be distributed together with this source. All other rights reserved. # # THIS CODE AND INFORMATION IS PROVIDED "AS I...
gpl-3.0
Shaswat27/scipy
doc/source/tutorial/examples/newton_krylov_preconditioning.py
99
2489
import numpy as np from scipy.optimize import root from scipy.sparse import spdiags, kron from scipy.sparse.linalg import spilu, LinearOperator from numpy import cosh, zeros_like, mgrid, zeros, eye # parameters nx, ny = 75, 75 hx, hy = 1./(nx-1), 1./(ny-1) P_left, P_right = 0, 0 P_top, P_bottom = 1, 0 def get_precon...
bsd-3-clause
magnunor/hyperspy
hyperspy/drawing/_widgets/scalebar.py
5
5340
# -*- coding: utf-8 -*- # Copyright 2007-2016 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
gpl-3.0
dmnfarrell/mhcpredict
epitopepredict/tests.py
2
5628
#!/usr/bin/env python """ MHC prediction unit tests Created September 2015 Copyright (C) Damien Farrell """ from __future__ import absolute_import, print_function import sys, os import pandas as pd import unittest from . import base, analysis, sequtils, peptutils, mhclearn from Bio.Seq import Seq from Bio...
apache-2.0
LiaoPan/scikit-learn
examples/ensemble/plot_forest_importances_faces.py
403
1519
""" ================================================= Pixel importances with a parallel forest of trees ================================================= This example shows the use of forests of trees to evaluate the importance of the pixels in an image classification task (faces). The hotter the pixel, the more impor...
bsd-3-clause
PhenixI/machine-learning
20-Applications/1_Text Classification/sentiment_analysis_movie/learn_bigger_data.py
1
3266
#define a tokenizer function that cleans the unprocessed text data from #movie_data.csv file that we constructed in the beginning of this chapter #and separates it into word tokens while removing stop words import numpy as np import re from nltk.corpus import stopwords stop = stopwords.words('english') def tokenizer(...
gpl-2.0
yanlend/scikit-learn
sklearn/cluster/tests/test_dbscan.py
176
12155
""" Tests for DBSCAN clustering algorithm """ import pickle import numpy as np from scipy.spatial import distance from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing im...
bsd-3-clause
rosmo/ansible
hacking/aws_config/build_iam_policy_framework.py
25
11861
# Requires pandas, bs4, html5lib, and lxml # # Call script with the output from aws_resource_actions callback, e.g. # python build_iam_policy_framework.py ['ec2:AuthorizeSecurityGroupEgress', 'ec2:AuthorizeSecurityGroupIngress', 'sts:GetCallerIdentity'] # # The sample output: # { # "Version": "2012-10-17", # "S...
gpl-3.0
ky822/Data_Bootcamp
Code/Python/intro_io.py
1
1891
""" Messing around with the IMF's WEO dataset. The first section is an exploration of various methods of reading data from a url. Once we've read in the data, we can slice as needed. Note: data file is labeled xls but it's really tab-delimited text. Prepared for the NYU Course "Data Bootcamp." More at https...
mit
shikhardb/scikit-learn
sklearn/utils/tests/test_extmath.py
13
16336
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import assert_eq...
bsd-3-clause
3manuek/scikit-learn
examples/cluster/plot_segmentation_toy.py
258
3336
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
olologin/scikit-learn
sklearn/svm/classes.py
34
40599
import warnings import numpy as np from .base import _fit_liblinear, BaseSVC, BaseLibSVM from ..base import BaseEstimator, RegressorMixin from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \ LinearModel from ..feature_selection.from_model import _LearntSelectorMixin from ..utils import check_X...
bsd-3-clause
exa-analytics/atomic
exatomic/algorithms/neighbors.py
2
14923
# -*- coding: utf-8 -*- # Copyright (c) 2015-2020, Exa Analytics Development Team # Distributed under the terms of the Apache License 2.0 """ Neighbor Selection Algorithms ############################### This module provides algoirthms for selecting nearest neighbors, e.g. nearest solvent molecules to a solute m...
apache-2.0
VDBWRAIR/bioframes
bioframes/samframe.py
1
5678
import re import pandas as pd import numpy as np from itertools import groupby from func import pmap, psplit, pstrip, compose, compose_all, merge_dicts, fzip, partial2, dictmap, starcompose from operator import itemgetter from functools import partial import operator as op from operator import add, div from schema impo...
gpl-2.0
mnwhite/HARK
ConsumptionSaving/ConsMedModel.py
1
60754
''' Consumption-saving models that also include medical spending. ''' import sys sys.path.insert(0,'../') import numpy as np from scipy.optimize import brentq from HARKcore import HARKobject from HARKutilities import approxLognormal, addDiscreteOutcomeConstantMean, CRRAutilityP_inv,\ CRRAuti...
apache-2.0
pv/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
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/sankey.py
2
39908
#!/usr/bin/env python """ Module for creating Sankey diagrams using matplotlib """ __author__ = "Kevin L. Davies" __credits__ = ["Yannick Copin"] __license__ = "BSD" __version__ = "2011/09/16" # Original version by Yannick Copin (ycopin@ipnl.in2p3.fr) 10/2/2010, available # at: # http://matplotlib.org/examples/api/...
mit
rosswhitfield/mantid
scripts/Muon/GUI/Common/plot_widget/plotting_canvas/plot_color_queue.py
3
2244
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2020 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # Se...
gpl-3.0
mojoboss/scikit-learn
sklearn/neighbors/nearest_centroid.py
199
7249
# -*- coding: utf-8 -*- """ Nearest Centroid Classification """ # Author: Robert Layton <robertlayton@gmail.com> # Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import warnings import numpy as np from scipy import sparse as sp from ..base import BaseEstimator, ClassifierMixin from ..met...
bsd-3-clause
fzalkow/scikit-learn
sklearn/linear_model/tests/test_theil_sen.py
234
9928
""" Testing for Theil-Sen module (sklearn.linear_model.theil_sen) """ # Author: Florian Wilhelm <florian.wilhelm@gmail.com> # License: BSD 3 clause from __future__ import division, print_function, absolute_import import os import sys from contextlib import contextmanager import numpy as np from numpy.testing import ...
bsd-3-clause
boneil3/backtest
BoP.py
1
3114
__author__ = 'brendan' import main import pandas as pd import numpy as np from datetime import datetime as dt from matplotlib import pyplot as plt import random import itertools import time import dateutil from datetime import timedelta cols = ['BoP FA Net', 'BoP FA OI Net', 'BoP FA PI Net', 'CA % GDP'] raw_data = pd...
mit
murali-munna/scikit-learn
sklearn/cluster/tests/test_dbscan.py
114
11393
""" Tests for DBSCAN clustering algorithm """ import pickle import numpy as np from scipy.spatial import distance from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing im...
bsd-3-clause
gsmaxwell/phase_offset_rx
gr-utils/src/python/plot_fft_base.py
53
10449
#!/usr/bin/env python # # Copyright 2007,2008,2011 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
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/doc/mpl_examples/axes_grid/parasite_simple2.py
16
1245
import matplotlib.transforms as mtransforms import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost obs = [["01_S1", 3.88, 0.14, 1970, 63], ["01_S4", 5.6, 0.82, 1622, 150], ["02_S1", 2.4, 0.54, 1570, 40], ["03_S1", 4.1, 0.62, 2380, 170]] fig = plt.figure() ...
mit
kubkon/simplex
examples/one-minimum.py
1
1465
from simplex.algorithm import NelderMeadSimplex import numpy as np import matplotlib.pyplot as plt from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) rc('text', usetex=True) # Defin...
mit
a-holm/MachinelearningAlgorithms
Clustering/K-MeansClustering/howItWorksKMeans.py
1
3871
# -*- coding: utf-8 -*- """K-Means unsupervised classification for machine learning. K-means clustering is a unsupervised method to cluser or group the data. K-means allows you to choose the number (k) of categories/groups and categorizes it automatically when it has come up with solid categories. This algorithm is u...
mit
mne-tools/mne-tools.github.io
mne-realtime/_downloads/31a533964353bc4276f671185a7c5348/plot_rt_feedback_server.py
1
4886
""" ============================================== 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
lbishal/scikit-learn
examples/svm/plot_svm_kernels.py
329
1971
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= SVM-Kernels ========================================================= Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially useful when the data-points are not linearly sep...
bsd-3-clause
megahertz0/tusharedemo
kdj_checker.py
1
7969
# -*- coding: utf-8 -*- """ Created on Sun Feb 05 17:56:27 2017 @author: megahertz """ import lxml.html import matplotlib.pyplot as plt import matplotlib as mpl import tushare as ts import datetime import time import talib as ta import numpy as np import pandas as pd from matplotlib.dates import DateFormatter, Weekd...
lgpl-3.0
nborggren/zipline
zipline/assets/futures.py
6
7574
# # Copyright 2015 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
0x0all/kaggle-galaxies
try_convnet_cc_multirotflip_3x69r45_normconstraint.py
7
17800
import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime_augmentation as ra import time import csv import os import cPickle as pickle from datetime import datetime, timedelta # import matplotlib.pyplot as plt # plt.i...
bsd-3-clause
wogsland/QSTK
build/lib.linux-x86_64-2.7/Bin/DataGenerate_SineWave.py
5
2057
import datetime as dt import csv import copy import os import pickle import math # 3rd party imports import numpy as np import matplotlib.pyplot as plt import pandas as pd # QSTK imports from QSTK.qstkutil import qsdateutil as du # import qstkutil.DataEvolved as de def write(ls_symbols, d_data, ldt_timestamps): ...
bsd-3-clause
mne-tools/mne-python
tutorials/epochs/30_epochs_metadata.py
10
7730
""" .. _tut-epochs-metadata: Working with Epoch metadata =========================== This tutorial shows how to add metadata to `~mne.Epochs` objects, and how to use :ref:`Pandas query strings <pandas:indexing.query>` to select and plot epochs based on metadata properties. For this tutorial we'll use a different dat...
bsd-3-clause
BonexGu/Blik2D-SDK
Blik2D/addon/tensorflow-1.2.1_for_blik/tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py
136
1696
# 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...
mit
florian-wagner/gimli
doc/tutorials/modelling/plot_4-mod-fem-heat-1d.py
1
3955
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Heat equation in 1D ------------------- Isotropic and homogeneous heat equation in one dimension with test case: .. math:: \Delta u(t,x) - check(-) \frac{\partial u(t,x)}{\partial t} & = f(t,x)\\ u(0,x) & = \sin(\pi x)\in x=\Omega \\ u(t,x) & = 0 \in x=\...
gpl-3.0
hlin117/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
toobaz/pandas
pandas/core/arrays/_ranges.py
2
6835
""" Helper functions to generate range-like data for DatetimeArray (and possibly TimedeltaArray/PeriodArray) """ from typing import Tuple import numpy as np from pandas._libs.tslibs import OutOfBoundsDatetime, Timestamp from pandas.tseries.offsets import DateOffset, Tick, generate_range def generate_regular_range...
bsd-3-clause
SalemAmeen/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
Chapter2_MorePyMC/separation_plot.py
86
1494
# separation plot # Author: Cameron Davidson-Pilon,2013 # see http://mdwardlab.com/sites/default/files/GreenhillWardSacks.pdf import matplotlib.pyplot as plt import numpy as np def separation_plot( p, y, **kwargs ): """ This function creates a separation plot for logistic and probit classification. Se...
mit
Tauranis/super-resolution
DatasetReader.py
1
4010
#!/usr/bin/env python # -*- coding: utf-8 -*- # MIT License # Copyright (c) 2017 Tauranis # 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 ...
mit
mehdidc/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
CarterBain/AlephNull
alephnull/finance/performance/futures_period.py
1
12057
from __future__ import division import math from collections import OrderedDict, defaultdict import logbook import numpy as np import pandas as pd import alephnull.protocol as zp from .position import positiondict try: from alephtools.connection import get_multiplier except: #Replace this with source to mul...
apache-2.0
AlexanderFabisch/scikit-learn
sklearn/tests/test_cross_validation.py
20
46586
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy.sparse import csr_matrix from scipy import stats from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.test...
bsd-3-clause
duncanmmacleod/gwpy
gwpy/table/gravityspy.py
1
9062
# -*- coding: utf-8 -*- # Copyright (C) Scott Coughlin (2017-2020) # # This file is part of GWpy. # # GWpy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option)...
gpl-3.0
faroit/mir_eval
tests/test_display.py
4
11202
#!/usr/bin/env python # -*- encoding: utf-8 -*- '''Unit tests for the display module''' # For testing purposes, clobber the rcfile import matplotlib matplotlib.use('Agg') # nopep8 import matplotlib.pyplot as plt import numpy as np # Import the hacked image comparison module from mpl_ic import image_comparison fro...
mit
bankur16/SU2
SU2_PY/find_cfl_number.py
6
9093
#!/usr/bin/env python ## \file find_cfl_number.py # \author T. Lukaczyk # # SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com). # Dr. Thomas D. Economon (economon@stanford.edu). # # SU2 Developers: Prof. Juan J. Alonso's group at Stanford University. # ...
lgpl-2.1
fspaolo/scikit-learn
sklearn/utils/tests/test_extmath.py
4
12928
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause import warnings import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing i...
bsd-3-clause
e-koch/Phys-595
project_code/Machine Learning/unsupervised_specs_lsq.py
1
3652
''' Unsupervised learning on SDSS spectral data ''' import numpy as np import matplotlib.pyplot as p from sklearn.cross_validation import train_test_split from pandas import read_csv, DataFrame, concat import joblib from lsanomaly import LSAnomaly save_models = False test_params = False multi = True learn = True vi...
mit
sthyme/ZFSchizophrenia
BehaviorAnalysis/HSMovieAnalysis/common.py
1
6303
#!/usr/bin/env python ''' This module contais some common routines used by other samples. ''' import numpy as np import cv2 import os from contextlib import contextmanager import itertools as it image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '.ppm'] class Bunch(object): de...
mit
liberatorqjw/scikit-learn
sklearn/metrics/tests/test_classification.py
8
46538
from __future__ import division, print_function import numpy as np from functools import partial from itertools import product import warnings from sklearn import datasets from sklearn import svm from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import LabelBinarizer, MultiLabelB...
bsd-3-clause
wmvanvliet/mne-python
examples/inverse/plot_psf_ctf_label_leakage.py
15
8034
""" ============================================================ Visualize source leakage among labels using a circular graph ============================================================ This example computes all-to-all pairwise leakage among 68 regions in source space based on MNE inverse solutions and a FreeSurfer c...
bsd-3-clause
AndreasMadsen/course-02456-sparsemax
benchmark/datasets.py
1
8208
import collections import os import os.path as path import sys import io import shutil import gzip import numpy as np import scipy.io.arff import rarfile import idx2numpy import urllib.request from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBina...
mit
iskandr/mhcpred
old/train_aa_features.py
1
9943
import numpy as np import pandas as pd from collections import Counter import cPickle import math import pmbec from epitopes import amino_acid from parakeet import jit import scipy.weave import sklearn.linear_model from sklearn.linear_model import LassoCV import sklearn.svm import sklearn.ensemble import sklea...
apache-2.0
markgw/pimlico
src/python/pimlico/datatypes/sklearn.py
1
1248
# This file is part of Pimlico # Copyright (C) 2020 Mark Granroth-Wilding # Licensed under the GNU LGPL v3.0 - https://www.gnu.org/licenses/lgpl-3.0.en.html from __future__ import absolute_import from builtins import object from pimlico.core.dependencies.python import sklearn_dependency from pimlico.datatypes import N...
gpl-3.0
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/scipy/signal/signaltools.py
2
89744
# Author: Travis Oliphant # 1999 -- 2002 from __future__ import division, print_function, absolute_import import warnings import threading from . import sigtools from scipy._lib.six import callable from scipy._lib._version import NumpyVersion from scipy import fftpack, linalg from numpy import (allclose, angle, aran...
apache-2.0
BenKaehler/short-read-tax-assignment
tax_credit/eval_framework.py
4
44170
#!/usr/bin/env python # ---------------------------------------------------------------------------- # Copyright (c) 2014--, tax-credit 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
yavalvas/yav_com
build/matplotlib/doc/mpl_examples/widgets/lasso_selector_demo.py
9
2780
from __future__ import print_function import numpy as np from matplotlib.widgets import LassoSelector from matplotlib.path import Path try: raw_input except NameError: # Python 3 raw_input = input class SelectFromCollection(object): """Select indices from a matplotlib collection using `LassoSelecto...
mit
herilalaina/scikit-learn
examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py
33
3903
""" ============================================== Feature agglomeration vs. univariate selection ============================================== This example compares 2 dimensionality reduction strategies: - univariate feature selection with Anova - feature agglomeration with Ward hierarchical clustering Both metho...
bsd-3-clause
mkeilman/sirepo
sirepo/analysis/ml.py
2
1878
# -*- coding: utf-8 -*- u"""Machine learning tools :copyright: Copyright (c) 2018-2019 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ import numpy import sklearn.cluster import sklearn.metrics.pairwise import sklearn.mixture import sklearn.preprocessing from pykern....
apache-2.0