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
Tong-Chen/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
2
7107
import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises ...
bsd-3-clause
appapantula/scikit-learn
examples/applications/svm_gui.py
287
11161
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
JohanComparat/nbody-npt-functions
bin/bin_SMHMr/MD10_add_eBOSS_COSMO.py
1
7842
from astropy.cosmology import FlatLambdaCDM import astropy.units as u cosmoMD = FlatLambdaCDM(H0=67.77*u.km/u.s/u.Mpc, Om0=0.307115, Ob0=0.048206) import glob import astropy.io.fits as fits import os import time import numpy as n import sys # specific functions from scipy.stats import norm from scipy.integrate import...
cc0-1.0
brev/nupic
src/nupic/research/monitor_mixin/plot.py
19
5187
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014-2015, 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 p...
agpl-3.0
mprelee/data-incubator-capstone
src/k_neighbors.py
1
2302
# Build Bag-of-Words model using a CountVectorizer # We will build a CountVectorizer, a one-hot vectorizer, and a tfidf vectorizer # Matt Prelee import pickle import re import pandas as pd import numpy as np import time from nltk.corpus import stopwords from sklearn.feature_extraction.text import CountVectorizer, Tfi...
gpl-2.0
CforED/Machine-Learning
examples/classification/plot_classifier_comparison.py
36
5123
#!/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
vermouthmjl/scikit-learn
sklearn/covariance/robust_covariance.py
105
29653
""" Robust location and covariance estimators. Here are implemented estimators that are resistant to outliers. """ # Author: Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import warnings import numbers import numpy as np from scipy import linalg from scipy.stats import chi2 from . import empir...
bsd-3-clause
Titan-C/scikit-learn
sklearn/externals/joblib/__init__.py
54
5087
"""Joblib is a set of tools to provide **lightweight pipelining in Python**. In particular, joblib offers: 1. transparent disk-caching of the output values and lazy re-evaluation (memoize pattern) 2. easy simple parallel computing 3. logging and tracing of the execution Joblib is optimized to be **fast** and **r...
bsd-3-clause
DSLituiev/scikit-learn
sklearn/model_selection/_split.py
21
57608
""" The :mod:`sklearn.model_selection._split` module includes classes and functions to split the data based on a preset strategy. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Girsel <olivier.grisel@ensta.org> # Ragha...
bsd-3-clause
TechplexEngineer/DB-Benchmarking-Tools
plotting/genstats.py
1
2006
#!/usr/bin/env python ### # Code to calculate statictics from dump file # B.Bourque 7/8/2015 ### import matplotlib.pyplot as plt import matplotlib.dates as md import numpy as np from datetime import datetime, timedelta # This function expects the data in [filename] to be tab separated. # Col1 is the unix timestamp a...
mit
arnavd96/Cinemiezer
myvenv/lib/python3.4/site-packages/numpy/doc/creation.py
118
5507
""" ============== Array Creation ============== Introduction ============ There are 5 general mechanisms for creating arrays: 1) Conversion from other Python structures (e.g., lists, tuples) 2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros, etc.) 3) Reading arrays from disk, either from...
mit
pearsonlab/nipype
nipype/utils/config.py
9
5668
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ''' Created on 20 Apr 2010 logging options : INFO, DEBUG hash_method : content, timestamp @author: Chris Filo Gorgolewski ''' from future import standard_library standard_library.install_aliases() from bu...
bsd-3-clause
ningchi/scikit-learn
sklearn/setup.py
225
2856
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
coders-creed/botathon
src/data_helpers.py
1
1045
# -*- coding: utf-8 -*- # @Author: karthik # @Date: 2016-12-10 23:04:24 # @Last Modified by: chandan # @Last Modified time: 2016-12-11 12:19:29 from models.company import Company import pandas as pd FILENAME = "resources/cnx500.csv" # arg parser def parse_args(args): arg_string = ' '.join(args) return set(filt...
mit
spnow/grr
gui/plugins/flow_management.py
1
29906
#!/usr/bin/env python # Copyright 2011 Google Inc. All Rights Reserved. """GUI elements allowing launching and management of flows.""" import os import StringIO import urllib import matplotlib.pyplot as plt from grr.gui import renderers from grr.gui.plugins import crash_view from grr.gui.plugins import fileview fr...
apache-2.0
snurk/meta-strains
final_algo/trash/temp_ig.py
1
1049
import pandas as pd import csv import networkx as nx from graph_functions import * from read_files import read_graph def read_answers_1(G, dataset_name="example"): df_ref = pd.read_csv("data/{}/refs_edges_0.txt".format(dataset_name), header=None, names=["e"]) df_ref = df_ref["e"].str.split('\t', 1, expand=T...
mit
AntonSax/plantcv
setup.py
1
4569
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ import sys import setuptools from setuptools.command.test import test as TestCommand from codecs import open from os import path class PyTest(TestCommand): def initialize_o...
mit
Johanu/MDAnalysis_scripts
coil_COMdistance.py
1
4687
from __future__ import division import matplotlib.pyplot as plt import MDAnalysis as md import numpy as np def calculate_dists(gro_file, xtc_file): u = md.Universe(gro_file, xtc_file) select_group1 = u.selectAtoms("backbone and (resnum 50 or resnum 51)") select_group2 = u.selectAtoms("backbone and (resnum ...
mit
ilo10/scikit-learn
sklearn/feature_extraction/tests/test_feature_hasher.py
258
2861
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
bsd-3-clause
matnel/hs-comments-visu
app/main.py
1
2374
from flask import * import collect_hs import collections import nltk import numpy from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import LatentDirichletAllocation app = Flask(__name__) ## common constructs stem = nltk.stem.snowball.SnowballStemmer('finnish') stopwords = map...
mit
numenta/htmresearch
projects/sequence_prediction/mackey_glass/visualize_results.py
13
1819
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
scubamut/trading-with-python
lib/bats.py
78
3458
#------------------------------------------------------------------------------- # Name: BATS # Purpose: get data from BATS exchange # # Author: jev # # Created: 17/08/2013 # Copyright: (c) Jev Kuznetsov 2013 # Licence: BSD #------------------------------------------------------------...
bsd-3-clause
donkirkby/live-py-plugin
docs/lessons/lesson09_tick_background.py
1
2343
""" The tick labels are now hardly visible because of the blue and red lines. We can make them bigger and we can also adjust their properties such that they'll be rendered on a semi-transparent white background. This will allow us to see both the data and the labels. We can also get rid of one of the zero labels. :less...
mit
jbrambleDC/sklearn_pydata2015
notebooks/fig_code/svm_gui.py
47
11549
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
saebrahimi/Emotion-Recognition-RNN
Audio/conf_mat_plot.py
2
1458
from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt import random def main(): true_labels = [random.randint(1, 10) for i in range(100)] predicted_labels = [random.randint(1, 10) for i in range(100)] plot = getConfusionMatrixPlot(true_labels, predicted_labels) plot.show() def g...
mit
ryfeus/lambda-packs
LightGBM_sklearn_scipy_numpy/source/numpy/linalg/linalg.py
3
80437
"""Lite version of scipy.linalg. Notes ----- This module is a lite version of the linalg.py module in SciPy which contains high-level Python interface to the LAPACK library. The lite version only accesses the following LAPACK functions: dgesv, zgesv, dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr...
mit
inspirehep/beard-server
beard_server/modules/predictor/arxiv.py
2
8502
# -*- coding: utf-8 -*- # # This file is part of Inspire. # Copyright (C) 2016 CERN. # # Inspire 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) any later...
gpl-2.0
rohanp/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
Djabbz/scikit-learn
sklearn/cluster/bicluster.py
211
19443
"""Spectral biclustering algorithms. Authors : Kemal Eren License: BSD 3 clause """ from abc import ABCMeta, abstractmethod import numpy as np from scipy.sparse import dia_matrix from scipy.sparse import issparse from . import KMeans, MiniBatchKMeans from ..base import BaseEstimator, BiclusterMixin from ..external...
bsd-3-clause
KristofferC/FeynSimul
examples/benchmark_xorshift_vs_ranlux.py
1
7136
import numpy as np import pylab as pl from matplotlib import rc from matplotlib.ticker import * import matplotlib.pyplot as plt logplot = True # Log the x axis or not showdouble = False #xor = np.array([0.000835, 0.021259, 0.077566, 2.113641, 7.748644, 213.113910]) #xorshift single xor = np.array([0.000835, 0.0212...
gpl-3.0
mohamed--abdel-maksoud/chromium.src
chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py
12
11594
#!/usr/bin/python # Copyright (c) 2012 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. """Do all the steps required to build and test against nacl.""" import optparse import os.path import re import shutil import subproc...
bsd-3-clause
fashandge/deja
src/experiment/utilities.py
1
31043
import os import re import itertools import time import datetime import string import random import nltk import toolz from nltk.corpus import wordnet as wn #from nltk.corpus import verbnet as vn #from nltk.corpus import framenet as fn from nltk.stem import WordNetLemmatizer from nltk.tag.stanford import POSTagger from ...
mit
ephes/scikit-learn
sklearn/svm/tests/test_bounds.py
280
2541
import nose from nose.tools import assert_equal, assert_true from sklearn.utils.testing import clean_warning_registry import warnings import numpy as np from scipy import sparse as sp from sklearn.svm.bounds import l1_min_c from sklearn.svm import LinearSVC from sklearn.linear_model.logistic import LogisticRegression...
bsd-3-clause
yousrabk/mne-python
mne/decoding/time_gen.py
1
51426
# Authors: Jean-Remi King <jeanremi.king@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Clement Moutard <clement.moutard@gmail.com> # # License: BSD (3-clause) import numpy as np import copy from ..io.pick import pick_...
bsd-3-clause
wesm/statsmodels
scikits/statsmodels/tools/datautils.py
1
2104
import os import time import numpy as np from numpy import genfromtxt, array class Dataset(dict): def __init__(self, **kw): dict.__init__(self,kw) self.__dict__ = self # Some datasets have string variables. If you want a raw_data attribute you # must create this in the dataset's load function. ...
bsd-3-clause
DSLituiev/scikit-learn
sklearn/utils/tests/test_random.py
85
7349
from __future__ import division import numpy as np import scipy.sparse as sp from scipy.misc import comb as combinations from numpy.testing import assert_array_almost_equal from sklearn.utils.random import sample_without_replacement from sklearn.utils.random import random_choice_csc from sklearn.utils.testing import ...
bsd-3-clause
chrissly31415/amimanera
competition_scripts/higgs.py
1
45715
#!/usr/bin/python # coding: utf-8 import numpy as np import pandas as pd import sklearn as sl import random import math from qsprLib import * import inspect import pickle from pandas.tools.plotting import scatter_matrix from xgboost_sklearn import * def createFeatures(X_all,keepAll=True,createNAFeats='all'): "...
lgpl-3.0
terrycojones/dark-matter
dark/proteins.py
1
43815
from __future__ import division, print_function import os from collections import defaultdict, Counter import numpy as np from os.path import dirname, exists, join from operator import itemgetter import re from six.moves.urllib.parse import quote from textwrap import fill from dark.dimension import dimensionalIterato...
mit
lbishal/scikit-learn
sklearn/tree/tree.py
23
40423
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Da...
bsd-3-clause
aolindahl/polarization-monitor
offline_viewer.py
2
9811
# -*- coding: utf-8 -*- """ Created on Wed Apr 22 15:32:02 2015 @author: Anton O Lindahl """ import h5py import numpy as np import matplotlib.pyplot as plt import lmfit import sys import os.path sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/aolPyModules') import cookie_box from Burnin...
gpl-2.0
dipanjanS/text-analytics-with-python
New-Second-Edition/Ch05 - Text Classification/model_evaluation_utils.py
2
9263
# -*- coding: utf-8 -*- """ Created on Mon Jul 31 20:05:23 2017 @author: DIP @Copyright: Dipanjan Sarkar """ from sklearn import metrics import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.base import clone from sklearn.preprocessing impor...
apache-2.0
0todd0000/spm1d
spm1d/examples/stats0d/ex_ci_pairedsample.py
1
1479
import numpy as np from matplotlib import pyplot import spm1d #(0) Load dataset: dataset = spm1d.data.uv0d.cipaired.FraminghamSystolicBloodPressure() yA,yB = dataset.get_data() print( dataset ) # yB += 1.9 #(1) Compute confidence intervals: alpha = 0.05 mu = 0 ci0 = spm1d.stats.ci_pairedsample(yA, y...
gpl-3.0
zehpunktbarron/iOSMAnalyzer
scripts/c3_highway_actuality.py
1
6584
# -*- coding: utf-8 -*- #!/usr/bin/python2.7 #description :This file creates a plot: Calculates the actuality of the total OSM highway. Additionally plots the first version for comparison purposes #author :Christopher Barron @ http://giscience.uni-hd.de/ #date :19.01.2013 #version :0.1 ...
gpl-3.0
PanDAWMS/panda-jedi
pandajedi/jeditest/addTestTask.py
1
3246
import sys import uuid from pandajedi.jedicore.JediTaskBufferInterface import JediTaskBufferInterface from pandajedi.jedicore.JediTaskSpec import JediTaskSpec from pandajedi.jedicore.JediDatasetSpec import JediDatasetSpec tbIF = JediTaskBufferInterface() tbIF.setupInterface() task = JediTaskSpec() task.jediTaskID =...
apache-2.0
torebutlin/cued_datalogger
setup.py
1
7651
from setuptools import setup import sys import subprocess from os.path import isfile import urllib.request import traceback import pip def version(): """Get version number""" with open('cued_datalogger/VERSION') as f: return f.read() def readme(): """Get text from the README.rst""" with open('...
bsd-3-clause
stkubr/zipline
zipline/utils/munge.py
29
2299
# # Copyright 2015 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
tapomayukh/projects_in_python
classification/Classification_with_HMM/Multiple_Contact_Classification/continuous_hmm_prediction_two_objects_force_motion_10_states.py
1
10741
# Hidden Markov Model Implementation import pylab as pyl import numpy as np import matplotlib.pyplot as pp #from enthought.mayavi import mlab import scipy as scp import scipy.ndimage as ni import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3') import rospy #import hrl_lib.mayavi2_util as mu import hrl_lib.viz...
mit
mtat76/atm-py
build/lib/atmPy/for_removal/LAS/LAS.py
6
8188
# -*- coding: utf-8 -*- """ Created on Mon Nov 10 11:43:10 2014 @author: htelg """ import datetime import warnings import numpy as np import pandas as pd import pylab as plt from StringIO import StringIO as io from scipy.interpolate import UnivariateSpline from atmPy.aerosols.size_distr import sizedistribution de...
mit
DonBeo/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
drakipovic/deep-learning
1. labos/fcann.py
1
1825
import numpy as np from sklearn.preprocessing import OneHotEncoder import matplotlib.pyplot as plt from data import sample_gmm_2d, eval_perf_binary, graph_data, graph_surface def forward(X, w_1, w_2, b_1, b_2): s_1 = np.dot(X, w_1) + b_1 h_1 = np.maximum(s_1, np.zeros(s_1.shape)) s_2 = np.dot(h_1, w...
mit
MartinThoma/write-math
tools/evaluate_preprocessing_algorithms.py
1
8689
#!/usr/bin/env python # -*- coding: utf-8 -*- """Find outliers in the dataset.""" import pymysql.cursors from copy import deepcopy from hwrt.handwritten_data import HandwrittenData from hwrt import preprocessing from hwrt import utils class HandwrittenDataM(HandwrittenData): """A modified version of Handwritte...
mit
girone/hatmaker
cluster.py
1
2450
import csv import sys import pprint from collections import defaultdict from sklearn.cluster import KMeans import numpy as np import pandas as pd from format_data import audit_experience, audit_height, audit_fitness, audit_throwing def extract_fields(line_dict): return (line_dict["name"], audit_experi...
mit
runt18/nupic
examples/audiostream/audiostream_tp.py
32
9991
#!/usr/bin/env python # ---------------------------------------------------------------------- # 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 ...
agpl-3.0
zerothi/siesta-es
sids/es/hamiltonian.py
1
3350
""" Electronic structure code which handles the Hamiltonian """ import numpy as _np import sids.helper.units as _unit # Import scipy linear algebra routines import scipy.linalg as _dlin import scipy.sparse.linalg as _slin class Hamiltonian(object): """ Object for retaining information about the Hamiltonian ma...
gpl-3.0
tschaume/pymatgen
pymatgen/phonon/plotter.py
2
23775
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import logging from collections import OrderedDict, namedtuple import numpy as np import scipy.constants as const from monty.json import jsanitize from pymatgen.phonon.bandstructure import PhononBandStructure...
mit
ioos/system-test
Theme_1_Baseline/Scenario_1B_CoreVariable_Strings/Scenario_1B_CoreVariable_Strings.py
2
7535
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> from utilities import css_styles css_styles() # <markdowncell> # # IOOS System Test - Theme 1 - Scenario B - [Description](https://github.com/ioos/system-test/wiki/Development-of-Test-Themes#theme-1-baseline-assessment) # # ## Core Variable Strings # ...
unlicense
mrbean-bremen/pyfakefs
pyfakefs/patched_packages.py
2
4115
# 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, software # distributed under t...
apache-2.0
YinongLong/scikit-learn
sklearn/gaussian_process/gpc.py
42
31571
"""Gaussian processes classification.""" # 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 from scipy.optimize import fmin_l_bfgs_b from scipy.special import erf...
bsd-3-clause
chongguang/scikitLearning
c2-housePrice.py
1
2829
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_boston boston = load_boston() print boston.data.shape print boston.feature_names print np.max(boston.target), np.min(boston.target), np.mean(boston.target) #print boston.DESCR from sklearn.cross_validation import train_test_split X_...
mit
SteveNguyen/QM_OptimalControl
plot.py
1
3168
#!/usr/bin/python # -*- coding: utf-8 -*- ######################################################################## # File Name : 'plot_v_a.py' # Author : Steve NGUYEN # Contact : steve.nguyen@college-de-france.fr # Created : mercredi, septembre 14 2011 # Revised : # Version : # Target MCU : # # This c...
gpl-2.0
DTMilodowski/LiDAR_canopy
src/BALI_synthesis_contribution/canopy_profiles_oilpalm.py
1
6736
############################################################################################################### # This driver function analyses the sensisitivity of the LiDAR-based metrics to spatial scale and point density ################################################################################################...
gpl-3.0
joewledger/Green_Labs_Plotting
package/plotting/implemented_plotters.py
1
15309
from collections import * from PyQt5.QtGui import QColor from package.utils import param_utils from package.plotting import generic_plotters as gen_plt from PyQt5.QtCore import * import pandas as pd import numpy as np class Plotter(): subset_functions = OrderedDict([(lambda hdc: hdc, "Entire Study Period"), ...
lgpl-3.0
chakpongchung/RIPS_2014_BGI_source_code
scikit_code/classifier_with_multi_components.py
1
3607
#!/usr/bin/python # -*- coding: utf-8 -*- import numpy as np import sys import csv from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler from sklearn.datasets import make_moons, make_circles, make_classification from sklearn.neighbors import KNeighborsClassifier from sklearn.svm impor...
mit
lseman/pylspm
pylspm/blindfolding.py
1
2545
# CHIN, W. W. How to Write Up and Report PLS Analyses. In: Handbook of # Partial Least Squares. Berlin, Heidelberg: Springer Berlin Heidelberg, # 2010. p. 655–690. import pandas import numpy as np from numpy import inf import pandas as pd from .pylspm import PyLSpm from .boot import PyLSboot def isNaN(...
mit
LiuVII/Self-driving-RC-car
drive4.py
1
10712
from __future__ import print_function import pygame import os, sys, time, shutil from datetime import datetime import select import argparse import urllib2 import subprocess import cv2 import numpy as np, pandas as pd from PIL import ImageOps from PIL import Image from train4 import process_image, model import logging ...
mit
jorik041/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
230
2649
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
Lucas-Armand/genetic-algorithm
dev/9ºSemana/3DsequenceShip.py
1
5268
# -*- coding: utf-8 -*- import os import math import csv from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np from itertools import product, combinations import matplotlib.animation as animation def csv_read(name): #Metodo de leitura, transforma um arquivo CSV em um vetor ...
gpl-3.0
jondo/shogun
examples/undocumented/python_static/graphical/util.py
22
1225
""" Utilities for matplotlib examples """ import pylab from numpy import ones, array, meshgrid, linspace, concatenate, ravel, min, max from numpy.random import randn QUITKEY='q' NUM_EXAMPLES=200 DISTANCE=2 def quit (event): if event.key==QUITKEY or event.key==QUITKEY.upper(): pylab.close() def set_title (title):...
gpl-3.0
ondrejch/MSBR-ORNL-4528
scripts/analyze-lattices/kmax.py
1
3249
#!/usr/bin/python3 # # Analysis module for MSBR lattice collection. Finds the highest KEFF(l,sf) for given CR # Ondrej Chvala, ochvala@utk.edu # 2016-07-16 # GNU/GPL # # https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CloughTocher2DInterpolator.html import numpy as np import matplotlib.pyplot a...
gpl-2.0
wndhydrnt/airflow
airflow/hooks/base_hook.py
3
3216
# -*- coding: utf-8 -*- # # 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 #...
apache-2.0
gfetterman/bark
bark/tools/datenvclassify.py
2
5284
import bark import numpy as np import pandas as pd import os.path from scipy.signal import filtfilt, butter from scipy.io import wavfile def abs_and_smooth(x, sr, lp=100): abs_x = np.abs(x) if len(x.shape) > 1: abs_x = np.sum(abs_x, axis=-1) # sum over last dimension eg sum ove...
gpl-2.0
potash/scikit-learn
sklearn/naive_bayes.py
26
30641
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
nicjhan/MOM6-examples
tools/analysis/meridional_overturning.py
4
6978
#!/usr/bin/env python import io import netCDF4 import numpy import m6plot import m6toolbox import matplotlib.pyplot as plt import os import sys def run(): try: import argparse except: raise Exception('This version of python is not new enough. python 2.7 or newer is required.') parser = argparse.ArgumentParser(d...
gpl-3.0
fspaolo/scikit-learn
examples/cluster/plot_digits_agglomeration.py
7
1651
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Feature agglomeration ========================================================= These images how similar features are merged together using feature agglomeration. """ print(__doc__) # Code source: Gaël Varoquaux #...
bsd-3-clause
mehdidc/scikit-learn
sklearn/tests/test_calibration.py
2
11711
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_greater, assert_almost_equal, ...
bsd-3-clause
silky/sms-tools
lectures/03-Fourier-properties/plots-code/fft-zero-phase.py
24
1140
import matplotlib.pyplot as plt import numpy as np from scipy.fftpack import fft, fftshift import sys sys.path.append('../../../software/models/') import utilFunctions as UF (fs, x) = UF.wavread('../../../sounds/oboe-A4.wav') N = 512 M = 401 hN = N/2 hM = (M+1)/2 start = .8*fs xw = x[start-hM:start+hM-1] * np.h...
agpl-3.0
JosePedroMatos/Tethys
gpu/functions.py
1
9061
''' Created on 10 nov. 2016 @author: José Pedro Matos ''' import time import warnings import numpy as np import matplotlib.pyplot as plt import mpld3 from mpld3 import utils, plugins from queue import Empty from scipy.interpolate.interpolate import interp1d def plot(queue): fig = plt.figure(figsi...
mit
xiaoxiamii/scikit-learn
sklearn/linear_model/tests/test_ransac.py
216
13290
import numpy as np from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises_regexp from scipy import sparse from sklearn.utils.testing import assert_less from sklearn.linear_model import LinearRegression, RANSACRegressor f...
bsd-3-clause
lotrus28/TaboCom
linear_model/model_test/random_forest/create_som_visualisation.py
1
3687
from mvpa2.suite import * import pandas as pd import numpy as np import matplotlib.pyplot as plt import pickle # /usr/local/lib/python2.7/dist-packages/ sz = (10, 10) p_agp = '/media/theo/Files/Lab/FHM/Complement/cross_valid_AGP_PRJEB/agp/' p_prjeb = '/media/theo/Files/Lab/FHM/Complement/cross_valid_AGP_PRJEB/prjeb/...
apache-2.0
hsiaoyi0504/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
348
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
vortex-ape/scikit-learn
examples/feature_selection/plot_select_from_model_boston.py
17
1531
""" =================================================== Feature selection using SelectFromModel and LassoCV =================================================== Use SelectFromModel meta-transformer along with Lasso to select the best couple of features from the Boston dataset. """ # Author: Manoj Kumar <mks542@nyu.edu>...
bsd-3-clause
GuessWhoSamFoo/pandas
pandas/core/computation/expr.py
2
26830
""":func:`~pandas.eval` parsers """ import ast from functools import partial import tokenize import numpy as np from pandas.compat import StringIO, lmap, reduce, string_types, zip import pandas as pd from pandas import compat from pandas.core import common as com from pandas.core.base import StringMixin from pandas...
bsd-3-clause
vibhorag/scikit-learn
examples/decomposition/plot_sparse_coding.py
247
3846
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
jorge2703/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
242
5885
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
sinhrks/scikit-learn
examples/missing_values.py
71
3055
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause
acapet/GHER-POSTPROC
Examples/MonthlyMapsBottomAge_2Ddist.py
1
3445
import numpy as np import numpy.ma as ma from netCDF4 import Dataset #from mpl_toolkits.basemap import Basemap #from multiprocessing import Pool #import gsw ...
gpl-3.0
tjduigna/exatomic
exatomic/core/editor.py
3
2918
# -*- coding: utf-8 -*- # Copyright (c) 2015-2018, Exa Analytics Development Team # Distributed under the terms of the Apache License 2.0 """ Atomic Editor ################### This module provides a text file editor that can be used to transform commonly found file formats directly into :class:`~exatomic.container.Univ...
apache-2.0
dmnfarrell/mirnaseq
smallrnaseq/analysis.py
2
12574
#!/usr/bin/env python # 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. # # This program is distributed in the hope that ...
gpl-3.0
TimothyTickle/quickplots
histogram.py
1
2009
#!/usr/bin/env python __author__ = "Timothy Tickle" __copyright__ = "Copyright 2014" __credits__ = [ "Timothy Tickle" ] __license__ = "MIT" __maintainer__ = "Timothy Tickle" __email__ = "ttickle@broadinstitute.org" __status__ = "Development" import matplotlib.pyplot as plt import quickPlot as qp class Histogram( q...
mit
AnasGhrab/scikit-learn
doc/sphinxext/gen_rst.py
142
40026
""" Example generation for the scikit learn Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ from __future__ import division, print_function from time import time import ast import os import re import shutil import traceback i...
bsd-3-clause
Technologicat/python-wlsqm
examples/expertsolver_example.py
1
6402
# -*- coding: utf-8 -*- """A minimal usage example for ExpertSolver. JJ 2017-03-28 """ from __future__ import division, print_function, absolute_import import numpy as np import scipy.spatial.ckdtree import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d import wlsqm def project_onto_regular_grid_2D...
bsd-2-clause
dtorresf/TheGrapher
Port.py
1
1049
import Methods import pandas as pd class Port: '''Class that represents a Port from a Switch with atributtes to graph ''' def __init__(self): self.name = '' self.switchname = '' self.rx = pd.DataFrame() self.tx = pd.DataFrame() def meanrx(self): return self.rx.mean() def meantx(self): return self.tx....
gpl-3.0
xubenben/scikit-learn
sklearn/linear_model/tests/test_theil_sen.py
234
9928
""" Testing for Theil-Sen module (sklearn.linear_model.theil_sen) """ # Author: Florian Wilhelm <florian.wilhelm@gmail.com> # License: BSD 3 clause from __future__ import division, print_function, absolute_import import os import sys from contextlib import contextmanager import numpy as np from numpy.testing import ...
bsd-3-clause
lbillingham/commit_opener
commit_opener/commit_opener.py
1
2151
# -*- coding: utf-8 -*- import click import os import pandas as pd from shutil import rmtree from . tree_scrape import author_minded from . query_pmc import pmc_data OUT_SUBFOLDER = 'contrib_data' AUTHOR_DATA = 'author_data.json' def verify_local_repo_location(repo): if not os.path.isdir(repo): raise IOE...
gpl-3.0
minimumcut/UnnamedEngine
UnnamedEngine/Vendor/bullet/examples/pybullet/testrender.py
3
1357
import numpy as np import matplotlib.pyplot as plt import pybullet pybullet.connect(pybullet.GUI) pybullet.loadURDF("r2d2.urdf") camTargetPos = [0.,0.,0.] cameraUp = [0,0,1] cameraPos = [1,1,1] yaw = 40 pitch = 10.0 roll=0 upAxisIndex = 2 camDistance = 4 pixelWidth = 320 pixelHeight = 240 nearPlane = 0.01 farPlane =...
mit
ericmckean/syzygy
syzygy/build/create_virtualenv.py
8
5865
# Copyright 2012 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 a...
apache-2.0
RayMick/scikit-learn
sklearn/metrics/tests/test_ranking.py
127
40813
from __future__ import division, print_function import numpy as np from itertools import product import warnings from scipy.sparse import csr_matrix from sklearn import datasets from sklearn import svm from sklearn import ensemble from sklearn.datasets import make_multilabel_classification from sklearn.random_projec...
bsd-3-clause
roxyboy/scikit-learn
examples/classification/plot_lda_qda.py
164
4806
""" ==================================================================== Linear and Quadratic Discriminant Analysis with confidence ellipsoid ==================================================================== Plot the confidence ellipsoids of each class and decision boundary """ print(__doc__) from scipy import lin...
bsd-3-clause
ces0712/mtools
mtools/mplotqueries/plottypes/range_type.py
7
3323
from mtools.mplotqueries.plottypes.base_type import BasePlotType from datetime import timedelta import argparse try: from matplotlib.dates import date2num, num2date except ImportError: raise ImportError("Can't import matplotlib. See https://github.com/rueckstiess/mtools/blob/master/INSTALL.md for \ ins...
apache-2.0
carrillo/scikit-learn
sklearn/linear_model/coordinate_descent.py
59
76336
# 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