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
seaotterman/tensorflow
tensorflow/examples/learn/iris_run_config.py
86
2087
# 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
sinhrks/expandas
pandas_ml/skaccessors/test/test_svm.py
2
2995
#!/usr/bin/env python import pytest import numpy as np import sklearn.datasets as datasets import sklearn.svm as svm import pandas_ml as pdml import pandas_ml.util.testing as tm class TestSVM(tm.TestCase): def test_objectmapper(self): df = pdml.ModelFrame([]) self.assertIs(df.svm...
bsd-3-clause
arahuja/scikit-learn
examples/linear_model/plot_sgd_separating_hyperplane.py
260
1219
""" ========================================= SGD: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a linear Support Vector Machines classifier trained using SGD. """ print(__doc__) import numpy as n...
bsd-3-clause
vybstat/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
297
8265
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
scipy/scipy
scipy/signal/bsplines.py
12
19509
from numpy import (logical_and, asarray, pi, zeros_like, piecewise, array, arctan2, tan, zeros, arange, floor) from numpy.core.umath import (sqrt, exp, greater, less, cos, add, sin, less_equal, greater_equal) # From splinemodule.c from .spline import cspline2d, sepfir2d...
bsd-3-clause
mmaraya/nd101
ch02/lesson04/and.perceptron.py
1
1065
#!/usr/bin/env python import pandas as pd # Set weight1, weight2, and bias weight1 = 0.5 weight2 = 0.5 bias = -1.0 # DON'T CHANGE ANYTHING BELOW # Inputs and outputs test_inputs = [(0, 0), (0, 1), (1, 0), (1, 1)] correct_outputs = [False, False, False, True] outputs = [] # Generate and check output for test_input,...
mit
mahak/spark
python/pyspark/pandas/base.py
3
55960
# # 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
moutai/scikit-learn
examples/model_selection/plot_confusion_matrix.py
47
2495
""" ================ Confusion matrix ================ Example of confusion matrix usage to evaluate the quality of the output of a classifier on the iris data set. The diagonal elements represent the number of points for which the predicted label is equal to the true label, while off-diagonal elements are those that ...
bsd-3-clause
sppalkia/weld
python/grizzly/grizzly/seriesweld.py
3
19541
import pandas as pd import grizzly_impl from lazy_op import LazyOpResult, to_weld_type from weld.weldobject import * import utils class SeriesWeld(LazyOpResult): """Summary Attributes: column_name (TYPE): Description df (TYPE): Description dim (int): Description expr (TYPE): ...
bsd-3-clause
PMitura/smiles-neural-network
baselines/sicho_svm_uni_feature_sel.py
1
8481
#! /usr/bin/env python import db import math import numpy as np import pandas as pd import matplotlib.pyplot as plt from rdkit import Chem from rdkit.Chem import Descriptors from sklearn.feature_selection import VarianceThreshold import pylab data = db.getTarget_206_1977() duplicates = {} for datum in data: i...
bsd-3-clause
rs2/pandas
pandas/tests/indexes/multi/test_drop.py
2
4428
import numpy as np import pytest from pandas.errors import PerformanceWarning import pandas as pd from pandas import Index, MultiIndex import pandas._testing as tm def test_drop(idx): dropped = idx.drop([("foo", "two"), ("qux", "one")]) index = MultiIndex.from_tuples([("foo", "two"), ("qux", "one")]) d...
bsd-3-clause
evgchz/scikit-learn
sklearn/neural_network/rbm.py
15
11957
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause
KeithYue/StockTrading
utility.py
1
4059
# coding=utf-8 # utility function of stock import os import pandas as pd import numpy as np import logging # config the logging system logging.basicConfig(level=logging.DEBUG) # define Stock class class Stock(): ''' the stock class ''' def __init__(self, code): self.code=code # search ...
apache-2.0
Sentient07/scikit-learn
examples/ensemble/plot_voting_probas.py
316
2824
""" =========================================================== Plot class probabilities calculated by the VotingClassifier =========================================================== Plot the class probabilities of the first sample in a toy dataset predicted by three different classifiers and averaged by the `VotingC...
bsd-3-clause
nkoukou/University_Projects_Year_3
EDM_Assembly/base_class.py
1
11366
''' Defines the base class of an electric potential grid. ''' import numpy as np import matplotlib as mpl import matplotlib.pylab as plt from numba import jit # Global dimensions (used for plots) sqc_x = (2., 'cm') # unit length for SquareCable sqc_u = (10., 'V') # unit potential for SquareCable edm_x = (10., 'mm')...
mit
victor-prado/broker-manager
environment/lib/python3.5/site-packages/pandas/tests/frame/test_mutate_columns.py
7
7831
# -*- coding: utf-8 -*- from __future__ import print_function from pandas.compat import range, lrange import numpy as np from pandas import DataFrame, Series, Index from pandas.util.testing import (assert_series_equal, assert_frame_equal, assertRaise...
mit
bikong2/scikit-learn
sklearn/tests/test_random_projection.py
79
14035
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.metrics import euclidean_distances from sklearn.random_projection import johnson_lindenstrauss_min_dim from sklearn.random_projection import gaussian_random_matrix from sklearn.random_projection import sparse_random_matrix from...
bsd-3-clause
evidation-health/pymc3
setup.py
1
2670
#!/usr/bin/env python from setuptools import setup import sys DISTNAME = 'pymc3' DESCRIPTION = "PyMC3" LONG_DESCRIPTION = """Bayesian estimation, particularly using Markov chain Monte Carlo (MCMC), is an increasingly relevant approach to statistical estimation. However, few statistical software packages implement ...
apache-2.0
cgrohman/ponies
hypo1.py
1
4172
import numpy as np import pandas as pd from horse import Horse from race import Race import pdb from sklearn.preprocessing import Imputer, StandardScaler, OneHotEncoder from sklearn.model_selection import train_test_split #------------------------------------------------------------------------------ def main(): da...
gpl-3.0
vberthiaume/vblandr
src/silenceTest.py
1
3381
import subprocess as sp import scikits.audiolab import numpy as np from scipy.fftpack import fft, ifft from scipy.io import wavfile import bisect import matplotlib.pyplot as plt import time plt.rcParams['agg.path.chunksize'] = 10000 #--CONVERT MP3 TO WAV------------------------------------------ #song_path = '/home/g...
apache-2.0
joshloyal/scikit-learn
sklearn/linear_model/passive_aggressive.py
28
11542
# Authors: Rob Zinkov, Mathieu Blondel # License: BSD 3 clause from .stochastic_gradient import BaseSGDClassifier from .stochastic_gradient import BaseSGDRegressor from .stochastic_gradient import DEFAULT_EPSILON class PassiveAggressiveClassifier(BaseSGDClassifier): """Passive Aggressive Classifier Read mor...
bsd-3-clause
QuLogic/burnman
misc/benchmarks/solidsolution_benchmarks.py
1
6797
# Benchmarks for the solid solution class import os.path, sys sys.path.insert(1,os.path.abspath('../..')) import burnman from burnman import minerals from burnman.processchemistry import * import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg atomic_masses=read_masses() ''' Solvus sha...
gpl-2.0
hdmetor/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
bthirion/scikit-learn
sklearn/feature_extraction/hashing.py
74
6153
# Author: Lars Buitinck # License: BSD 3 clause import numbers import numpy as np import scipy.sparse as sp from . import _hashing from ..base import BaseEstimator, TransformerMixin def _iteritems(d): """Like d.iteritems, but accepts any collections.Mapping.""" return d.iteritems() if hasattr(d, "iteritems...
bsd-3-clause
madengr/usrp_rf_tests
apps/b200_two_tone_tx_test.py
1
5934
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Sat Jul 26 20:28:23 2014 USRP generates two tones with swept gain and frequency Tone and IMD powers measured with spectrum analyzer @author: madengr """ import instruments import numpy as np import time from gnuradio import gr from gnuradio import uhd from gn...
gpl-3.0
libAtoms/matscipy
examples/electrochemistry/samples_pb_c2d.py
1
63342
# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.6.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --...
gpl-2.0
DangoMelon0701/PyRemote-Sensing
Scatter Plot/np_scatter_plot.py
1
7491
# -*- coding: utf-8 -*- """ Created on Tue Dec 06 13:17:45 2016 @author: gerar """ # Este archivo toma como datos de entrada un ASCII # con 5 Columnas # Date_MODIS Time_MODIS AOD_MODIS Time_AERONET AOD_AERONET # Se puede usar en conjunto con el codigo llamado # pd_match_data.py import os import numpy as n...
mit
Eksmo/calibre
setup/installer/linux/freeze.py
2
11661
#!/usr/bin/env python from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' ''' Create linux binary. ''' from setup import Command, __version__, __appname__ class LinuxFreeze(Command): description = 'Create ...
gpl-3.0
emetsger/osf.io
scripts/analytics/addons.py
18
2173
# -*- coding: utf-8 -*- import os import re import matplotlib.pyplot as plt from framework.mongo import database from website import settings from website.app import init_app from .utils import plot_dates, oid_to_datetime, mkdirp log_collection = database['nodelog'] FIG_PATH = os.path.join(settings.ANALYTICS_PATH...
apache-2.0
maheshakya/scikit-learn
examples/linear_model/plot_iris_logistic.py
283
1678
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
bsd-3-clause
zuku1985/scikit-learn
sklearn/exceptions.py
50
5276
""" The :mod:`sklearn.exceptions` module includes all custom warnings and error classes used across scikit-learn. """ __all__ = ['NotFittedError', 'ChangedBehaviorWarning', 'ConvergenceWarning', 'DataConversionWarning', 'DataDimensionalityWarning', 'EfficiencyWarn...
bsd-3-clause
dgwakeman/mne-python
examples/realtime/ftclient_rt_compute_psd.py
17
2460
""" ============================================================== Compute real-time power spectrum density with FieldTrip client ============================================================== Please refer to `ftclient_rt_average.py` for instructions on how to get the FieldTrip connector working in MNE-Python. This e...
bsd-3-clause
effigies/mne-python
examples/stats/plot_spatio_temporal_cluster_stats_sensor.py
1
5435
""" ===================================================== Spatiotemporal permutation F-test on full sensor data ===================================================== Tests for differential evoked responses in at least one condition using a permutation clustering test. The FieldTrip neighbor templates will be used to d...
bsd-3-clause
stylianos-kampakis/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
marcoantoniooliveira/labweb
oscar/lib/python2.7/site-packages/IPython/external/qt_for_kernel.py
9
2379
""" Import Qt in a manner suitable for an IPython kernel. This is the import used for the `gui=qt` or `matplotlib=qt` initialization. Import Priority: if Qt4 has been imported anywhere else: use that if matplotlib has been imported and doesn't support v2 (<= 1.0.1): use PyQt4 @v1 Next, ask ETS' QT_API env v...
bsd-3-clause
nicholsn/ncanda-data-integration
scripts/redcap/scoring/psqi/__init__.py
2
2693
#!/usr/bin/env python ## ## See COPYING file distributed along with the ncanda-data-integration package ## for the copyright and license terms ## import re import pandas import RwrapperNew # # Variables from surveys needed for PSQI # # LimeSurvey field names lime_fields = [ "psqi1", "psqi2", "psqi3", "psqi4", "...
bsd-3-clause
heidi-ann/ocaml-raft-data
plotting_funct.py
1
3255
from matplotlib import rc import matplotlib.pyplot as plt import matplotlib.pylab as pyl import numpy as np import csv from itertools import cycle from utils import * figs = ['org','expo','combo','fixed'] graph_a = ['12-24','25-50','50-100','100-200','150-300'] graph_b = ['150-151','150-155','150-175','150-200','150-3...
mit
russel1237/scikit-learn
sklearn/ensemble/gradient_boosting.py
12
69795
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
bsd-3-clause
webmasterraj/GaSiProMo
flask/lib/python2.7/site-packages/pandas/tools/tests/test_merge.py
3
98825
# pylint: disable=E1103 import nose from datetime import datetime from numpy.random import randn from numpy import nan import numpy as np import random import pandas as pd from pandas.compat import range, lrange, lzip, zip, StringIO from pandas import compat from pandas.tseries.index import DatetimeIndex from pandas...
gpl-2.0
chrsrds/scikit-learn
sklearn/tests/test_isotonic.py
1
16117
import warnings import numpy as np import pickle import copy from sklearn.isotonic import (check_increasing, isotonic_regression, IsotonicRegression, _make_unique) from sklearn.utils.validation import check_array from sklearn.utils.testing import (assert_raises, assert_array_equal, ...
bsd-3-clause
AlfredNeverKog/BrainCarya
src/my/kadenze/lesson4/inception_graph.py
1
2023
import numpy as np import tensorflow as tf from PIL import Image from scipy import misc from tensorflow.python.platform import gfile import matplotlib.pyplot as plt from src.my.lib.utils import montage_filters,montage model, labels = ('./inception5h/tensorflow_inception_graph.pb', './inception5h/imagen...
mit
pypot/scikit-learn
examples/semi_supervised/plot_label_propagation_structure.py
247
2432
""" ============================================== Label Propagation learning a complex structure ============================================== Example of LabelPropagation learning a complex internal structure to demonstrate "manifold learning". The outer circle should be labeled "red" and the inner circle "blue". Be...
bsd-3-clause
kevin-intel/scikit-learn
sklearn/inspection/tests/test_permutation_importance.py
5
19332
import pytest import numpy as np from numpy.testing import assert_allclose from sklearn.compose import ColumnTransformer from sklearn.datasets import load_diabetes from sklearn.datasets import load_iris from sklearn.datasets import make_classification from sklearn.datasets import make_regression from sklearn.dummy im...
bsd-3-clause
ishanic/scikit-learn
sklearn/utils/arpack.py
265
64837
""" This contains a copy of the future version of scipy.sparse.linalg.eigen.arpack.eigsh It's an upgraded wrapper of the ARPACK library which allows the use of shift-invert mode for symmetric matrices. Find a few eigenvectors and eigenvalues of a matrix. Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/ """ #...
bsd-3-clause
manns/pyspread
pyspread/model/model.py
1
51023
# -*- coding: utf-8 -*- # Copyright Martin Manns # Distributed under the terms of the GNU General Public License # -------------------------------------------------------------------- # pyspread is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published...
gpl-3.0
cbertinato/pandas
pandas/tests/frame/test_timezones.py
1
7854
""" Tests for DataFrame timezone-related methods """ from datetime import datetime import numpy as np import pytest import pytz from pandas.core.dtypes.dtypes import DatetimeTZDtype import pandas as pd from pandas import DataFrame, Series from pandas.core.indexes.datetimes import date_range import pandas.util.testin...
bsd-3-clause
cassinius/right-to-forget-data
src/multi_class/linear_svc.py
1
1024
from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC from src.multi_class import input_preproc from src.multi_class import calculate_metrics def runClassifier(X_train, X_test, y_train, y_test): # print y_train predictions = OneVsRestClassifier(LinearSVC(), n_jobs=-1)\ ...
apache-2.0
barentsen/dave
milesplay/productionPCA.py
1
16265
""" Created on Tue Aug 2 09:55:43 2016 @author: Miles """ import numpy as np import matplotlib.pyplot as plt import dave.fileio.mastio as mastio import dave.fileio.tpf as tpf import dave.fileio.kplrfits as kplrfits import dave.misc.noise as noise import gapfill def getData(epic, campaign): """Obtains the data ...
mit
cohortfsllc/cohort-cocl2-sandbox
buildbot/buildbot_selector.py
2
19580
#!/usr/bin/python # Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import subprocess import sys import tempfile sys.path.append(os.path.join(os.path.dirname(__file__), '..'))...
bsd-3-clause
Srisai85/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
jgomezc1/FEM-Notes
scripts/1DELEMENT.py
1
1170
# -*- coding: utf-8 -*- """ --------1D Lagramge interpolation problem--------------- """ from __future__ import division import lagrange as la import matplotlib.pyplot as plt import numpy as np from sympy import * from sympy import init_printing init_printing() # fx = lambda x: x**3 + 4*x**2 - 10.0; # # Assign symbols ...
mit
aayushidwivedi01/spark-tk
python/sparktk/frame/constructors/import_pandas.py
12
8940
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #       http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
apache-2.0
mne-tools/mne-tools.github.io
0.22/_downloads/68dbe405ac02c372b6167f7e86b7e3e0/plot_background_filtering.py
4
49916
# -*- coding: utf-8 -*- r""" .. _disc-filtering: =================================== Background information on filtering =================================== Here we give some background information on filtering in general, and how it is done in MNE-Python in particular. Recommended reading for practical applications ...
bsd-3-clause
bilgili/nest-simulator
extras/ConnPlotter/examples/connplotter_tutorial.py
13
26833
# -*- coding: utf-8 -*- # # connplotter_tutorial.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 Li...
gpl-2.0
xubenben/scikit-learn
examples/linear_model/plot_logistic.py
312
1426
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logit function ========================================================= Show in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or two, u...
bsd-3-clause
dialounke/pylayers
pylayers/location/geometric/util/cdf2.py
2
3799
# -*- coding:Utf-8 -*- import numpy as np import scipy as sp import os import matplotlib.pyplot as plt import pdb try: import mplrc.ieee.transaction except: pass from matplotlib import rcParams rcParams['text.usetex'] = True rcParams['text.latex.unicode'] = True class CDF(object): def __init__(self, ld, ...
mit
yanlend/scikit-learn
sklearn/metrics/tests/test_pairwise.py
13
25520
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
hobson/pug-invest
pug/invest/bin/thresh-test.py
1
2097
from pug.invest.util import clipped_area # from scipy.optimize import minimize import pandas as pd from matplotlib import pyplot as plt np = pd.np t = ['2014-12-09T00:00', '2014-12-09T00:15', '2014-12-09T00:30', '2014-12-09T00:45', '2014-12-09T01:00', '2014-12-09T01:15', '2014-12-09T01:30', '2014-12-09T01:45'] ts = p...
mit
xiaozhuchacha/OpenBottle
grammar_induction/earley_parser/nltk/tbl/demo.py
7
14715
# -*- coding: utf-8 -*- # Natural Language Toolkit: Transformation-based learning # # Copyright (C) 2001-2017 NLTK Project # Author: Marcus Uneson <marcus.uneson@gmail.com> # based on previous (nltk2) version by # Christopher Maloof, Edward Loper, Steven Bird # URL: <http://nltk.org/> # For license information, see...
mit
bthirion/scikit-learn
examples/classification/plot_classifier_comparison.py
26
5236
#!/usr/bin/python # -*- coding: utf-8 -*- """ ===================== Classifier comparison ===================== A comparison of a several classifiers in scikit-learn on synthetic datasets. The point of this example is to illustrate the nature of decision boundaries of different classifiers. This should be taken with ...
bsd-3-clause
bnaul/scikit-learn
examples/linear_model/plot_lasso_model_selection.py
15
5402
""" =================================================== 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
shivamvats/graphSearch
main_mha.py
1
2271
from heuristicSearch.planners.mhastar import MHAstar from heuristicSearch.envs.env import GridEnvironment from heuristicSearch.envs.occupancy_grid import OccupancyGrid from heuristicSearch.graph.node import Node from heuristicSearch.utils.visualizer import ImageVisualizer from heuristicSearch.utils.utils import * from...
mit
alfonsokim/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/path.py
69
20263
""" Contains a class for managing paths (polylines). """ import math from weakref import WeakValueDictionary import numpy as np from numpy import ma from matplotlib._path import point_in_path, get_path_extents, \ point_in_path_collection, get_path_collection_extents, \ path_in_path, path_intersects_path, con...
agpl-3.0
kipohl/ncanda-data-integration
scripts/redcap/scoring/pgd/__init__.py
2
2426
#!/usr/bin/env python ## ## See COPYING file distributed along with the ncanda-data-integration package ## for the copyright and license terms ## import pandas import RwrapperNew # # Variables from surveys needed for PGD # # LimeSurvey field names lime_fields = [ "PGD_sec1 [pgd1]", "PGD_sec1 [pgd2]", "PGD_sec1 ...
bsd-3-clause
chrisburr/scikit-learn
examples/linear_model/plot_ard.py
18
2827
""" ================================================== Automatic Relevance Determination Regression (ARD) ================================================== Fit regression model with Bayesian Ridge Regression. See :ref:`bayesian_ridge_regression` for more information on the regressor. Compared to the OLS (ordinary l...
bsd-3-clause
CVML/scikit-learn
benchmarks/bench_glmnet.py
297
3848
""" To run this, you'll need to have installed. * glmnet-python * scikit-learn (of course) Does two benchmarks First, we fix a training set and increase the number of samples. Then we plot the computation time as function of the number of samples. In the second benchmark, we increase the number of dimensions of...
bsd-3-clause
ai-se/XTREE
src/Planners/XTREE/Prediction.py
1
8693
from __future__ import division from pdb import set_trace from os import environ, getcwd from os import walk from os.path import expanduser from pdb import set_trace import sys # Update PYTHONPATH HOME = expanduser('~') axe = HOME + '/git/axe/axe/' # AXE pystat = HOME + '/git/pystats/' # PySTAT cwd = getcwd() # Cur...
mit
jviada/QuantEcon.py
examples/lqramsey.py
4
9949
""" Filename: lqramsey.py Authors: Thomas Sargent, Doc-Jin Jang, Jeong-hun Choi, John Stachurski This module provides code to compute Ramsey equilibria in a LQ economy with distortionary taxation. The program computes allocations (consumption, leisure), tax rates, revenues, the net present value of the debt and other...
bsd-3-clause
EachenKuang/PythonRepository
MedicineSCI/document_word.py
1
3290
# -*- encoding: utf-8 -*- import numpy as np import pandas as pd def generate_documents_words_matrix(): f1 = open('TF.txt', 'r') # Documents f2 = open('termList.txt', 'r') # Words # 词表 words_list = [] for line in f2.readlines(): words_list.append(line.strip()) documents_words_ma...
apache-2.0
fabioticconi/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
dimroc/tensorflow-mnist-tutorial
lib/python3.6/site-packages/matplotlib/streamplot.py
10
20629
""" Streamline plotting for 2D vector fields. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import xrange import numpy as np import matplotlib import matplotlib.cm as cm import matplotlib.colors as mcolors import matplotlib....
apache-2.0
jakobworldpeace/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
41
2672
""" ============================ 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
kevin-coder/tensorflow-fork
tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py
39
20233
# 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
samzhang111/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
234
12267
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
thekerrlab/netpyne
netpyne/analysis/lfp.py
1
16820
""" analysis/lfp.py Functions to plot and analyze LFP-related results Contributors: salvadordura@gmail.com """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals from __future__ import absolute_import from builtins import range from builtins import round fro...
mit
peraktong/Cannon-Experiment
0228_opt_simultaneously_1_data.py
1
4384
import os import numpy as np from astropy.table import Table from astropy.io import fits import matplotlib.pyplot as plt import matplotlib import pickle import astropy.io.fits as ts import AnniesLasso_2 as tc import math def get_pixmask(flux, err): bad_flux = ~np.isfinite(flux) bad_err = (~np.isfinite(err))...
mit
shikhardb/scikit-learn
sklearn/linear_model/coordinate_descent.py
13
73434
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Gael Varoquaux <gael.varoquaux@inria.fr> # # License: BSD 3 clause import sys import warnings from abc import ABCMeta, abstractmethod import n...
bsd-3-clause
gbcolborne/TALN_2016
exp_AD.py
1
5248
#! -*- coding:utf-8 -*- """ Evaluate count-based distributional semantic models. """ import sys, os, codecs, argparse from sklearn.metrics.pairwise import pairwise_distances import Corpus, CoocTensor, eval_utils def join_strings_and_append_to_file(strings, filename): """ Join strings in list using comma as de...
mit
lbeltrame/bcbio-nextgen
bcbio/heterogeneity/loh.py
2
15786
"""Summarize amplification and loss of heterozygosity (LOH) from heterogeneity callers. Provides high level summaries of calls in regions of interest. """ import csv import collections import os import decimal import uuid import pandas as pd import six from six import StringIO import toolz as tz import yaml from bcb...
mit
vivekmishra1991/scikit-learn
examples/cluster/plot_affinity_propagation.py
349
2304
""" ================================================= Demo of affinity propagation clustering algorithm ================================================= Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Points", Science Feb. 2007 """ print(__doc__) from sklearn.cluster impor...
bsd-3-clause
ProkopHapala/SimpleSimulationEngine
cpp/sketches_SDL/Molecular/python/eFF_terms.py
1
12181
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import scipy.special as spc ''' Note: It seems that H2 Molecule cannot be sable without varying Kinetic Energy see: [1] https://link.aps.org/doi/10.1103/PhysRevLett.99.185003 Excited Electron Dynamics Modeling of Warm Dense Matter Julius T. Su...
mit
imperial-genomics-facility/data-management-python
igf_data/process/metadata_reformat/reformat_samplesheet_file.py
1
8902
import re import pandas as pd from igf_data.illumina.samplesheet import SampleSheet from igf_data.utils.sequtils import rev_comp from igf_data.process.metadata_reformat.reformat_metadata_file import Reformat_metadata_file SAMPLESHEET_COLUMNS = [ 'Lane', 'Sample_ID', 'Sample_Name', 'Sample_Plate', 'Sample_Wel...
apache-2.0
stwunsch/gnuradio
gr-filter/examples/resampler.py
58
4454
#!/usr/bin/env python # # Copyright 2009,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
liberatorqjw/scikit-learn
examples/svm/plot_svm_nonlinear.py
61
1089
""" ============== 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 learn by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn impor...
bsd-3-clause
jreback/pandas
pandas/compat/pickle_compat.py
1
7903
""" Support pre-0.12 series pickle compatibility. """ import contextlib import copy import io import pickle as pkl from typing import TYPE_CHECKING, Optional import warnings from pandas._libs.tslibs import BaseOffset from pandas import Index if TYPE_CHECKING: from pandas import DataFrame, Series def load_redu...
bsd-3-clause
yorkerlin/shogun
examples/undocumented/python_modular/graphical/interactive_clustering_demo.py
10
11280
""" 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
barentsen/dave
detrendThis/martinsff.py
1
8302
import sys, os import scipy from pylab import * from matplotlib import * from scipy.stats import * from numpy import * from scipy import * import kepfit import kepmsg """ This code is based on the PyKE routine kepsff found at keplerscience.arc.nasa.gov The kepsff code is based on Vanderberg and Johnson 2014. If you ...
mit
beepee14/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_array from ..utils.graph import...
bsd-3-clause
jakevdp/megaman
megaman/utils/covar_plotter.py
4
2672
# LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Ellipse def plot_point_cov(points, nstd=2, ax=None, **kwargs): """ Plots an `nstd` sigma ellipse based on the mean and covariance of a point "clo...
bsd-2-clause
stevenzhang18/Indeed-Flask
lib/pandas/core/nanops.py
9
23144
import itertools import functools import numpy as np try: import bottleneck as bn _USE_BOTTLENECK = True except ImportError: # pragma: no cover _USE_BOTTLENECK = False import pandas.hashtable as _hash from pandas import compat, lib, algos, tslib from pandas.compat import builtins from pandas.core.common ...
apache-2.0
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/matplotlib/tests/test_basic.py
7
1290
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six from nose.tools import assert_equal from matplotlib.testing.decorators import knownfailureif from pylab import * def test_simple(): assert_equal(1 + 1, 2) @knownfa...
apache-2.0
OshynSong/scikit-learn
sklearn/tests/test_kernel_ridge.py
342
3027
import numpy as np import scipy.sparse as sp from sklearn.datasets import make_regression from sklearn.linear_model import Ridge from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import pairwise_kernels from sklearn.utils.testing import ignore_warnings from sklearn.utils.testing import assert...
bsd-3-clause
pratapvardhan/pandas
pandas/io/formats/printing.py
6
13133
""" printing tools """ import sys from pandas.core.dtypes.inference import is_sequence from pandas import compat from pandas.compat import u from pandas.core.config import get_option def adjoin(space, *lists, **kwargs): """ Glues together two sets of strings using the amount of space requested. The idea ...
bsd-3-clause
chaluemwut/fbserver
venv/lib/python2.7/site-packages/sklearn/feature_selection/rfe.py
1
14237
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import numpy as np from ..utils import check_arrays, safe_sqr from ..base impo...
apache-2.0
lihongchun2007/SeeNN
heatmap/class_hot.py
1
4056
#!/usr/bin/env python2 import os import sys import pickle import argparse import tensorflow as tf import numpy as np from scipy.misc import imread, imresize from matplotlib import pyplot as plt def download_vgg16(): from six.moves import urllib model_files = ['https://www.cs.toronto.edu/~frossard/vgg16/vgg16...
gpl-3.0
andrewfullard/python-meet
exercise8.py
1
2207
# -*- coding: utf-8 -*- """ Created on Wed Nov 20 09:10:22 2013 @author: c0918140 """ import numpy as np import matplotlib.pyplot as plt import scipy.interpolate as interpolate def f(x): y = -np.exp(x)*(-2. + 2.*x + 5.*x**2. + x**3.) return y def R(r): y = -r**2./(1 + r**6) return y...
mit
rubydatasystems/seniority_list
seniority_list/interactive_plotting.py
1
9185
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' .. module:: interactive_plotting :synopsis: The bokeh module contains interactive plotting functions. .. moduleauthor:: Bob Davison <rubydatasystems@fastmail.net> ''' from bokeh.plotting import figure, ColumnDataSource # from bokeh.models import (HoverTool, Box...
gpl-3.0
piersy/theano-machine-learning
2_logistic_regression.py
1
1696
import matplotlib.pyplot as plt import theano from theano import tensor as T import numpy as np from load import mnist def floatX(X): return np.asarray(X, dtype=theano.config.floatX) def init_weights(shape): return theano.shared(floatX(np.random.randn(*shape) * 0.01)) def model(X, w): return T.nnet.softm...
mit
manterd/myPhyloDB
functions/analysis/pca_graphs.py
1
28862
import datetime from django.http import HttpResponse import logging import numpy as np import pandas as pd from pyper import * import json import functions LOG_FILENAME = 'error_log.txt' pd.set_option('display.max_colwidth', -1) def getPCA(request, stops, RID, PID): try: while True: if requ...
gpl-3.0
tdgoodrich/mase
python101/code/zipf.py
14
1453
"""This module contains code from Think Python by Allen B. Downey http://thinkpython.com Copyright 2012 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ import sys import string import matplotlib.pyplot as pyplot from analyze_book import * def rank_freq(hist): """Returns a list of ...
unlicense