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
astocko/statsmodels
examples/python/formulas.py
33
4968
## Formulas: Fitting models using R-style formulas # Since version 0.5.0, ``statsmodels`` allows users to fit statistical models using R-style formulas. Internally, ``statsmodels`` uses the [patsy](http://patsy.readthedocs.org/) package to convert formulas and data to the matrices that are used in model fitting. The ...
bsd-3-clause
ewels/MultiQC
multiqc/plots/linegraph.py
1
24486
#!/usr/bin/env python """ MultiQC functions to plot a linegraph """ from __future__ import print_function, division from collections import OrderedDict import base64 import inspect import io import logging import os import random import re import sys from multiqc.utils import config, report, util_functions logger =...
gpl-3.0
CKPalk/MachineLearning
FinalProject/MachineLearning/KNN/knn.py
1
1351
''' Work of Cameron Palk ''' import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import datetime def main( argv ): try: training_filename = argv[ 1 ] testing_filename = argv[ 2 ] output_filename = argv[ 3 ] except IndexError: print( "Error, usage: \"python3 {} <t...
mit
juergenhamel/cuon
cuon_client/cuon/Charts/standardChart.py
5
4207
# coding=utf-8 ##Copyright (C) [2011] [Jürgen Hamel, D-32584 Löhne] ##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
thejevans/pointSourceAnalysis
DetermineBinSize/plots.py
1
1813
import pandas as pd import seaborn as sns import likelihood from itertools import product def RateVsBin(mc, rates, bins, rateType = 'value', outfile = 'out.csv', **kwargs): likelihoods = {} kwargs2 = {} for rate, binDiameter in product(rates, bins): kwargs2 = {'value': {'rate_value': rate, 'bin...
gpl-3.0
ethorne/set-card-game-AI
cardtracker.py
1
5209
import cv2 import numpy as np import imutils import matplotlib.pyplot as plt class card: MIN_HEIGHT = 120 MIN_WIDTH = 180 MIN_PERIMETER = 400 MAX_PERIMETER = 1400 def __init__(self): self.x = 0; self.y = 0; self.w = 0; self.h = 0; self.peri...
mit
keir-rex/zipline
zipline/data/treasuries.py
29
4671
# # Copyright 2013 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
dataculture/pysemantic
pysemantic/tests/test_base.py
2
14118
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2015 jaidev <jaidev@newton> # # Distributed under terms of the BSD 3-clause license. """Base classes and functions for tests.""" import os import unittest import tempfile import shutil import os.path as op from copy import deepcopy from C...
bsd-3-clause
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/examples/linear_model/plot_ridge_coeffs.py
157
2785
""" ============================================================== Plot Ridge coefficients as a function of the L2 regularization ============================================================== .. currentmodule:: sklearn.linear_model :class:`Ridge` Regression is the estimator used in this example. Each color in the le...
mit
HUGG/NGWM2016-modelling-course
Lessons/04-Basic-fluid-mechanics/scripts/solutions/1D-asthenospheric-counterflow.py
1
1890
# -*- coding: utf-8 -*- """ 1D-asthenospheric-counterflow.py A script for plotting velocity magnitudes for 1D counterflow in the asthenosphere. dwhipp 01.16 """ #--- User-defined input variables hl = 100.0 # Thickness of lithosphere [km] h = 200.0 ...
mit
lin-credible/scikit-learn
examples/semi_supervised/plot_label_propagation_digits.py
268
2723
""" =================================================== Label Propagation digits: Demonstrating performance =================================================== This example demonstrates the power of semisupervised learning by training a Label Spreading model to classify handwritten digits with sets of very few labels....
bsd-3-clause
georgetown-analytics/envirohealth
CapstoneSEER/LoadSeer.py
1
5394
#SEER database # SEER data should be loaded into the Data sub-directory of this project. Uses SQlite3 # # .\Data # \incidence # read.seer.research.nov14.sas <- Data Dictionary # *.txt <- Data files in fixed width text format # \populations # # regex to read data di...
mit
pravsripad/mne-python
mne/io/fiff/tests/test_raw_fiff.py
3
71072
# -*- coding: utf-8 -*- # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) from copy import deepcopy from functools import partial from io import BytesIO import os import os.path as op import pathlib import pickle import shutil imp...
bsd-3-clause
AlexisEidelman/Til
til/data/utils/utils.py
2
8328
# -*- coding:utf-8 -*- from __future__ import print_function ''' Created on 2 août 2013 @author: a.eidelman ''' import numpy as np from pandas import Series, DataFrame from numpy.lib.stride_tricks import as_strided import pandas as pd import pdb of_name_to_til= {'ind':'person','foy':'declar','men':'menage', 'fam':'...
gpl-3.0
sergpolly/Thermal_adapt_scripts
ArchNew/DONE_proteome_arch_analysis.py
1
3215
import re import os import sys from Bio import Seq from Bio import SeqIO from Bio import SeqUtils import pandas as pd from functools import partial import time from multiprocessing import Pool aacids = list('CMFILVWYAGTSNQDEHRKP') # def get_aausage_proteome(seqrec): # # seqrec = db[seqrec_id] # features = se...
mit
TheKingInYellow/PySeidon
pyseidon/utilities/save_FlowFile_BPFormat.py
2
12569
from __future__ import division import numpy as np #from rawADCPclass import rawADCP from datetime import datetime from datetime import timedelta import scipy.io as sio import scipy.interpolate as sip import matplotlib.pyplot as plt import seaborn def date2py(matlab_datenum): """ Converts matlab's datenum time...
agpl-3.0
eg-zhang/scikit-learn
examples/svm/plot_svm_nonlinear.py
268
1091
""" ============== Non-linear SVM ============== Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. The color map illustrates the decision function learned by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn imp...
bsd-3-clause
edhuckle/statsmodels
statsmodels/examples/try_tukey_hsd.py
33
6616
# -*- coding: utf-8 -*- """ Created on Wed Mar 28 15:34:18 2012 Author: Josef Perktold """ from __future__ import print_function from statsmodels.compat.python import StringIO import numpy as np from numpy.testing import assert_almost_equal, assert_equal from statsmodels.stats.libqsturng import qsturng ss = '''\ ...
bsd-3-clause
Obus/scikit-learn
sklearn/neighbors/unsupervised.py
106
4461
"""Unsupervised nearest neighbors learner""" from .base import NeighborsBase from .base import KNeighborsMixin from .base import RadiusNeighborsMixin from .base import UnsupervisedMixin class NearestNeighbors(NeighborsBase, KNeighborsMixin, RadiusNeighborsMixin, UnsupervisedMixin): """Unsu...
bsd-3-clause
DhrubajyotiDas/PyAbel
examples/example_linbasex_hansenlaw.py
1
3148
# -*- coding: utf-8 -*- import numpy as np import abel import matplotlib.pyplot as plt IM = np.loadtxt("data/VMI_art1.txt.bz2") legendre_orders = [0, 2, 4] # Legendre polynomial orders proj_angles = np.arange(0, np.pi/2, np.pi/10) # projection angles in 10 degree steps radial_step = 1 # pixel grid smoothing = 1 #...
mit
arasuarun/shogun
examples/undocumented/python_modular/graphical/so_multiclass_director_BMRM.py
16
4362
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from modshogun import RealFeatures from modshogun import MulticlassModel, MulticlassSOLabels, RealNumber, DualLibQPBMSOSVM, DirectorStructuredModel from modshogun import BMRM, PPBMRM, P3BMRM, ResultSet, RealVector from modshogun import Structure...
gpl-3.0
CompPhysics/ThesisProjects
doc/MSc/msc_students/former/ChristianF/ThesisCodes/vmc-solver/AnalyseData/blocking.py
1
1908
import numpy as np import matplotlib.pyplot as plt import sys def readData(filename): infile = open("%s" %filename, 'r') energies = [] for line in infile: energies.append(float(line)) infile.close() return np.asarray(energies) def blocking(energies, nBlocks, blockSize): ...
cc0-1.0
vladpopovici/WSItk
WSItk/segm/tissue.py
1
5399
# -*- coding: utf-8 -*- """ SEGM.TISSUE: try to segment the tissue regions from a pathology slide. @author: vlad """ from __future__ import (absolute_import, division, print_function, unicode_literals) __version__ = 0.01 __author__ = 'Vlad Popovici' __all__ = ['tissue_region_from_rgb', 'tissue_fat', 'tissue_chromatin'...
mit
uglyboxer/linear_neuron
net-p3/lib/python3.5/site-packages/sklearn/covariance/graph_lasso_.py
11
23920
"""GraphLasso: sparse inverse covariance estimation with an l1-penalized estimator. """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause # Copyright: INRIA import warnings import operator import sys import time import numpy as np from scipy import linalg from .empirical_covariance_ im...
mit
carlthome/librosa
docs/examples/plot_pcen_stream.py
1
3937
# coding: utf-8 # Code source: Brian McFee # License: ISC """ ============== PCEN Streaming ============== This notebook demonstrates how to use streaming IO with `librosa.pcen` to do dynamic per-channel energy normalization on a spectrogram incrementally. This is useful when processing long audio files that are too ...
isc
SheffieldML/GPy
GPy/plotting/matplot_dep/img_plots.py
15
2159
# Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) """ The module contains the tools for ploting 2D image visualizations """ import numpy as np from matplotlib.cm import jet width_max = 15 height_max = 12 def _calculateFigureSize(x_size, y_size, fig_ncols...
bsd-3-clause
adithyaselv/face-expression-detect
EmoDetect.py
1
3169
#!/usr/bin/python #Title: Script to find emotion using facial expression #Date:25/10/2015 #Author:Adithya Selvaprithiviraj #PS: Not trained for nuetral expression import argparse,sys try: from FeatureGen import* except ImportError: print "Make sure FeatureGen.pyc file is in the current directory" exit() ...
gpl-2.0
RomainBrault/scikit-learn
examples/svm/plot_svm_margin.py
88
2540
#!/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
clemkoa/scikit-learn
examples/ensemble/plot_gradient_boosting_early_stopping.py
23
5049
""" =================================== Early stopping of Gradient Boosting =================================== Gradient boosting is an ensembling technique where several weak learners (regression trees) are combined to yield a powerful single model, in an iterative fashion. Early stopping support in Gradient Boostin...
bsd-3-clause
rohit21122012/DCASE2013
runs/2016/dnn2016med_traps/traps14/src/evaluation.py
56
43426
#!/usr/bin/env python # -*- coding: utf-8 -*- import math import numpy import sys from sklearn import metrics class DCASE2016_SceneClassification_Metrics(): """DCASE 2016 scene classification metrics Examples -------- >>> dcase2016_scene_metric = DCASE2016_SceneClassification_Metrics(class_lis...
mit
zfrenchee/pandas
pandas/tests/indexing/test_multiindex.py
1
50115
from warnings import catch_warnings import pytest import numpy as np import pandas as pd from pandas import (Panel, Series, MultiIndex, DataFrame, Timestamp, Index, date_range) from pandas.util import testing as tm from pandas.errors import PerformanceWarning, UnsortedIndexError from pandas.tests.in...
bsd-3-clause
cg123/craigslist-cupid
cupid.py
1
2287
#!/usr/bin/env python # 4/7/2014 # Charles O. Goddard import sys import numpy import itertools from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer import craigslist def all_personals(city='boston'): generators = [] for a in 'wm': for b in 'mw': generators.append((craigslist.postings(...
bsd-3-clause
costypetrisor/scikit-learn
sklearn/tests/test_learning_curve.py
225
10791
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import warnings from sklearn.base import BaseEstimator from sklearn.learning_curve import learning_curve, validation_curve from sklearn.u...
bsd-3-clause
attacc/lumen
PythonPP/current.py
1
1621
#!/usr/bin/python3 import argparse import numpy as np import re import sys from scipy.interpolate import InterpolatedUnivariateSpline import matplotlib.pyplot as plt """ Calculate current using finite differences from the polarization Author: C. Attaccalite """ # # parse command line # parser = argparse.ArgumentParse...
gpl-2.0
cdegroc/scikit-learn
examples/cluster/plot_lena_ward_segmentation.py
5
1905
""" =============================================================== A demo of structured Ward hierarchical clustering on Lena image =============================================================== Compute the segmentation of a 2D image with Ward hierarchical clustering. The clustering is spatially constrained in order ...
bsd-3-clause
russel1237/scikit-learn
examples/mixture/plot_gmm.py
248
2817
""" ================================= Gaussian Mixture Model Ellipsoids ================================= Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet process. Both models have access to five components with which to fit the data. Note that the EM model will necessari...
bsd-3-clause
rmcgibbo/msmbuilder
msmbuilder/utils/nearest.py
12
6505
# Author: Matthew Harrigan <matthew.p.harrigan@gmail.com> # Contributors: # Copyright (c) 2015, Stanford University and the Authors # All rights reserved. from __future__ import absolute_import, print_function, division from scipy.spatial import KDTree as sp_KDTree import numpy as np from . import check_iter_of_seque...
lgpl-2.1
dpinney/omf
omf/scratch/dispatchStrategy/dispatchStrategy.py
1
8921
''' Apply PNNL VirtualBatteries (VBAT) load model to day ahead forecast.''' from os.path import isdir, join as pJoin import pandas as pd import numpy as np from sklearn import linear_model import pulp from omf.solvers import VB #from . import VB from omf.models import __neoMetaModel__ from omf.models.__neoMetaModel__ i...
gpl-2.0
micmn/shogun
examples/undocumented/python/graphical/interactive_svr_demo.py
6
11220
""" Shogun demo, based on PyQT Demo by Eli Bendersky Christian Widmer Soeren Sonnenburg License: GPLv3 """ import numpy import sys, os, csv from PyQt4.QtCore import * from PyQt4.QtGui import * import matplotlib from matplotlib.colorbar import make_axes, Colorbar from matplotlib.backends.backend_qt4agg import FigureCa...
gpl-3.0
BioNinja/gseapy
gseapy/enrichr.py
1
18033
#!/usr/bin/env python # -*- coding: utf-8 -*- # see: http://amp.pharm.mssm.edu/Enrichr/help#api for API docs import sys, json, os, logging import requests import pandas as pd from io import StringIO from collections import OrderedDict from pkg_resources import resource_filename from time import sleep from tempfile imp...
mit
ssaeger/scikit-learn
examples/ensemble/plot_gradient_boosting_regression.py
87
2510
""" ============================ Gradient Boosting regression ============================ Demonstrate Gradient Boosting on the Boston housing dataset. This example fits a Gradient Boosting model with least squares loss and 500 regression trees of depth 4. """ print(__doc__) # Author: Peter Prettenhofer <peter.prett...
bsd-3-clause
herilalaina/scikit-learn
sklearn/cluster/tests/test_birch.py
14
5691
""" Tests for the birch clustering algorithm. """ from scipy import sparse import numpy as np from sklearn.cluster.tests.common import generate_clustered_data from sklearn.cluster.birch import Birch from sklearn.cluster.hierarchical import AgglomerativeClustering from sklearn.datasets import make_blobs from sklearn.l...
bsd-3-clause
bayesimpact/bob-emploi
data_analysis/lib/read_data.py
1
6334
"""Module to bundle data queries that are used over several notebooks. Created by Stephan on Nov 3, 2015 """ import codecs import copy import glob import os import re import typing from typing import Any, Dict, Iterable, List import pandas as pd import xmltodict from bob_emploi.data_analysis.lib import migration_he...
gpl-3.0
stinebuu/nest-simulator
extras/ConnPlotter/tcd_nest.py
20
6959
# -*- coding: utf-8 -*- # # tcd_nest.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, or # ...
gpl-2.0
zzcclp/spark
python/pyspark/pandas/tests/data_type_ops/test_base.py
13
3913
# # 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
Clyde-fare/scikit-learn
examples/linear_model/plot_theilsen.py
232
3615
""" ==================== Theil-Sen Regression ==================== Computes a Theil-Sen Regression on a synthetic dataset. See :ref:`theil_sen_regression` for more information on the regressor. Compared to the OLS (ordinary least squares) estimator, the Theil-Sen estimator is robust against outliers. It has a breakd...
bsd-3-clause
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/pandas/io/tests/test_parsers.py
9
162328
# -*- coding: utf-8 -*- # pylint: disable=E1101 from datetime import datetime import csv import os import sys import re import nose import platform from numpy import nan import numpy as np from pandas.io.common import DtypeWarning from pandas import DataFrame, Series, Index, MultiIndex, DatetimeIndex from pandas.com...
apache-2.0
ZENGXH/scikit-learn
examples/decomposition/plot_incremental_pca.py
244
1878
""" =============== Incremental PCA =============== Incremental principal component analysis (IPCA) is typically used as a replacement for principal component analysis (PCA) when the dataset to be decomposed is too large to fit in memory. IPCA builds a low-rank approximation for the input data using an amount of memo...
bsd-3-clause
mkliegl/custom-sklearn
flexible_linear.py
1
8775
# Author: Markus Kliegl # License: MIT r"""Regularized linear regression with custom training and regularization costs. :class:`FlexibleLinearRegression` is a scikit-learn-compatible linear regression estimator that allows specification of arbitrary training and regularization cost functions. For a linear model: .....
mit
JosmanPS/scikit-learn
sklearn/feature_extraction/text.py
110
50157
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
0x0all/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
schoolie/bokeh
bokeh/charts/builders/horizon_builder.py
6
6668
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Horizon class which lets you build your Horizon charts just passing the arguments to the Chart class and calling the proper functions. """ #-----------------------------------------------------------...
bsd-3-clause
kartikkumar/pagmo
PyGMO/problem/_gtop.py
4
32258
from PyGMO.problem._problem_space import cassini_1, gtoc_1, gtoc_2, cassini_2, rosetta, messenger_full, tandem, laplace, sagas, mga_1dsm_alpha, mga_1dsm_tof, mga_incipit, mga_incipit_cstrs, mga_part, _gtoc_2_objective # Redefining the constructors of all problems to obtain good documentation # and allowing kwargs de...
gpl-3.0
mfjb/scikit-learn
examples/linear_model/plot_sgd_iris.py
286
2202
""" ======================================== Plot multi-class SGD on the iris dataset ======================================== Plot decision surface of multi-class SGD on iris dataset. The hyperplanes corresponding to the three one-versus-all (OVA) classifiers are represented by the dashed lines. """ print(__doc__) ...
bsd-3-clause
rseubert/scikit-learn
examples/linear_model/plot_ridge_path.py
254
1655
""" =========================================================== Plot Ridge coefficients as a function of the regularization =========================================================== Shows the effect of collinearity in the coefficients of an estimator. .. currentmodule:: sklearn.linear_model :class:`Ridge` Regressi...
bsd-3-clause
mblondel/scikit-learn
sklearn/utils/tests/test_multiclass.py
11
15420
from __future__ import division import numpy as np import scipy.sparse as sp from itertools import product from functools import partial 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 im...
bsd-3-clause
nitish-tripathi/Simplery
ANN/MultiNeuralNetwork.py
1
6387
import os.path import sys import cPickle import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn.datasets import make_moons, make_circles class MultiNeuralNetwork(object): """ Multiple Neural Network Implementation """ def __init__(self, num_outputs=1, hid...
mit
m4rx9/rna-pdb-tools
rna_tools/tools/rna_alignment/utils/rna_alignment_get_species.py
1
9721
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This is an improved version of the script that uses the Rfam MySQL database online interface (thanks @akaped for this idea) (so you need to be connected to the Internet, of course). Redirect the output to the file. .. image:: ../pngs/species.png .. warning :: This scr...
mit
arabenjamin/scikit-learn
examples/datasets/plot_iris_dataset.py
283
1928
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= The Iris Dataset ========================================================= This data sets consists of 3 different types of irises' (Setosa, Versicolour, and Virginica) petal and sepal length, stored in a 150x4 numpy...
bsd-3-clause
ScreamingUdder/mantid
scripts/FilterEvents/eventFilterGUI.py
1
41849
#pylint: disable=invalid-name, too-many-lines, too-many-instance-attributes from __future__ import (absolute_import, division, print_function) import numpy from FilterEvents.ui_MainWindow import Ui_MainWindow #import line for the UI python class from PyQt4 import QtCore, QtGui from PyQt4.QtCore import * from PyQt4.QtG...
gpl-3.0
kghiasi/cuda-convnet2
convdata.py
174
14675
# Copyright 2014 Google Inc. 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 applicable law or...
apache-2.0
sckott/pyalm_scott
pyalm/stuff.py
2
2931
import sys import requests import csv import pandas as pd class Alm: # def __init__(self): def alm2(self, doi = None, pmid = None, pmcid = None, mdid = None, url = 'http://alm.plos.org/api/v3/articles', info = "totals", months = None, days = None, year = None, source = None, key = None): ''' shit = p...
mit
mathewlee11/lmfm
lmfm/lmfm.py
1
7318
from __future__ import absolute_import import numpy as np from als_fast import FMRegressor from sgd_fast import FMClassifier from scipy.sparse import dok_matrix from sklearn.base import BaseEstimator, RegressorMixin, ClassifierMixin from sklearn.utils import check_X_y, assert_all_finite __author__ = "mathewlee11" cla...
mit
aburrell/davitpy
davitpy/pydarn/proc/signal/xcor.py
3
15116
# -*- coding: utf-8 -*- import copy import datetime from matplotlib import pyplot as mp import numpy as np import scipy as sp from signalCommon import * import logging # Cross Correlation Objects Start Here class xcor(object): def __init__(self, sig0, sig1, mode='full', comment=None, **metadata): """Def...
gpl-3.0
KaiSzuttor/espresso
samples/lb_profile.py
1
2744
# Copyright (C) 2010-2019 The ESPResSo project # # This file is part of ESPResSo. # # ESPResSo 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 v...
gpl-3.0
brajagopalcse/SAIL_CodeMixed-ICON-2017
evalSAIL.py
1
3978
#!/usr/bin/env python3 """ Script to calculate different metrices from the labelled test dataset using the gold dataset for the SAIL (Codemixed) 2017 shared task @ICON-2017. This script requires the gold annotated file provided by the organizers. If your system is unable to predict sentiment of a sentence, then tag ...
mit
yarikoptic/pystatsmodels
statsmodels/datasets/statecrime/data.py
3
2985
#! /usr/bin/env python """Statewide Crime Data""" __docformat__ = 'restructuredtext' COPYRIGHT = """Public domain.""" TITLE = """Statewide Crime Data 2009""" SOURCE = """ All data is for 2009 and was obtained from the American Statistical Abstracts except as indicated below. """ DESCRSHORT = """State ...
bsd-3-clause
georgewinstone/figures2canvas
figures2canvas/__init__.py
1
2915
# -*- coding: utf-8 -*- """ Created on Fri Apr 28 16:36:12 2017 @author: george """ import numpy as np import matplotlib.pyplot as plt import os import matplotlib._pylab_helpers import os import pip from PIL import Image def install(package): pip.main(['install', package]) def merge_images(file1, file2): ...
mit
mfalkiewicz/pyTotalActivation
examples/sg_tutorial/plot_sg_tutorial.py
7
3828
""" ====================================== A quick tour of sphinx-gallery and rST ====================================== One of the most important components of any package is its documentation. For packages that involve data analysis, visualization of results / data is a key element of the docs. Sphinx-gallery is an ...
mit
bhargav/scikit-learn
sklearn/ensemble/__init__.py
153
1382
""" The :mod:`sklearn.ensemble` module includes ensemble-based methods for classification, regression and anomaly detection. """ from .base import BaseEnsemble from .forest import RandomForestClassifier from .forest import RandomForestRegressor from .forest import RandomTreesEmbedding from .forest import ExtraTreesCla...
bsd-3-clause
pkruskal/scikit-learn
sklearn/preprocessing/data.py
113
56747
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Eric Martin <eric@ericmart.in> # License: BSD 3 clause from itertools import chain, combina...
bsd-3-clause
endolith/scikit-image
doc/examples/transform/plot_ransac3D.py
19
1351
""" ============================================ Robust 3D line model estimation using RANSAC ============================================ In this example we see how to robustly fit a 3D line model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from mpl_toolkits...
bsd-3-clause
sgenoud/scikit-learn
examples/neighbors/plot_regression.py
7
1372
""" ============================ Nearest Neighbors regression ============================ Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpolation of the target using both barycenter and constant weights. """ print __doc__ # Author: Alexandre Gramfort <alexandre.gramfort@i...
bsd-3-clause
arjoly/scikit-learn
sklearn/ensemble/tests/test_voting_classifier.py
140
6926
"""Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import RandomForestCl...
bsd-3-clause
GuessWhoSamFoo/pandas
pandas/tests/indexes/test_base.py
1
101609
# -*- coding: utf-8 -*- from collections import defaultdict from datetime import datetime, timedelta import math import operator import sys import numpy as np import pytest from pandas._libs.tslib import Timestamp from pandas.compat import ( PY3, PY35, PY36, StringIO, lrange, lzip, range, text_type, u, zip) from...
bsd-3-clause
xyjin/Program_trade_system
strategies/trending.py
1
4604
# A module for all built-in commands. # vim: sw=4: et LICENSE=""" Copyright (C) 2011 Michael Ihde 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 2 of the License, or (at your option)...
gpl-2.0
mprego/NBA
Regression/tests/ELO_tests.py
1
6119
import pandas as pd from unittest import TestCase from Regression.ELO import ELO class Test_ELO(TestCase): def test_get_dates(self): schedule = pd.DataFrame(dict(Date={0: '1/1/2000', 1: '1/2/2000', 2: '1/2/2000', 3: '1/3/2000'}, Home={0: 'SA', 1: 'SA', 2: 'HOU', 3: 'DAL...
mit
fedspendingtransparency/data-act-broker-backend
dataactvalidator/scripts/loader_utils.py
1
7703
import logging import pandas as pd import numpy as np import csv from io import StringIO from datetime import datetime from pandas import isnull from pandas.io.sql import SQLTable from sqlalchemy.engine import Connection from typing import List, Iterable from dataactcore.utils.failure_threshold_exception import Failur...
cc0-1.0
haya14busa/alc-etm-searcher
nltk-3.0a3/build/lib/nltk/probability.py
2
87772
# -*- coding: utf-8 -*- # Natural Language Toolkit: Probability and Statistics # # Copyright (C) 2001-2013 NLTK Project # Author: Edward Loper <edloper@gmail.com> # Steven Bird <stevenbird1@gmail.com> (additions) # Trevor Cohn <tacohn@cs.mu.oz.au> (additions) # Peter Ljunglöf <peter.ljunglof@hea...
mit
Eric-Gaudiello/tensorflow_dev
tensorflow_home/tensorflow_venv/lib/python3.4/site-packages/numpy/lib/polynomial.py
82
37957
""" Functions to operate on polynomials. """ from __future__ import division, absolute_import, print_function __all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd', 'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d', 'polyfit', 'RankWarning'] import re import warnings import numpy.core....
gpl-3.0
altairpearl/scikit-learn
examples/exercises/plot_cv_digits.py
135
1223
""" ============================================= Cross-validation on Digits Dataset Exercise ============================================= A tutorial exercise using Cross-validation with an SVM on the Digits dataset. This exercise is used in the :ref:`cv_generators_tut` part of the :ref:`model_selection_tut` section...
bsd-3-clause
alutu/revelio
Revelio-parser/run_cgndetect_v6.1.py
1
39801
#!/usr/bin/env python """ parse the raw data from REVELIO tests that ran in the MICROWORKERS: table header: boxid, revelio_type, timestamp, local_IP, upnp_wan_ip, STUN, trace_packetsize, traceroute_results --first line is the traceroute to the mapped address (using 100 bytes packets) -- example: 3f6eb30ced2211e5aefa90...
gpl-2.0
ric2b/Vivaldi-browser
chromium/tools/perf/cli_tools/soundwave/worker_pool.py
10
2508
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Use a pool of workers to concurrently process a sequence of items. Example usage: from soundwave import worker_pool def MyWorker(args): ...
bsd-3-clause
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/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...
mit
leonardolepus/pubmad
toolbox/miscellaneous/main.py
3
4086
import copy import csv import networkx as nx import matplotlib.pyplot as plt import pickle import time import operator def plot(g, file = None, weighted = False, weighted_edge = False): pos=nx.spring_layout(g) if weighted: weights = [g.node[n][weighted] for n in g] max_weight = max(weights)...
gpl-2.0
rgerkin/pyNeuroML
pyneuroml/pynml.py
1
51611
#!/usr/bin/env python """ Python wrapper around jnml command. Also a number of helper functions for handling/generating/running LEMS/NeuroML2 files Thanks to Werner van Geit for an initial version of a python wrapper for jnml. """ from __future__ import absolute_import from __future__ import print_function from _...
lgpl-3.0
sarathid/Python-works
Deep_learning_ND/helper.py
155
5631
import pickle import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import LabelBinarizer def _load_label_names(): """ Load the label names from file """ return ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] def load_cfar10_batch(ci...
gpl-3.0
joshgabriel/dft-crossfilter
CompleteApp/crossfilter_prec_app/old_mains/old_main.py
3
10263
# main.py that controls the whole app # to run: just run bokeh serve --show crossfilter_app in the benchmark-view repo from random import random import os from bokeh.layouts import column from bokeh.models import Button from bokeh.models.widgets import Select, MultiSelect, Slider from bokeh.palettes import RdYlBu3 fr...
mit
ZenDevelopmentSystems/scikit-learn
sklearn/linear_model/setup.py
146
1713
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('linear_model', parent_package, top_path) cblas_libs, blas_info = get_blas_info...
bsd-3-clause
bnaul/scikit-learn
sklearn/datasets/tests/test_kddcup99.py
3
1490
"""Test kddcup99 loader, if the data is available, or if specifically requested via environment variable (e.g. for travis cron job). Only 'percent10' mode is tested, as the full data is too big to use in unit-testing. """ from sklearn.datasets.tests.test_common import check_return_X_y from functools import partial ...
bsd-3-clause
lancezlin/ml_template_py
lib/python2.7/site-packages/matplotlib/spines.py
8
19263
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six import matplotlib import matplotlib.artist as martist from matplotlib.artist import allow_rasterization from matplotlib import docstring import matplotlib.transforms as mt...
mit
vigilv/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
Sammers21/math_stat_python
problem6.py
2
17603
import pandas as pd import statsmodels.formula.api as smf import math from lib import rss, ess from scipy.stats import f, norm, chi import numpy as np from lib import mk_data_var, read_column_from_csv # TODO alter this to your variant v_number = 1 mk_data_var(v_number) class_1 = read_column_from_csv(0, 'data/6probl...
apache-2.0
morrigan/user-behavior-anomaly-detector
src/prepare_data.py
1
5564
#!/usr/bin/python import os, csv import tensorflow as tf import numpy as np import pandas as pd import helpers # fix random seed for reproducibility np.random.seed(7) #-------------------------- Constants --------------------------# FLAGS = tf.flags.FLAGS tf.flags.DEFINE_string( "input_dir", os.path.abspath("../d...
mit
redfern314/eeproto
fskplot.py
1
1031
import csv import matplotlib.pyplot as plt # NOTE: change this to reflect the sampling period for this data timescale = 0.0002 with open('fsk.csv', 'r') as csvfile: reader = csv.reader(csvfile) time = [] samples = [] for row in reader: time.append(round(float(row[0]),7)) samples.appen...
mit
wmvanvliet/mne-python
mne/viz/tests/test_circle.py
14
5024
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: Simplified BSD import numpy as np import pytest import matplotlib.pyplot as plt from mne.viz import plot_connectivity_circle, circular_l...
bsd-3-clause
flyingpoops/kaggle-digit-recognizer-team-learning
model/cnn/cnn2.py
1
7015
# Multi Convolutional Layer Nerual Network (keras part is mostly adapted from kaggle script at https://www.kaggle.com/somshubramajumdar/digit-recognizer/deep-convolutional-network-using-keras) import os os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=1,dnn.enabled=False" # temp files wil...
apache-2.0
samfpetersen/gnuradio
gr-filter/examples/synth_to_chan.py
18
3875
#!/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
LaceyChen17/instacart-market-basket-analysis
lgb_cv.py
1
4447
import gc; import pickle; from copy import deepcopy import numpy as np; import pandas as pd import lightgbm as lgb from matplotlib import pyplot as plt from sklearn.model_selection import GroupKFold from sklearn.metrics import f1_score, roc_auc_score import constants, feats, transactions, utils, evaluation, inference...
mit
orezpraw/unnaturalcode
unnaturalcode/testdata/makehuman/docs/sphinx/source/conf.py
2
8127
# -*- coding: utf-8 -*- # # MakeHuman documentation build configuration file, created by # sphinx-quickstart on Sun Oct 30 12:49:31 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. # # A...
agpl-3.0