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
deokwooj/DDEA
webgui/pack_cluster.py
1
20586
#!/usr/bin/python # To force float point division from __future__ import division """ Created on Thu Mar 13 16:34:54 2014 Author : Deokwoo Jung E-mail : deokwoo.jung@gmail.com """ import numpy as np #from numpy.linalg import norm from sklearn import cluster from sklearn.cluster import Ward from sklearn.cluster import...
gpl-2.0
MatthewRueben/multiple-explorers
classes/environment.py
1
13566
#!/usr/bin/env python from geography import Bounds2D, Location, POI from rovers import Rover from roverSettingsStruct import RoverSettings import random import itertools from matplotlib import pyplot import copy class World(): def __init__(self, world_bounds, N_poi, poi_bounds, rover_settings, rover_start, rovHea...
mit
Srisai85/scikit-learn
sklearn/utils/multiclass.py
83
12343
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
xtonyjiang/GNOVA
calculate.py
1
5915
#!/usr/bin/python from __future__ import division import collections from itertools import product import numpy as np import pandas as pd from sklearn import linear_model from scipy.stats import norm from numpy.linalg import inv def calculate(gwas_snps, ld_scores, annots, N1, N2): np.seterr(invalid='ignore') ...
gpl-3.0
ECP-CANDLE/Benchmarks
Pilot1/P1B2/p1b2.py
1
4456
from __future__ import print_function import pandas as pd import numpy as np from sklearn.metrics import accuracy_score import os import sys import logging import argparse try: import configparser except ImportError: import ConfigParser as configparser file_path = os.path.dirname(os.path.realpath(__file__)...
mit
Edu-Glez/Bank_sentiment_analysis
env/lib/python3.6/site-packages/pandas/tests/test_compat.py
9
2455
# -*- coding: utf-8 -*- """ Testing that functions from compat work as expected """ from pandas.compat import (range, zip, map, filter, lrange, lzip, lmap, lfilter, builtins, iterkeys, itervalues, iteritems, next) import pandas.util.testing as tm class TestBuilti...
apache-2.0
Nyker510/scikit-learn
examples/mixture/plot_gmm_pdf.py
284
1528
""" ============================================= Density Estimation for a mixture of Gaussians ============================================= Plot the density estimation of a mixture of two Gaussians. Data is generated from two Gaussians with different centers and covariance matrices. """ import numpy as np import ma...
bsd-3-clause
stiphyMT/plantcv
plantcv/plantcv/morphology/segment_tangent_angle.py
2
5430
# Find tangent angles in degrees of skeleton segments import os import cv2 import numpy as np import pandas as pd from plantcv.plantcv import params from plantcv.plantcv import outputs from plantcv.plantcv import plot_image from plantcv.plantcv import print_image from plantcv.plantcv import find_objects from plantcv.p...
mit
zhwa/thunder
thunder/rdds/fileio/tifffile.py
9
173192
#!/usr/bin/env python # -*- coding: utf-8 -*- # tifffile.py # Copyright (c) 2008-2014, Christoph Gohlke # Copyright (c) 2008-2014, The Regents of the University of California # Produced at the Laboratory for Fluorescence Dynamics # All rights reserved. # # Redistribution and use in source and binary forms, with or wit...
apache-2.0
nathania/networkx
examples/multigraph/chess_masters.py
54
5146
#!/usr/bin/env python """ An example of the MultiDiGraph clas The function chess_pgn_graph reads a collection of chess matches stored in the specified PGN file (PGN ="Portable Game Notation") Here the (compressed) default file --- chess_masters_WCC.pgn.bz2 --- contains all 685 World Chess Championship matches from...
bsd-3-clause
murali-munna/scikit-learn
sklearn/decomposition/__init__.py
147
1421
""" The :mod:`sklearn.decomposition` module includes matrix decomposition algorithms, including among others PCA, NMF or ICA. Most of the algorithms of this module can be regarded as dimensionality reduction techniques. """ from .nmf import NMF, ProjectedGradientNMF from .pca import PCA, RandomizedPCA from .incrementa...
bsd-3-clause
k8si/691CL_project
Baseline - files.py
1
5438
# -*- coding: utf-8 -*- """ Created on Sat May 03 16:40:23 2014 @author: Helene """ import glob, os, re, nltk, random, time, sklearn import numpy as np from nltk.corpus import stopwords from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.metrics.pairwise import linear_kernel sto...
mit
thareUSGS/GDAL_scripts
gdal_baseline_slope/python2/slope_histogram_cumulative_graph.py
2
4103
#!/usr/bin/env python #/****************************************************************************** # * $Id$ # * # * Project: GDAL Make Histogram and Cumulative graph from Tab delimited tab as # generated by gdal_hist.py # * Purpose: Take a gdal_hist.py output and create a histogram plot using matp...
unlicense
sarunya-w/CS402-PROJECT
Project/feature_extraction/feature_extraction_parallel/fftengine.py
1
3973
# -*- coding: utf-8 -*- """ Created on Mon Apr 27 17:31:34 2015 @author: Sarunya """ import sys import numpy as np from PIL import Image from matplotlib import pyplot as plt import scipy.ndimage #from scipy.ndimage import filters #import time sys.setrecursionlimit(10000) bs = 200 wd = 8 # theta_range=wd*wd*2 clmax ...
mit
oesteban/seaborn
doc/sphinxext/plot_directive.py
38
27578
""" A directive for including a matplotlib plot in a Sphinx document. By default, in HTML output, `plot` will include a .png file with a link to a high-res .png and .pdf. In LaTeX output, it will include a .pdf. The source code for the plot may be included in one of three ways: 1. **A path to a source file** as t...
bsd-3-clause
wdurhamh/statsmodels
statsmodels/graphics/tests/test_boxplots.py
28
1257
import numpy as np from numpy.testing import dec from statsmodels.graphics.boxplots import violinplot, beanplot from statsmodels.datasets import anes96 try: import matplotlib.pyplot as plt have_matplotlib = True except: have_matplotlib = False @dec.skipif(not have_matplotlib) def test_violinplot_beanpl...
bsd-3-clause
iancze/PSOAP
scripts/make_fake_primary_data.py
1
1680
import matplotlib.pyplot as plt import numpy as np from scipy.linalg import cho_factor, cho_solve from psoap import constants as C from psoap.data import lkca14, redshift from psoap import covariance # Optimized parameters for this chunk. Not that relevant though, since we are just using the GP # as an interpolator....
mit
wesm/statsmodels
scikits/statsmodels/sandbox/distributions/examples/ex_mvelliptical.py
1
5134
# -*- coding: utf-8 -*- """examples for multivariate normal and t distributions Created on Fri Jun 03 16:00:26 2011 @author: josef for comparison I used R mvtnorm version 0.9-96 """ import numpy as np import scikits.statsmodels.sandbox.distributions.mv_normal as mvd from numpy.testing import assert_array_almost...
bsd-3-clause
toobaz/pandas
pandas/tests/indexes/period/test_asfreq.py
2
6254
import numpy as np import pytest import pandas as pd from pandas import DataFrame, PeriodIndex, Series, period_range from pandas.util import testing as tm class TestPeriodIndex: def test_asfreq(self): pi1 = period_range(freq="A", start="1/1/2001", end="1/1/2001") pi2 = period_range(freq="Q", star...
bsd-3-clause
hsuantien/scikit-learn
sklearn/linear_model/tests/test_passive_aggressive.py
121
6117
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.base import ClassifierMixin from skle...
bsd-3-clause
giancarloescobar/project-kappa
code/utils/eda.py
2
4040
""" Script to run eda """ from convolve import * from events2neural_fixed import * from harmonic import * from loading_data import * import numpy as np import numpy.linalg as npl import matplotlib.pyplot as plt import nibabel as nib from dipy.segment.mask import median_otsu from design_matrix import * ...
bsd-3-clause
jarryliu/queue-sim
measure/plot/process_log.py
1
21095
#!/usr/local/bin/python3 # support only python3 import numpy as np import matplotlib.pyplot as plt import re from math import sqrt, floor, ceil from process_theory import * import scipy as sp import scipy.stats import matplotlib.patches as mpatches from matplotlib.colors import colorConverter as cc # get the all the l...
mit
pypot/scikit-learn
sklearn/ensemble/weight_boosting.py
30
40648
"""Weight Boosting This module contains weight boosting estimators for both classification and regression. The module structure is the following: - The ``BaseWeightBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regression and classification only differ from each ot...
bsd-3-clause
tdhopper/scikit-learn
benchmarks/bench_multilabel_metrics.py
276
7138
#!/usr/bin/env python """ A comparison of multilabel target formats and metrics over them """ from __future__ import division from __future__ import print_function from timeit import timeit from functools import partial import itertools import argparse import sys import matplotlib.pyplot as plt import scipy.sparse as...
bsd-3-clause
galad-loth/DescHash
ProductQuant.py
1
3595
import numpy as npy from LoadData import ReadFvecs,ReadIvecs from sklearn.cluster import KMeans from scipy.spatial.distance import pdist,squareform from Utils import GetRetrivalMetric, GetKnnIdx def PQTrain(data, lenSubVec,numSubCenter): (dataSize, dataDim)=data.shape if 0!=dataDim%lenSubVec: ...
apache-2.0
geektoni/Influenza-Like-Illness-Predictor
data_analysis/get_model_statistics.py
1
2940
# -*- coding: utf-8 -*- """Script which can be used to compare the features obtained of two different influenza models Usage: get_model_statistics.py <model> [--country=<country_name>] [--no-future] [--basedir=<directory>] [--start-year=<start_year>] [--end-year=<end_year>] [--save] [--no-graph] <baseline> ...
mit
jm-begon/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause
lucidfrontier45/scikit-learn
examples/plot_feature_selection.py
2
2800
""" =============================== Univariate Feature Selection =============================== An example showing univariate feature selection. Noisy (non informative) features are added to the iris data and univariate feature selection is applied. For each feature, we plot the p-values for the univariate feature s...
bsd-3-clause
alivecor/tensorflow
tensorflow/examples/learn/iris_custom_model.py
37
3651
# 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
toastedcornflakes/scikit-learn
examples/gaussian_process/plot_gpc_iris.py
81
2231
""" ===================================================== Gaussian process classification (GPC) on iris dataset ===================================================== This example illustrates the predicted probability of GPC for an isotropic and anisotropic RBF kernel on a two-dimensional version for the iris-dataset. ...
bsd-3-clause
juhaj/topics-python-in-research
codes/python/solve_heat_equation_with_flow.py
1
1751
# Julius B. Kirkegaard 11/01/17 # jbk28@cam.ac.uk import numpy as np import matplotlib.pyplot as plt def to_vector(mat): return np.ravel(mat) def to_matrix(vec): return np.reshape(vec, shape) ### Define grid dx = 0.02 x = np.arange(0, 1 + dx, dx) m = len(x) X, Y = np.meshgrid(x, x) shape = X.shape # Transfe...
gpl-3.0
ThomasMiconi/htmresearch
htmresearch/frameworks/capybara/supervised/plot.py
7
3244
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2017, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
agpl-3.0
elkingtonmcb/scikit-learn
sklearn/neighbors/graph.py
208
7031
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_...
bsd-3-clause
AdaptiveApplications/carnegie
tarc_bus_locator_client/numpy-1.8.1/build/lib.linux-x86_64-2.7/numpy/lib/recfunctions.py
17
35016
""" Collection of utilities to manipulate structured arrays. Most of these functions were initially implemented by John Hunter for matplotlib. They have been rewritten and extended for convenience. """ from __future__ import division, absolute_import, print_function import sys import itertools import numpy as np imp...
mit
ilyes14/scikit-learn
sklearn/decomposition/nmf.py
35
39369
""" Non-negative matrix factorization """ # Author: Vlad Niculae # Lars Buitinck <L.J.Buitinck@uva.nl> # Mathieu Blondel <mathieu@mblondel.org> # Tom Dupre la Tour # Author: Chih-Jen Lin, National Taiwan University (original projected gradient # ...
bsd-3-clause
cvjena/libmaxdiv
experiments/hpw.py
1
4781
""" Runs the MDI algorithm on the Hurricane time-series. """ import sys sys.path.append('..') import numpy as np import matplotlib.pylab as plt import csv, datetime from collections import OrderedDict from maxdiv import maxdiv, preproc, baselines_noninterval, eval HURRICANE_GT = { \ 'Sandy' : (datetime.dat...
lgpl-3.0
henridwyer/scikit-learn
sklearn/decomposition/nmf.py
15
19103
""" Non-negative matrix factorization """ # Author: Vlad Niculae # Lars Buitinck <L.J.Buitinck@uva.nl> # Author: Chih-Jen Lin, National Taiwan University (original projected gradient # NMF implementation) # Author: Anthony Di Franco (original Python and NumPy port) # License: BSD 3 clause from __future__ ...
bsd-3-clause
mikeireland/pymfe
ghost_fit.py
1
2187
"""A script to fit tramlines etc for Ghost data. """ from __future__ import division, print_function import pymfe import astropy.io.fits as pyfits import numpy as np import matplotlib.pyplot as plt import pdb import shutil import matplotlib.cm as cm #plt.ion() #Define the files in use (NB xmod.txt and wavemod.txt ...
mit
Juggerr/pykml
docs/sphinxext/matplotlib/ipython_directive.py
7
15656
import sys, os, shutil, imp, warnings, cStringIO, re import IPython from IPython.Shell import MatplotlibShell try: from hashlib import md5 except ImportError: from md5 import md5 from docutils.parsers.rst import directives import sphinx sphinx_version = sphinx.__version__.split(".") # The split is necessar...
bsd-3-clause
mwalton/artificial-olfaction
evoVisualization/cloud.py
1
1382
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import argparse from sklearn.preprocessing import StandardScaler from sklearn import decomposition from sklearn import datasets # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argum...
mit
poffuomo/spark
python/pyspark/sql/tests.py
1
113287
# -*- encoding: 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
batuhaniskr/Social-Network-Tracking-And-Analysis
analysis.py
1
4391
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- import getopt import json import os.path import sqlite3 import sys from collections import Counter import matplotlib.pyplot as pl import numpy as np from flask import Flask, render_template from geopy.geocoders import Nominatim from termcolor import colored import set...
mit
HWNi/DATA515-Project
uberTaxi/script/split_data.py
1
1590
import pandas as pd import os def split_uber_data(file_name): """ A function split the data/time of Uber data set. Parameter: Uber data file, month Return: True or False for unittest purpose True, the output file saved False, the output file fail to saved """ df = pd....
mit
mayblue9/scikit-learn
examples/text/document_clustering.py
230
8356
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
bsd-3-clause
michigraber/scikit-learn
examples/neighbors/plot_nearest_centroid.py
264
1804
""" =============================== Nearest Centroid Classification =============================== Sample usage of Nearest Centroid classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap f...
bsd-3-clause
Nelca/buildMLSystem
ch06/03_clean.py
6
5976
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License # # This script tries to improve the classifier by cleaning the tweets a bit # import time start_time ...
mit
Ademan/NumPy-GSoC
numpy/lib/npyio.py
4
56059
__all__ = ['savetxt', 'loadtxt', 'genfromtxt', 'ndfromtxt', 'mafromtxt', 'recfromtxt', 'recfromcsv', 'load', 'loads', 'save', 'savez', 'packbits', 'unpackbits', 'fromregex', 'DataSource'] import numpy as np import format import sys import os import sys import itertools import warnings from operator imp...
bsd-3-clause
lancezlin/ml_template_py
lib/python2.7/site-packages/pandas/core/groupby.py
7
147947
import types from functools import wraps import numpy as np import datetime import collections import warnings import copy from pandas.compat import( zip, range, long, lzip, callable, map ) from pandas import compat from pandas.compat.numpy import function as nv from pandas.compat.numpy import _np_version_unde...
mit
qbilius/streams
streams/utils.py
1
13227
import functools import numpy as np import scipy.stats import pandas import matplotlib.pyplot as plt import seaborn as sns def splithalf(data, aggfunc=np.nanmean, rng=None): data = np.array(data) if rng is None: rng = np.random.RandomState(None) inds = list(range(data.shape[0])) rng.shuffle(i...
gpl-3.0
DamCB/tyssue
tyssue/dynamics/planar_gradients.py
2
1567
import pandas as pd from ..utils.utils import _to_2d def area_grad(sheet): coords = sheet.coords inv_area = sheet.edge_df.eval("1 / (4 * sub_area)") face_pos = sheet.edge_df[["f" + c for c in coords]] srce_pos = sheet.edge_df[["s" + c for c in coords]] trgt_pos = sheet.edge_df[["t" + c for c in...
gpl-3.0
jzt5132/scikit-learn
examples/cluster/plot_digits_linkage.py
369
2959
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
bsd-3-clause
ElDeveloper/scikit-learn
examples/neighbors/plot_classification.py
287
1790
""" ================================ Nearest Neighbors Classification ================================ Sample usage of Nearest Neighbors classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColorm...
bsd-3-clause
pierreberthet/local-scripts
compare.py
1
5832
import numpy as np import json import matplotlib #matplotlib.use('Agg') import pylab as pl import sys import pprint as pp import difflib #from difflib_data import * # Plot the different figures for the merged spikes and voltages recordings. # This file, as the MergeSpikefiles.py should be one level up than Test/..., th...
gpl-2.0
js0701/chromium-crosswalk
chrome/test/data/nacl/gdb_rsp.py
42
2542
# 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. # This file is based on gdb_rsp.py file from NaCl repository. import re import socket import time def RspChecksum(data): checksum = 0 for char in ...
bsd-3-clause
kaichogami/scikit-learn
examples/cluster/plot_adjusted_for_chance_measures.py
286
4353
""" ========================================================== Adjustment for chance in clustering performance evaluation ========================================================== The following plots demonstrate the impact of the number of clusters and number of samples on various clustering performance evaluation me...
bsd-3-clause
vybstat/scikit-learn
sklearn/preprocessing/tests/test_function_transformer.py
176
2169
from nose.tools import assert_equal import numpy as np from sklearn.preprocessing import FunctionTransformer def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X): def _func(X, *args, **kwargs): args_store.append(X) args_store.extend(args) kwargs_store.update(kwargs) ...
bsd-3-clause
walterreade/scikit-learn
examples/linear_model/plot_robust_fit.py
147
3050
""" Robust linear estimator fitting =============================== Here a sine function is fit with a polynomial of order 3, for values close to zero. Robust fitting is demoed in different situations: - No measurement errors, only modelling errors (fitting a sine with a polynomial) - Measurement errors in X - M...
bsd-3-clause
meduz/scikit-learn
doc/sphinxext/sphinx_gallery/gen_rst.py
14
23291
# -*- coding: utf-8 -*- # Author: Óscar Nájera # License: 3-clause BSD """ ================== RST file generator ================== Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ # Don't use unicode_literals here (be explici...
bsd-3-clause
arabenjamin/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
mikewolfli/IE_MBom
src/eds_pane.py
1
60893
# coding=utf-8 ''' Created on 2017年1月24日 @author: 10256603 ''' from global_list import * global login_info logger = logging.getLogger() mat_heads = ['位置号', '物料号', '中文名称', '英文名称', '图号', '数量', '单位', '材料', '重量', '备注'] mat_keys = ['st_no', 'mat_no', 'mat_name_cn', 'mat_name_en', 'drawing_no', ...
unlicense
lenovor/scikit-learn
sklearn/utils/fixes.py
133
12882
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # ...
bsd-3-clause
paulgradie/SeqPyPlot
main_app/seqpyplot/plot/de_tally_plotter.py
1
4840
import os import matplotlib.lines as mlines import matplotlib.pyplot as plt import numpy as np from matplotlib import rcParams import seaborn as sns from seqpyplot.plot.base.plot_base import PlotBase from tqdm import tqdm from ..analyzer.paired_sample_filter import PairedSampleFilter class TallyDe(PlotBase): ...
gpl-3.0
rvraghav93/scikit-learn
examples/applications/plot_species_distribution_modeling.py
35
7372
""" ============================= Species distribution modeling ============================= Modeling species' geographic distributions is an important problem in conservation biology. In this example we model the geographic distribution of two south american mammals given past observations and 14 environmental varia...
bsd-3-clause
jreback/pandas
pandas/tests/frame/methods/test_sort_index.py
1
29215
import numpy as np import pytest import pandas as pd from pandas import ( CategoricalDtype, CategoricalIndex, DataFrame, Index, IntervalIndex, MultiIndex, Series, Timestamp, ) import pandas._testing as tm class TestDataFrameSortIndex: def test_sort_index_and_reconstruction_doc_exa...
bsd-3-clause
YinongLong/scikit-learn
examples/linear_model/plot_omp.py
385
2263
""" =========================== Orthogonal Matching Pursuit =========================== Using orthogonal matching pursuit for recovering a sparse signal from a noisy measurement encoded with a dictionary """ print(__doc__) import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model import OrthogonalM...
bsd-3-clause
alekz112/statsmodels
statsmodels/stats/tests/test_weightstats.py
30
21864
'''tests for weightstats, compares with replication no failures but needs cleanup update 2012-09-09: added test after fixing bug in covariance TODOs: - I don't remember what all the commented out code is doing - should be refactored to use generator or inherited tests - still gaps in test coverage...
bsd-3-clause
pmav99/satellite-change-detect
tiledelta/scripts/cli.py
2
2678
#!/usr/bin/env python import rasterio as rio import numpy as np import click, json, os import tiledelta, mercantile @click.group() def cli(): pass @click.command(short_help="HELP") @click.argument('bounds', default='-', required=False) @click.option('--stride', default=1) def loaddata(bounds, stride): """Doe...
mit
jougs/nest-simulator
pynest/examples/sinusoidal_poisson_generator.py
7
5526
# -*- coding: utf-8 -*- # # sinusoidal_poisson_generator.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 o...
gpl-2.0
r-mart/scikit-learn
sklearn/decomposition/tests/test_nmf.py
130
6059
import numpy as np from scipy import linalg from sklearn.decomposition import nmf from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import raises from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_gr...
bsd-3-clause
omad/damootils
scripts/gqa_report.py
1
1420
import io import pandas as pd '''select name, dataset.metadata ? 'gqa' as has_gqa, count(dataset.id) from agdc.dataset left join agdc.dataset_type on dataset_type.id = dataset.dataset_type_ref where name like '%level1%' group by name, has_gqa order by name;''' csv = io.StringIO(''' name,has_gqa,count ls7_pq_scene,...
apache-2.0
horance-liu/tensorflow
tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py
24
40534
# Copyright 2017 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
arabenjamin/scikit-learn
examples/applications/plot_out_of_core_classification.py
255
13919
""" ====================================================== Out-of-core classification of text documents ====================================================== This is an example showing how scikit-learn can be used for classification using an out-of-core approach: learning from data that doesn't fit into main memory. ...
bsd-3-clause
AnasGhrab/scikit-learn
sklearn/manifold/tests/test_spectral_embedding.py
216
8091
from nose.tools import assert_true from nose.tools import assert_equal from scipy.sparse import csr_matrix from scipy.sparse import csc_matrix import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_raises from nose.plugins.skip import SkipTest from sk...
bsd-3-clause
xuyongzhi/scan_volume
src/rotate3D/scripts/rotate_to_3D.py
1
7338
#!/usr/bin/env python import rospy import rosbag from sensor_msgs.msg import LaserScan from sensor_msgs.msg import PointCloud2 import sensor_msgs.point_cloud2 as pc2 from sensor_msgs.msg import PointField from std_msgs.msg import Int64 from laser_geometry import LaserProjection import numpy as np import matplotlib.pyp...
mit
probml/pyprobml
scripts/Old/boss_motifs.py
1
1696
import numpy as np import matplotlib.pyplot as plt import pandas as pd import boss_utils import utils np.random.seed(0) def motif_distance(x, m): # hamming distance of x to motif # If m[i]=nan, it means locn i is a don't care mask = [not(np.isnan(v)) for v in m] #np.where(m>0) return np.sum(x[mask] != m[mas...
mit
hainm/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
tmerrick1/spack
var/spack/repos/builtin/packages/py-localcider/package.py
5
1786
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
spallavolu/scikit-learn
doc/conf.py
210
8446
# -*- coding: utf-8 -*- # # scikit-learn documentation build configuration file, created by # sphinx-quickstart on Fri Jan 8 09:13:42 2010. # # 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. ...
bsd-3-clause
RPGOne/Skynet
scikit-learn-0.18.1/examples/classification/plot_classification_probability.py
138
2871
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
whereaswhile/DLSR
convnet-folk_master/shownet_bbx.py
1
22862
# Copyright (c) 2011, Alex Krizhevsky (akrizhevsky@gmail.com) # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # - Redistributions of source code must retain the above copyright notice, # this ...
gpl-2.0
YihaoLu/statsmodels
statsmodels/examples/l1_demo/sklearn_compare.py
33
3710
""" For comparison with sklearn.linear_model.LogisticRegression Computes a regularzation path with both packages. The coefficient values in either path are related by a "constant" in the sense that for any fixed value of the constraint C and log likelihood, there exists an l1 regularization constant alpha...
bsd-3-clause
lucidfrontier45/scikit-learn
sklearn/utils/setup.py
1
2475
import os from os.path import join from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('utils', parent_package, top_path) config.add_subpackage('sparsetools') ...
bsd-3-clause
3324fr/spinalcordtoolbox
dev/old/sct_straighten_spinalcord__testing.py
1
144941
#!/usr/bin/env python ## @package sct_straighten_spinalcord # # - run a gaussian weighted slice by slice registration over a machine to straighten the spinal cord. # - use the centerline previously calculated during the registration but fitted with spline interpolation to improve the spinal cord straightening # - find...
mit
JasonKessler/scattertext
scattertext/termscoring/MannWhitneyU.py
1
3706
import pandas as pd import numpy as np from scipy.stats import norm, mannwhitneyu, ranksums from scattertext.termscoring.CorpusBasedTermScorer import CorpusBasedTermScorer class MannWhitneyU(CorpusBasedTermScorer): ''' term_scorer = (MannWhitneyU(corpus).set_categories('Positive', ['Negative'], ['Plot'])) ...
apache-2.0
mikkokemppainen/complex-networks
ERgraphs.py
1
6428
"""Random graph tools This module contains tools for numerical demonstrations of basic properties of Erdos-Renyi random graphs. We use NetworkX to generate Erdos-Renyi random graphs of n nodes with fixed expected average degree K. We generate a graph G using nx.gnp_random_graph(n,p) with wiring probabili...
mit
abhisg/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
yonglehou/scikit-learn
sklearn/feature_selection/tests/test_chi2.py
221
2398
""" Tests for chi2, currently the only feature selection function designed specifically to work with sparse matrices. """ import numpy as np from scipy.sparse import coo_matrix, csr_matrix import scipy.stats from sklearn.feature_selection import SelectKBest, chi2 from sklearn.feature_selection.univariate_selection im...
bsd-3-clause
sly-ninja/python_for_ml
Module5/assignment7.py
1
5807
import pandas as pd import numpy as np # If you'd like to try this lab with PCA instead of Isomap, # as the dimensionality reduction technique: Test_PCA = True def plotDecisionBoundary(model, X, y): print("Plotting...") import matplotlib.pyplot as plt import matplotlib matplotlib.style.use('ggplot') # Look P...
mit
johnmgregoire/NanoCalorimetry
maxcovariancecompositiondirection.py
1
5675
import time, copy import os import sys import numpy import h5py #from PnSC_ui import * #from PnSC_dataimport import * from PnSC_SCui import * #from PnSC_math import * from PnSC_h5io import * from PnSC_main import * from matplotlib.ticker import FuncFormatter import scipy.integrate p='C:/Users/JohnnyG/Documents/Python...
bsd-3-clause
xubenben/scikit-learn
benchmarks/bench_sgd_regression.py
283
5569
""" Benchmark for SGD regression Compares SGD regression against coordinate descent and Ridge on synthetic data. """ print(__doc__) # Author: Peter Prettenhofer <peter.prettenhofer@gmail.com> # License: BSD 3 clause import numpy as np import pylab as pl import gc from time import time from sklearn.linear_model i...
bsd-3-clause
ankurankan/pgmpy
pgmpy/tests/test_models/test_BayesianNetwork.py
2
45449
import unittest import networkx as nx import pandas as pd import numpy as np import numpy.testing as np_test from pgmpy.models import BayesianNetwork, MarkovNetwork from pgmpy.base import DAG import pgmpy.tests.help_functions as hf from pgmpy.factors.discrete import ( TabularCPD, JointProbabilityDistribution,...
mit
camallen/aggregation
experimental/penguins/clusterAnalysis/penguins_at_5.py
2
5268
#!/usr/bin/env python __author__ = 'greghines' import numpy as np import os import pymongo import sys import urllib import matplotlib.cbook as cbook from PIL import Image import matplotlib.pyplot as plt import warnings if os.path.exists("/home/ggdhines"): sys.path.append("/home/ggdhines/PycharmProjects/reduction/e...
apache-2.0
cqychen/quants
quants/loaddata/skyeye_ods_classified_zz500s.py
1
1324
#coding=utf8 import tushare as ts; import pymysql; import time as dt from datashape.coretypes import string from pandas.io.sql import SQLDatabase import sqlalchemy import datetime from sqlalchemy import create_engine from pandas.io import sql import threading import pandas as pd; import sys sys.path.append('../') #添加配...
epl-1.0
madjelan/scikit-learn
sklearn/__init__.py
154
3014
""" Machine learning module for Python ================================== sklearn is a Python module integrating classical machine learning algorithms in the tightly-knit world of scientific Python packages (numpy, scipy, matplotlib). It aims to provide simple and efficient solutions to learning problems that are acc...
bsd-3-clause
xubenben/scikit-learn
sklearn/mixture/gmm.py
128
31069
""" Gaussian Mixture Models. This implementation corresponds to frequentist (non-Bayesian) formulation of Gaussian Mixture Models. """ # Author: Ron Weiss <ronweiss@gmail.com> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Bertrand Thirion <bertrand.thirion@inria.fr> import warnings import numpy as...
bsd-3-clause
hirofumi0810/tensorflow_end2end_speech_recognition
utils/training/plot.py
1
2592
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt plt.style.use('ggplot') import seaborn as sns blue = '#...
mit
allrod5/extra-trees
benchmarks/regression/regression.py
1
2437
from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import explained_variance_score from sklearn.metrics import mean_absolute_error from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_squared_log_error from sklearn.metrics import median_absolute_error from sklearn.metric...
mit
vitale232/ves
ves/ves_inverse.py
1
8387
import os import sys import random # not for prod import numpy as np import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt os.chdir('./templates') # not for prod print(os.getcwd()) print(os.listdir()) from templates.tempData import coefficients schlumbergerFilterCoefficients, wennerFilterCoeffic...
lgpl-3.0
jorgemauricio/INIFAP_Course
algoritmos/algoritmo_ith.py
1
1932
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 17 16:17:25 2017 @author: jorgemauricio """ #%% import libraries import pandas as pd import os #%% Clear terminal os.system('clear') #%% load data from csv file print('***** leer archivo csv') data = pd.read_csv('../data/data_course_aguascaliente...
mit
bavardage/statsmodels
statsmodels/tsa/base/tsa_model.py
3
10216
import statsmodels.base.model as base from statsmodels.base import data import statsmodels.base.wrapper as wrap from statsmodels.tsa.base import datetools from numpy import arange, asarray from pandas import Index from pandas import datetools as pandas_datetools import datetime _freq_to_pandas = datetools._freq_to_pan...
bsd-3-clause