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 |
|---|---|---|---|---|---|
mengyun1993/RNN-binary | history code/rnn20160119.py | 1 | 24887 | """ Vanilla RNN
@author Graham Taylor
"""
import numpy as np
import theano
import theano.tensor as T
from sklearn.base import BaseEstimator
import logging
import time
import os
import datetime
import pickle as pickle
import math
logger = logging.getLogger(__name__)
handler = logging.FileHandler("D:/logresult20160123/... | bsd-3-clause |
fabianp/scikit-learn | examples/linear_model/plot_ols.py | 220 | 1940 | #!/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 |
vitaly-krugl/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtkcairo.py | 69 | 2207 | """
GTK+ Matplotlib interface using cairo (not GDK) drawing operations.
Author: Steve Chaplin
"""
import gtk
if gtk.pygtk_version < (2,7,0):
import cairo.gtk
from matplotlib.backends import backend_cairo
from matplotlib.backends.backend_gtk import *
backend_version = 'PyGTK(%d.%d.%d) ' % gtk.pygtk_version + \
... | agpl-3.0 |
krahman/BuildingMachineLearningSystemsWithPython | ch10/simple_classification.py | 4 | 1348 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import mahotas as mh
from sklearn import cross_validation
from sklearn.linear_model.logistic import Log... | mit |
GoogleCloudPlatform/professional-services-data-validator | tests/unit/test_clients.py | 1 | 2763 | # Copyright 2020 Google LLC
#
# 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 |
Titan-C/scikit-learn | examples/manifold/plot_lle_digits.py | 138 | 8594 | """
=============================================================================
Manifold learning on handwritten digits: Locally Linear Embedding, Isomap...
=============================================================================
An illustration of various embeddings on the digits dataset.
The RandomTreesEmbed... | bsd-3-clause |
MTG/sms-tools | lectures/05-Sinusoidal-model/plots-code/spec-sine-synthesis-lobe.py | 2 | 2623 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
from scipy.fftpack import fft, ifft
import math
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import stft as STFT
import... | agpl-3.0 |
Vimos/scikit-learn | sklearn/mixture/tests/test_gaussian_mixture.py | 19 | 40215 | # Author: Wei Xue <xuewei4d@gmail.com>
# Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clauseimport warnings
import sys
import warnings
import numpy as np
from scipy import stats, linalg
from sklearn.covariance import EmpiricalCovariance
from sklearn.datasets.samples_generator import... | bsd-3-clause |
WyoARCC/arcc_metrics | userutil/plt_logins.py | 1 | 5009 | #!/usr/bin/python
# Plots the user logins for the past 30 days
import numpy as np
import matplotlib.pyplot as plt
import subprocess
import datetime
from collections import Counter
wtmp_loc = './'
# number of days since today
history = 31
ignorenames = '[root,(unknown,system,reboot,wtmp]'
MonthMapping = {'Jan':1, 'F... | mit |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/core/indexes/multi.py | 1 | 116098 | from collections import OrderedDict
import datetime
from sys import getsizeof
import warnings
import numpy as np
from pandas._config import get_option
from pandas._libs import Timestamp, algos as libalgos, index as libindex, lib, tslibs
from pandas.compat.numpy import function as nv
from pandas.errors import Perform... | apache-2.0 |
benschneider/dephasing_ringdown_sim | equations.py | 1 | 4627 | # -*- coding: utf-8 -*-
import numpy as np
#def hho(w,w0,q):
# return w0*w0/(w0*w0-w*w + i*w*w0/Q)
def Xd(w,w0,Q):
return (w0*w0*w0*w0-w0*w0*w*w)/( (w0*w0-w*w)*(w0*w0-w*w) + w*w*w0*w0/Q/Q )
def Yd(w,w0,Q):
return -w0*w0*w0*w/Q/( (w0*w0-w*w)*(w0*w0-w*w) + w*w*w0*w0/Q/Q )
def Xr(t,w,w0,Q):
return np.e**(-w*t/... | gpl-2.0 |
MatthieuBizien/scikit-learn | sklearn/tests/test_multioutput.py | 39 | 6609 | import numpy as np
import scipy.sparse as sp
from sklearn.utils import shuffle
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raises_regex
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing impor... | bsd-3-clause |
wackymaster/QTClock | QTClock - BlueRed.py | 1 | 6608 | # User Variables
savepng = False # Change to True if you want Clock to be saved as PNG
##Plotting with Turtle##
from math import pi
import numpy as np
import csv
import matplotlib as mpl
import matplotlib.pyplot as plt
import datetime
import time
from tkFileDialog import askopenfilename
import os
import Tkinter
from T... | mit |
intuition-io/intuition | intuition/core/analyzes.py | 1 | 6451 | # -*- coding: utf-8 -*-
# vim:fenc=utf-8
'''
Intuition results analyzer
--------------------------
Wraps session results with convenient analyse methods
:copyright (c) 2014 Xavier Bruhiere
:license: Apache 2.0, see LICENSE for more details.
'''
import pytz
import pandas as pd
import numpy as np
import dna... | apache-2.0 |
facom/AstrodynTools | tides/animation-test.py | 1 | 1276 | """
See this interesting tutorial:
http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial
More examples at:
http://matplotlib.org/1.3.1/examples/animation/index.html
"""
from util import *
import numpy as np
import matplotlib.animation as animation
from matplotlib.pyplot import *
#####################... | gpl-2.0 |
aaxwaz/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 |
winklerand/pandas | pandas/tests/series/test_missing.py | 1 | 49128 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import pytz
import pytest
from datetime import timedelta, datetime
from distutils.version import LooseVersion
from numpy import nan
import numpy as np
import pandas as pd
from pandas import (Series, DataFrame, isna, date_range,
MultiIndex, Index, ... | bsd-3-clause |
clucas111/delineating-linear-elements | Code/clf_classifiers.py | 1 | 9140 | # -*- coding: utf-8 -*-
"""
@author: Chris Lucas
"""
import numpy as np
from scipy.spatial import cKDTree
from sklearn.tree import DecisionTreeClassifier
class BalancedRandomForest(object):
"""
A balanced random forest classifier. Takes a bootstrap sample of the
minority class and takes a random sample ... | apache-2.0 |
boland1992/SeisSuite | seissuite/sort_later/loop.py | 2 | 12137 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 20 12:28:32 2015
@author: boland
"""
import sys
sys.path.append('/home/boland/Anaconda/lib/python2.7/site-packages')
import pickle
import numpy as np
import matplotlib.pyplot as plt
from scipy.cluster.vq import kmeans
import multiprocessing as mp
import pyproj
import os
... | gpl-3.0 |
Akshay0724/scikit-learn | sklearn/utils/tests/test_multiclass.py | 58 | 14316 |
from __future__ import division
import numpy as np
import scipy.sparse as sp
from itertools import product
from sklearn.externals.six.moves import xrange
from sklearn.externals.six import iteritems
from scipy.sparse import issparse
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sp... | bsd-3-clause |
inkenbrandt/Snake_Valley | CHW_Import_Run.py | 1 | 6739 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 24 06:20:12 2015
@author: paulinkenbrandt
"""
import snake
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as dates
import matplotlib.ticker as tick
from matplotlib.backends.backend_pdf import PdfPages
Drive = 'E'
folder = Drive + ':\\Snake V... | gpl-2.0 |
ctozlm/Dato-Core | src/unity/python/graphlab/test/test_dataframe.py | 13 | 1711 | '''
Copyright (C) 2015 Dato, Inc.
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the DATO-PYTHON-LICENSE file for details.
'''
import unittest
import pandas
import array
from graphlab.cython.cy_dataframe import _dataframe
from pandas.util.testing import asser... | agpl-3.0 |
apark263/tensorflow | tensorflow/python/client/notebook.py | 61 | 4779 | # Copyright 2015 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 |
larrybradley/astropy | astropy/visualization/wcsaxes/patches.py | 3 | 6832 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.patches import Polygon
from astropy import units as u
from astropy.coordinates.representation import UnitSphericalRepresentation
from astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product
__all_... | bsd-3-clause |
alvarofierroclavero/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 |
pratapvardhan/scikit-learn | sklearn/neighbors/base.py | 30 | 30564 | """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
# Multi-output support by Arnaud Jol... | bsd-3-clause |
alexsavio/scikit-learn | sklearn/utils/tests/test_shortest_path.py | 303 | 2841 | from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | bsd-3-clause |
gfyoung/pandas | pandas/tests/indexes/multi/test_formats.py | 2 | 8532 | import warnings
import numpy as np
import pytest
import pandas as pd
from pandas import Index, MultiIndex
import pandas._testing as tm
def test_format(idx):
idx.format()
idx[:0].format()
def test_format_integer_names():
index = MultiIndex(
levels=[[0, 1], [0, 1]], codes=[[0, 0, 1, 1], [0, 1, 0... | bsd-3-clause |
astroML/astroML | astroML/correlation.py | 2 | 10579 | """
Tools for computing two-point correlation functions.
"""
import numpy as np
from sklearn.neighbors import KDTree
from sklearn.utils import check_random_state
def uniform_sphere(RAlim, DEClim, size=1):
"""Draw a uniform sample on a sphere
Parameters
----------
RAlim : tuple
select Right ... | bsd-2-clause |
CKehl/pylearn2 | pylearn2/cross_validation/tests/test_dataset_iterators.py | 49 | 6535 | """
Test cross-validation dataset iterators.
"""
from pylearn2.config import yaml_parse
from pylearn2.testing.skip import skip_if_no_sklearn
def test_dataset_k_fold():
"""Test DatasetKFold."""
skip_if_no_sklearn()
mapping = {'dataset_iterator': 'DatasetKFold'}
test_yaml = test_yaml_dataset_iterator % ... | bsd-3-clause |
kaichogami/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 284 | 3265 | """
===========================================
FeatureHasher and DictVectorizer Comparison
===========================================
Compares FeatureHasher and DictVectorizer by using both to vectorize
text documents.
The example demonstrates syntax and speed only; it doesn't actually do
anything useful with the e... | bsd-3-clause |
runt18/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/patches.py | 1 | 110563 | # -*- coding: utf-8 -*-
from __future__ import division
import math
import matplotlib as mpl
import numpy as np
import matplotlib.cbook as cbook
import matplotlib.artist as artist
import matplotlib.colors as colors
import matplotlib.transforms as transforms
from matplotlib.path import Path
# these are not available ... | agpl-3.0 |
Srisai85/scikit-learn | examples/svm/plot_svm_scale_c.py | 223 | 5375 | """
==============================================
Scaling the regularization parameter for SVCs
==============================================
The following example illustrates the effect of scaling the
regularization parameter when using :ref:`svm` for
:ref:`classification <svm_classification>`.
For SVC classificati... | bsd-3-clause |
hainm/scikit-learn | examples/plot_johnson_lindenstrauss_bound.py | 134 | 7452 | """
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected in... | bsd-3-clause |
walterreade/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 32 | 26520 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from itertools import product
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn... | bsd-3-clause |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/pandas/tests/sparse/test_list.py | 14 | 3662 | from pandas.compat import range
from numpy import nan
import numpy as np
from pandas.core.sparse.api import SparseList, SparseArray
import pandas.util.testing as tm
class TestSparseList(object):
def setup_method(self, method):
self.na_data = np.array([nan, nan, 1, 2, 3, nan, 4, 5, nan, 6])
self... | mit |
ntucllab/striatum | examples/movielens_bandit.py | 1 | 7122 | # -*- coding: utf-8 -*-
"""
==============================
Contextual bandit on MovieLens
==============================
The script uses real-world data to conduct contextual bandit experiments. Here we use
MovieLens 10M Dataset, which is released by GroupLens at 1/2009. Please fist pre-process
datasets (use "movielen... | bsd-2-clause |
toobaz/pandas | pandas/core/arrays/numpy_.py | 1 | 14678 | import numbers
import numpy as np
from numpy.lib.mixins import NDArrayOperatorsMixin
from pandas._libs import lib
from pandas.compat.numpy import function as nv
from pandas.util._decorators import Appender
from pandas.util._validators import validate_fillna_kwargs
from pandas.core.dtypes.dtypes import ExtensionDtype... | bsd-3-clause |
PhenixI/machine-learning | 1_supervised_classification/15-SVM/svm/nonlinear_svm.py | 1 | 2736 | #nonlinear svm using kernel
#generate data
#create dataset that has the form of an XOR gate using the logical_xor function from NumPy,
#where 100 samples will be assigned the class lable 1 and 100 samples will be assigned the
#class lable -1,respectively:
import numpy as np
np.random.seed(0)
X_xor = np.random.randn(... | gpl-2.0 |
ajc158/HoneyBee-Angular-Velocity-Detection | AVDU_model/Paper_4way_comparison/analyse_FigX.py | 1 | 2431 | #!/usr/bin/python
import xml.etree.ElementTree as ET
import sml_log_parser
from subprocess import call, Popen
import os.path
import os
import time, stat, random, math
import ctypes
import struct
import csv
import numpy
from os import listdir
import matplotlib.pyplot as plt
print 'Script to generate Figure for the pap... | gpl-3.0 |
MediffRobotics/DeepRobotics | DeepLearnMaterials/tutorials/Reinforcement_learning_TUT/6_OpenAI_gym/RL_brain.py | 2 | 8193 | """
This part of code is the Q learning brain, which is a brain of the agent.
All decisions are made in here.
View more on 莫烦Python: https://morvanzhou.github.io/tutorials/
"""
import numpy as np
import pandas as pd
import tensorflow as tf
np.random.seed(1)
tf.set_random_seed(1)
# Deep Q Network off-policy
class D... | gpl-3.0 |
Swind/TuringCoffee | tests/test_process.py | 1 | 5893 | import os
import sys
sys.path.insert(0, '../src')
import unittest
from process.circle import Circle
from process.spiral import Spiral
from process.fixed_point import FixedPoint
from process.heat import Heat
from process.operations import Operations
import matplotlib.pyplot as plt
from matplotlib import animation
c... | mit |
pythonvietnam/scikit-learn | examples/mixture/plot_gmm_sin.py | 248 | 2747 | """
=================================
Gaussian Mixture Model Sine Curve
=================================
This example highlights the advantages of the Dirichlet Process:
complexity control and dealing with sparse data. The dataset is formed
by 100 points loosely spaced following a noisy sine curve. The fit by
the GMM... | bsd-3-clause |
EnvGen/toolbox | scripts/sag_vs_mag/correct_strange_contig_names.py | 1 | 1791 | #!/usr/bin/env python
"""A script to create plots for coverage for MAG contigs in SAG reads"""
import argparse
import pandas as pd
import sys
import gzip
def read_fasta_headers(fasta_file, compression=None):
fasta_headers = []
if compression == 'gzip':
with gzip.open(fasta_file, 'r') as f:
... | mit |
hehongliang/tensorflow | tensorflow/contrib/learn/python/learn/estimators/linear_test.py | 15 | 77825 | # 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 |
jcesardasilva/agpy | doc/conf.py | 6 | 9638 | # -*- coding: utf-8 -*-
#
# agpy documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 21 22:31:14 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | mit |
badlogicmanpreet/nupic | examples/opf/tools/MirrorImageViz/mirrorImageViz.py | 50 | 7221 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 |
idlead/scikit-learn | sklearn/cluster/tests/test_affinity_propagation.py | 341 | 2620 | """
Testing for Clustering methods
"""
import numpy as np
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.cluster.affinity_propagation_ import AffinityPropagation
from sklearn.cluster.affinity_propagatio... | bsd-3-clause |
marcsans/cnn-physics-perception | phy/lib/python2.7/site-packages/sklearn/model_selection/tests/test_validation.py | 5 | 35922 | """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... | mit |
MKridler/pyxley | examples/custom_react/project/app.py | 11 | 2196 | from flask import Flask
from flask import request, jsonify, render_template, make_response
import pandas as pd
import json
import sys
import glob
import numpy as np
import argparse
from react import jsx
from pyxley import UILayout
from pyxley.filters import SelectButton
from pyxley.charts import Chart
from collection... | mit |
wogsland/QSTK | QSTK/qstksim/tradesim.py | 4 | 18901 | '''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on May 14, 2012
@author: Sourabh Bajaj
@contact: sourabh@sourabhbajaj.com
@summary: Backtester
'''
# Pytho... | bsd-3-clause |
nan86150/ImageFusion | lib/python2.7/site-packages/mpl_toolkits/axes_grid/colorbar.py | 8 | 27904 | '''
Colorbar toolkit with two classes and a function:
:class:`ColorbarBase`
the base class with full colorbar drawing functionality.
It can be used as-is to make a colorbar for a given colormap;
a mappable object (e.g., image) is not needed.
:class:`Colorbar`
the derived class ... | mit |
jakobworldpeace/scikit-learn | doc/sphinxext/numpy_ext/docscrape_sphinx.py | 408 | 8061 | import re
import inspect
import textwrap
import pydoc
from .docscrape import NumpyDocString
from .docscrape import FunctionDoc
from .docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
self.use_plots... | bsd-3-clause |
adykstra/mne-python | tutorials/time-freq/plot_sensors_time_frequency.py | 2 | 5614 | """
.. _tut-sensors-time-freq:
=============================================
Frequency and time-frequency sensors analysis
=============================================
The objective is to show you how to explore the spectral content
of your data (frequency and time-frequency). Here we'll work on Epochs.
We will use... | bsd-3-clause |
28ideas/quant-econ | examples/robust_monopolist.py | 1 | 5256 | """
Filename: robust_monopolist.py
Authors: Chase Coleman, Spencer Lyon, Thomas Sargent, John Stachurski
The robust control problem for a monopolist with adjustment costs. The
inverse demand curve is:
p_t = a_0 - a_1 y_t + d_t
where d_{t+1} = \rho d_t + \sigma_d w_{t+1} for w_t ~ N(0,1) and iid.
The period ret... | bsd-3-clause |
nborggren/zipline | zipline/examples/dual_moving_average.py | 10 | 4332 | #!/usr/bin/env python
#
# Copyright 2014 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 ... | apache-2.0 |
gerritholl/pyatmlab | pyatmlab/db.py | 2 | 39248 | #!/usr/bin/env python
"""Describe batches of data: atmospheric db, scattering db, etc.
This module contains a class with functionality to read atmospheric data
from a variety of formats and write it to a variety of formats.
Mostly obtained from PyARTS.
"""
import sys
import abc
import copy
import random
import iter... | bsd-3-clause |
bryansim/Python | mousetrackerproc/mousetracker_processing2.py | 3 | 1626 | import pandas as pd
import os
#rootdir = 'C:/Users/Bryan/Desktop/MT_corrected'
rootdir = os.getcwd()
def self_chips(line):
pid = ""
answer = ""
for i, char in enumerate(line):
if i <= 6:
pid = str(pid) + str(char)
if i > 64 and i < 68:
answer = answer + char
retu... | gpl-2.0 |
daiwei89/tsung-thrift | src/tsung-plotter/tsplot.py | 2 | 11347 | #! /usr/bin/python
# -*- Mode: python -*-
# -*- coding: utf-8 -*-
#
# Copyright: 2006 by Dalibo <dalibo.com>
# Copyright: 2007 Dimitri Fontaine <dim@tapoueh.org>
# Created: 2006 by Dimitri Fontaine <dim@tapoueh.org>
#
# Modified: 2008 by Nicolas Niclausse
#
# This program is free software; you can redistribute it... | gpl-2.0 |
yanchen036/tensorflow | tensorflow/examples/learn/text_classification_cnn.py | 21 | 5221 | # 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 appl... | apache-2.0 |
kevalds51/sympy | sympy/plotting/plot.py | 55 | 64797 | """Plotting module for Sympy.
A plot is represented by the ``Plot`` class that contains a reference to the
backend and a list of the data series to be plotted. The data series are
instances of classes meant to simplify getting points and meshes from sympy
expressions. ``plot_backends`` is a dictionary with all the bac... | bsd-3-clause |
low-sky/colira | bayes/hold/brs_galrad.py | 1 | 10042 | #!/usr/bin/env python
import scipy.stats
import numpy as np
import astropy.io.fits as fits
import emcee
import matplotlib.pyplot as p
from matplotlib import rc
from astropy.table import Table, Column
from matplotlib.backends.backend_pdf import PdfPages
#rc('text',usetex=True)
execfile('logprob.py')
execfile('sampler_... | gpl-2.0 |
timmie/cartopy | lib/cartopy/tests/mpl/test_images.py | 2 | 6488 | # (C) British Crown Copyright 2011 - 2016, 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 |
ThiagoGarciaAlves/intellij-community | python/helpers/pycharm_matplotlib_backend/backend_interagg.py | 3 | 2981 | import matplotlib
import os
import socket
import struct
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import FigureManagerBase, ShowBase
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
HOST = 'localhost'
PORT = os.getenv("PYCHARM_MATPLOTLIB_POR... | apache-2.0 |
MartinSavc/scikit-learn | examples/linear_model/plot_lasso_model_selection.py | 311 | 5431 | """
===================================================
Lasso model selection: Cross-Validation / AIC / BIC
===================================================
Use the Akaike information criterion (AIC), the Bayes Information
criterion (BIC) and cross-validation to select an optimal value
of the regularization paramet... | bsd-3-clause |
DataViva/dataviva-site | scripts/data_download/rais/create_files_by_installments.py | 1 | 10721 | # -*- coding: utf-8 -*-
'''
python scripts/data_download/rais/create_files_by_installments.py en scripts/data/rais/en/ 2014 files <type_files when lio file>
'''
from collections import namedtuple
from datetime import datetime
import pandas as pd
import os
import bz2
import sys
import logging
import imp
def local_... | mit |
zaxtax/scikit-learn | examples/neighbors/plot_species_kde.py | 282 | 4059 | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric... | bsd-3-clause |
ProkopHapala/SimpleSimulationEngine | projects/SpaceCombat/py/difraction_limit.py | 1 | 1483 | #!/usr/bin/python
import numpy as np
import matplotlib.pylab as plt
# ========== Functions
eV2nm = 1239.84193
wavelengths = [ ("CO2",10.6e-6), ("Nd:YAG",1024e-9), ("Ar8+",47e-9), ("1keV",eV2nm*1e-12), ("XFEL",0.05e-9) ]
distances = [ (1e+6,10e+6,100e+6)]
# z * lambda = A * d
def LaserRange( A, lamb=1e-6, d=1.0... | mit |
hchauvet/beampy | doc-src/auto_examples/plot_figure.py | 2 | 1694 | """
figure
======
Insert a figure inside a slide.
Figure format can be:
* pdf
* svg
* jpeg
* png
* gif
* Matplotlib figure object
* Bokeh figure object
From one file
-------------
"""
from beampy import *
# Remove quiet=True to get beampy compilation outputs
doc = document(quiet=True)
with slide('A figure from ... | gpl-3.0 |
Barmaley-exe/scikit-learn | sklearn/svm/tests/test_sparse.py | 27 | 10643 | from nose.tools import assert_raises, assert_true, assert_false
import numpy as np
from scipy import sparse
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
from sklearn import datasets, svm, linear_model, base
from sklearn.datasets import make_classif... | bsd-3-clause |
herilalaina/scikit-learn | sklearn/linear_model/tests/test_coordinate_descent.py | 21 | 30080 | # Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import numpy as np
from scipy import interpolate, sparse
from copy import deepcopy
from sklearn.datasets import load_boston
from sklearn.exceptions import ConvergenceWarning
from sk... | bsd-3-clause |
mtagle/airflow | tests/providers/presto/hooks/test_presto.py | 5 | 4331 | #
# 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... | apache-2.0 |
mfjb/scikit-learn | examples/svm/plot_svm_scale_c.py | 223 | 5375 | """
==============================================
Scaling the regularization parameter for SVCs
==============================================
The following example illustrates the effect of scaling the
regularization parameter when using :ref:`svm` for
:ref:`classification <svm_classification>`.
For SVC classificati... | bsd-3-clause |
sumspr/scikit-learn | sklearn/feature_selection/tests/test_rfe.py | 209 | 11733 | """
Testing Recursive feature elimination
"""
import warnings
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_equal, assert_true
from scipy import sparse
from sklearn.feature_selection.rfe import RFE, RFECV
from sklearn.datasets import load_iris,... | bsd-3-clause |
lawson-wheatley/Machine-Prediction-py | Image generation/Generator.py | 1 | 1618 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generator.py
#
# Copyright 2017 LWHEATLEY <lwheatley@lin24.ad.csbsju.edu>
#
# 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 vers... | gpl-3.0 |
BiaDarkia/scikit-learn | sklearn/gaussian_process/gpr.py | 11 | 20671 | """Gaussian processes regression. """
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import warnings
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve, solve_triangular
from scipy.optimize import fmin_l_bfgs_b
from sklearn.base im... | bsd-3-clause |
pompiduskus/scikit-learn | examples/applications/plot_out_of_core_classification.py | 255 | 13919 | """
======================================================
Out-of-core classification of text documents
======================================================
This is an example showing how scikit-learn can be used for classification
using an out-of-core approach: learning from data that doesn't fit into main
memory. ... | bsd-3-clause |
takahiro33/ICC | random/hexagon-random.py | 7 | 5011 | # Python Code to generate random positions within areas in a hexagon.
# Slightly modified version implemented by Greg Kuperberg.
#
# http://stackoverflow.com/users/225554/greg-kuperberg
#
# 2014/08/28
# Jairo Eduardo Lopez
import argparse
import matplotlib
# To get png output
matplotlib.use('Agg')
import matplotlib.py... | agpl-3.0 |
douglasbagnall/py_bh_tsne | test.py | 1 | 1887 | #!/usr/bin/python
import gzip, cPickle
import numpy as np
import matplotlib.pyplot as plt
import sys
import argparse
from fasttsne import fast_tsne
def load_mnist(fn="mnist.pkl.gz"):
f = gzip.open(fn, "rb")
train, val, test = cPickle.load(f)
f.close()
return train, val, test
def main():
parser... | bsd-3-clause |
switchkiller/ml_imdb | src/validation.py | 1 | 1153 | import pandas as pd
import numpy as np
df = pd.read_csv('../save/trainDataFeatures.tsv', sep='\t', index_col=0)
columns = df.columns[3:]
X = np.asarray(df[columns])
y = np.asarray(df.sentiment.transpose())
# Hold Out Method of Validation
from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, ... | mit |
luizcieslak/AlGDock | AlGDock/ForceFields/Grid/test_Interpolation.py | 2 | 2403 | import AlGDock
from MMTK import *
import Interpolation
from MMTK.ForceFields.ForceFieldTest import gradientTest
universe = InfiniteUniverse()
universe.atom1 = Atom('C', position=Vector(1.1, 0.5, 1.5))
universe.atom1.test_charge = 1.
universe.atom2 = Atom('C', position=Vector(1.553, 1.724, 1.464))
universe.atom2.test... | mit |
ssaeger/scikit-learn | sklearn/utils/multiclass.py | 40 | 12966 |
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi
#
# License: BSD 3 clause
"""
Multi-class / multi-label utility function
==========================================
"""
from __future__ import division
from collections import Sequence
from itertools import chain
from scipy.sparse import issparse
from scipy.sparse.... | bsd-3-clause |
Gillu13/scipy | doc/source/tutorial/examples/normdiscr_plot1.py | 84 | 1547 | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
npoints = 20 # number of integer support points of the distribution minus 1
npointsh = npoints / 2
npointsf = float(npoints)
nbound = 4 #bounds for the truncated normal
normbound = (1 + 1 / npointsf) * nbound #actual bounds of truncated normal
... | bsd-3-clause |
theoryno3/scikit-learn | examples/manifold/plot_manifold_sphere.py | 258 | 5101 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=============================================
Manifold Learning methods on a severed sphere
=============================================
An application of the different :ref:`manifold` techniques
on a spherical data-set. Here one can see the use of
dimensionality reducti... | bsd-3-clause |
matcom/autoexam | tabulate.py | 16 | 39088 | # -*- coding: utf-8 -*-
"""Pretty-print tabular data."""
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
from platform import python_version_tuple
import re
if python_version_tuple()[0] < "3":
from itertools import izip_longest
from functools ... | mit |
dkillick/cartopy | lib/cartopy/examples/rotated_pole.py | 6 | 1072 | """
Rotated pole boxes
------------------
This example demonstrates the way a box is warped when it is defined
in a rotated pole coordinate system.
Try changing the ``box_top`` to ``44``, ``46`` and ``75`` to see the effect
that including the pole in the polygon has.
"""
__tags__ = ['Lines and polygons']
import mat... | lgpl-3.0 |
anisridhar/Raga-Identification-Program | fourierFilter.py | 1 | 1172 | #peak tracing functionality
import matplotlib.pyplot as plt
from scipy.io import wavfile # get the api
from scipy.fftpack import fft
from pylab import *
import math
from pydub import AudioSegment
#need to get time data from file and rescale it
def FFmain(filename):
fs, data = wavfile.read(filename)
a = data.T[0] # ... | mit |
thomas-bottesch/fcl | examples/python/kmeans/plotting/algorithm_speed_comparison.py | 1 | 4884 | from __future__ import print_function
import fcl
import os
import matplotlib
import matplotlib.pyplot as plt
import time
from os.path import abspath, join, dirname
from fcl import kmeans
from fcl.datasets import load_sector_dataset, load_usps_dataset
from fcl.matrix.csr_matrix import get_csr_matrix_from_object, csr_mat... | mit |
kinap/scapy | scapy/contrib/pnio_rtc.py | 1 | 17067 | # This file is part of Scapy
# Scapy 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, or
# any later version.
#
# Scapy is distributed in the hope that it will be useful,
# but ... | gpl-2.0 |
pystockhub/book | ch19/day06/Kiwoom.py | 1 | 8298 | import sys
from PyQt5.QtWidgets import *
from PyQt5.QAxContainer import *
from PyQt5.QtCore import *
import time
import pandas as pd
import sqlite3
TR_REQ_TIME_INTERVAL = 0.2
class Kiwoom(QAxWidget):
def __init__(self):
super().__init__()
self._create_kiwoom_instance()
self._set_signal_sl... | mit |
OSHADataDoor/OshaBokeh | bokehsamples/correlation.py | 1 | 3179 |
# Author: Bala Venkatesan
# License: Apache 2.0
##########################################################################
## Imports
##########################################################################
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats as stats
import numpy as np
from ... | apache-2.0 |
IntelLabs/hpat | sdc/tests/tests_perf/test_perf_utils.py | 1 | 14589 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following co... | bsd-2-clause |
rgerkin/pyNeuroML | examples/quick_plot.py | 1 | 1359 | '''
Example showing use of pynml.generate_plot()
'''
from pyneuroml import pynml
import math
import random
from matplotlib import pyplot as plt
######## Some example data
ts = [t*0.01 for t in range(20000)]
siny = [math.sin(t/10) for t in ts]
cosey = [ math.exp(t/-80)*math.cos(t/5) for t in ts]
######## Gener... | lgpl-3.0 |
zaxtax/scikit-learn | examples/neighbors/plot_kde_1d.py | 347 | 5100 | """
===================================
Simple 1D Kernel Density Estimation
===================================
This example uses the :class:`sklearn.neighbors.KernelDensity` class to
demonstrate the principles of Kernel Density Estimation in one dimension.
The first plot shows one of the problems with using histogram... | bsd-3-clause |
cbertinato/pandas | pandas/core/computation/expr.py | 1 | 25800 | """:func:`~pandas.eval` parsers
"""
import ast
from functools import partial, reduce
from io import StringIO
import itertools as it
import operator
import tokenize
from typing import Type
import numpy as np
import pandas as pd
from pandas.core import common as com
from pandas.core.base import StringMixin
from pandas... | bsd-3-clause |
shawpan/drive | model.py | 1 | 5324 | """ Steering angle prediction model for SDCND Behavariol cloning project
"""
import os
import argparse
import json
import csv
import pickle
import cv2
import numpy as np
import math
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Lambda, ELU
from keras.layers.convolutional import C... | gpl-3.0 |
dsm054/pandas | pandas/core/dtypes/concat.py | 1 | 19736 | """
Utility functions related to concat
"""
import numpy as np
from pandas._libs import tslib, tslibs
from pandas.core.dtypes.common import (
_NS_DTYPE, _TD_DTYPE, is_bool_dtype, is_categorical_dtype,
is_datetime64_dtype, is_datetimetz, is_dtype_equal,
is_extension_array_dtype, is_interval_dtype, is_obje... | bsd-3-clause |
yipenggao/moose | modules/navier_stokes/test/tests/ins/mms/supg/plot_convergence.py | 3 | 1546 | # To create convergence plots for the INS variables for different alphas,
# run the navier stokes tests with --all and then run this script
import numpy as np
import matplotlib.pyplot as plt
# Use fonts that match LaTeX
from matplotlib import rcParams
rcParams['font.family'] = 'serif'
rcParams['font.size'] = 17
rcPar... | lgpl-2.1 |
3manuek/scikit-learn | examples/covariance/plot_lw_vs_oas.py | 248 | 2903 | """
=============================
Ledoit-Wolf vs OAS estimation
=============================
The usual covariance maximum likelihood estimate can be regularized
using shrinkage. Ledoit and Wolf proposed a close formula to compute
the asymptotically optimal shrinkage parameter (minimizing a MSE
criterion), yielding th... | bsd-3-clause |
dean0x7d/pybinding | docs/tutorial/twisted_heterostructures.py | 1 | 6393 | """Construct a circular flake of twisted bilayer graphene (arbitrary angle)"""
import numpy as np
import matplotlib.pyplot as plt
import math
import pybinding as pb
from scipy.spatial import cKDTree
from pybinding.repository import graphene
c0 = 0.335 # [nm] graphene interlayer spacing
def two_graphene_monolayers(... | bsd-2-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.