repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
Adai0808/scikit-learn
sklearn/grid_search.py
32
36586
""" The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # ...
bsd-3-clause
DistrictDataLabs/machine-learning
code/utils.py
1
4163
# utils # Utility functions for handling data # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Thu Feb 26 17:47:35 2015 -0500 # # Copyright (C) 2015 District Data Labs # For license information, see LICENSE.txt # # ID: utils.py [] benjamin@bengfort.com $ """ Utility functions for handling d...
mit
mugizico/scikit-learn
examples/neighbors/plot_species_kde.py
282
4059
""" ================================================ Kernel Density Estimate of Species Distributions ================================================ This shows an example of a neighbors-based query (in particular a kernel density estimate) on geospatial data, using a Ball Tree built upon the Haversine distance metric...
bsd-3-clause
JiaMingLin/de-identification
test/test_common.py
1
3809
import common.constant as c from common.data_utilities import DataUtils from common.base import Base from django.test import TestCase TESTING_FILE = c.TEST_ORIGIN_DATA_PATH class DataUtilitiesTests(TestCase): # TODO: The Data Coarse and Generalize step should seperate, to simulate a more real case. def setUp(self)...
apache-2.0
fredhusser/scikit-learn
sklearn/covariance/__init__.py
389
1157
""" The :mod:`sklearn.covariance` module includes methods and algorithms to robustly estimate the covariance of features given a set of points. The precision matrix defined as the inverse of the covariance is also estimated. Covariance estimation is closely related to the theory of Gaussian Graphical Models. """ from ...
bsd-3-clause
brentjm/Impurity-Predictions
server/package/desiccant.py
1
4140
""" Desiccant class Brent Maranzano 2016-04-16 """ import pandas as pd class Desiccant(object): """ Define the desiccant inside the container (e.g. type, amount, water...etc). Class Attributes ID : string - unique identification number to lookup parameters name : string - Desiccant material. ...
bsd-2-clause
ryanpdwyer/myscipkg2
setup.py
1
1557
# -*- coding: utf-8 -*- import sys import io try: from setuptools import setup, find_packages except ImportError: print("Please install or upgrade setuptools or pip") sys.exit(1) readme = io.open('README.rst', mode='r', encoding='utf-8').read() doclink = """ Documentation ------------- The full documenta...
mit
bgris/ODL_bgris
lib/python3.5/site-packages/ipykernel/pylab/config.py
10
4485
"""Configurable for configuring the IPython inline backend This module does not import anything from matplotlib. """ #----------------------------------------------------------------------------- # Copyright (C) 2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full lice...
gpl-3.0
karoraw1/GLM_Wrapper
bin/CleanUpMetaboliteData.py
1
1977
# -*- coding: utf-8 -*- """ Created on Mon May 16 15:47:12 2016 @author: login """ import pandas as pd import numpy as np import os, sys def strip(text): try: return text.strip() except AttributeError: return text data_fn = "MysticLakeIons_Clean.csv" data2_fn = "MysticLakeIons_Part2_Clean...
mit
StratsOn/zipline
tests/test_rolling_panel.py
20
7005
# # Copyright 2014 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
madjelan/scikit-learn
sklearn/ensemble/tests/test_gradient_boosting.py
127
37672
""" Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting). """ import warnings import numpy as np from sklearn import datasets from sklearn.base import clone from sklearn.ensemble import GradientBoostingClassifier from sklearn.ensemble import GradientBoostingRegressor from sklearn.ensemble.grad...
bsd-3-clause
cython-testbed/pandas
pandas/core/indexes/timedeltas.py
1
26186
""" implement the TimedeltaIndex """ from datetime import datetime import numpy as np from pandas.core.dtypes.common import ( _TD_DTYPE, is_integer, is_float, is_list_like, is_scalar, is_timedelta64_dtype, is_timedelta64_ns_dtype, pandas_dtype, ensure_int64) from pandas.core.dtypes....
bsd-3-clause
mifads/pyscripts
emxgeo/readKoeppenGeiger.py
1
3213
#!/usr/bin/env python3 from collections import OrderedDict as odict import matplotlib.pyplot as plt import numpy as np import os import sys home=os.environ['HOME'] ifile= home + '/Work/LANDUSE/KoeppenGeiger/Koeppen-Geiger-ASCII.txt' # Mar 2019, not used (yet) #KG_boreal = 1 #KG_temperate = 2 #KG_medit = 3 #KG_tropical...
gpl-3.0
hyperspy/hyperspy
hyperspy/tests/signals/test_2D_tools.py
2
6999
# Copyright 2007-2021 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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 ve...
gpl-3.0
miloharper/neural-network-animation
matplotlib/tests/test_text.py
9
12004
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import warnings import numpy as np from numpy.testing import assert_almost_equal from nose.tools import eq_ from matplotlib.transforms import Bbox import matplotlib import matplotlib.pyplot as plt ...
mit
Scapogo/zipline
tests/finance/test_transaction.py
5
1137
# # Copyright 2017 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
untom/scikit-learn
examples/cluster/plot_cluster_comparison.py
246
4684
""" ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example aims at showing characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. The last ...
bsd-3-clause
gustable/Img-Recog
nl_dbn.py
1
1729
import cPickle import numpy as np from sklearn.externals import joblib from nolearn.dbn import DBN def load(name): with open(name, 'rb') as f: return cPickle.load(f) dataset1 = load('/home/gp/data/cifar-10-batches-py/data_batch_1') dataset2 = load('/home/gp/data/cifar-10-batches-py/data_batch_2') dataset...
mit
YubinXie/Computational-Pathology
Sample_Preprocess.py
1
5387
import cv2 import numpy as np from matplotlib import pyplot as plt import matplotlib.patches as mpatches from skimage.morphology import thin, closing, square from skimage.util import invert from skimage.color import rgb2gray, label2rgb from skimage import data,img_as_ubyte from skimage.filters import threshold_otsu fro...
gpl-2.0
JPFrancoia/scikit-learn
sklearn/utils/tests/test_metaestimators.py
86
2304
from sklearn.utils.testing import assert_true, assert_false from sklearn.utils.metaestimators import if_delegate_has_method class Prefix(object): def func(self): pass class MockMetaEstimator(object): """This is a mock meta estimator""" a_prefix = Prefix() @if_delegate_has_method(delegate="a...
bsd-3-clause
Insight-book/data-science-from-scratch
first-edition-ko/code-python3/gradient_descent.py
12
5816
from collections import Counter from linear_algebra import distance, vector_subtract, scalar_multiply from functools import reduce import math, random def sum_of_squares(v): """computes the sum of squared elements in v""" return sum(v_i ** 2 for v_i in v) def difference_quotient(f, x, h): return (f(x + h)...
unlicense
antoinecarme/sklearn2sql_heroku
tests/databases/test_client_bad_model.py
1
1084
import pickle, json, requests, base64 from sklearn import datasets iris = datasets.load_iris() X = iris.data Y = iris.target # print(iris.DESCR) from sklearn.neural_network import MLPClassifier clf = MLPClassifier() clf.fit(X, Y) def test_ws_sql_gen(pickle_data): WS_URL="https://sklearn2sql.herokuapp.com/mo...
bsd-3-clause
CVML/scikit-learn
examples/cluster/plot_segmentation_toy.py
258
3336
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
djgagne/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
waterponey/scikit-learn
sklearn/manifold/setup.py
43
1283
import os from os.path import join import numpy from numpy.distutils.misc_util import Configuration from sklearn._build_utils import get_blas_info def configuration(parent_package="", top_path=None): config = Configuration("manifold", parent_package, top_path) libraries = [] if os.name == 'posix': ...
bsd-3-clause
carpyncho/feets
res/paper/reports/features_montecarlo.py
1
1591
import sys import time as tmod import warnings import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set() import pandas as pd warnings.simplefilter("ignore") sys.path.insert(0, "../FATS/") import FATS iterations = 100000 lc_size = 1000 random = np.random.RandomState(42) results = { ...
mit
KshitijT/fundamentals_of_interferometry
data/scripts/plotUVcoverage.py
4
3438
#!/usr/bin/python """Plot UVW positions from an MS""" import matplotlib matplotlib.rc('xtick', labelsize=15) matplotlib.rc('ytick', labelsize=15) import numpy as np import matplotlib.pyplot as plt import sys import pyrap.tables as tbls cc = 299792458. if __name__ == '__main__': ...
gpl-2.0
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/pandas/errors/__init__.py
6
1478
# flake8: noqa """ expose public exceptions & warnings """ from pandas._libs.tslib import OutOfBoundsDatetime class PerformanceWarning(Warning): """ Warnings shown when there is a possible performance impact. """ class UnsupportedFunctionCall(ValueError): """ If attempting to call a numpy f...
mit
Djabbz/scikit-learn
doc/sphinxext/gen_rst.py
106
40198
""" 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
ishanic/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
hyperspy/hyperspy
hyperspy/tests/learn/test_cluster.py
2
16658
# -*- coding: utf-8 -*- # Copyright 2007-2021 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
gpl-3.0
FluVigilanciaBR/seasonality
methods/data_filter/contingency_level.py
1
8367
# coding:utf8 __author__ = 'Marcelo Ferreira da Costa Gomes' import pandas as pd import numpy as np from fludashboard.libs.flu_data import FluDB db = FluDB() def get_all_territories_and_years(filtertype: str='srag'): table_suffix = { 'srag': '', 'sragnofever': '_sragnofever', 'hospdeath...
gpl-3.0
chrisdembia/agent-bicycle
randlov1998/analysis.py
1
2255
"""Functions for plotting results, etc. """ import numpy as np from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt import pylab as pl from scipy import r_ from pybrain.tools.customxml.networkreader import NetworkReader from pybrain.utilities import one_to_n def plot_nfq_action_value_history(netw...
mit
Evfro/polara
polara/datasets/yahoo.py
1
1594
import tarfile import pandas as pd def get_yahoo_music_data(path=None, fileid=0, include_test=True, read_attributes=False, read_genres=False): res = [] if path: data_folder = 'ydata-ymusic-user-song-ratings-meta-v1_0' col_names = ['userid', 'songid', 'rating'] with tarfile.open(path, 'r...
mit
xiaoxiamii/scikit-learn
examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py
218
3893
""" ============================================== Feature agglomeration vs. univariate selection ============================================== This example compares 2 dimensionality reduction strategies: - univariate feature selection with Anova - feature agglomeration with Ward hierarchical clustering Both metho...
bsd-3-clause
MiguelAguilera/critical-learning
Mountain-Car/train.py
1
7919
#!/usr/bin/env python from embodied_ising import ising import numpy as np import matplotlib import matplotlib.pyplot as plt # plt.switch_backend('agg') import ising_correlations as ic from copy import copy import numpy.random as rnd plt.rc('text', usetex=True) font = {'family': 'serif', 'size': 15, 'serif': ['comput...
gpl-3.0
neskk/PokemonGo-Map
pogom/geofence.py
14
5762
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import timeit import logging from .utils import get_args log = logging.getLogger(__name__) args = get_args() # Trying to import matplotlib, which is not compatible with all hardware. # Matlplotlib is faster for big calculations. try: from matplotlib.path imp...
agpl-3.0
vortex-ape/scikit-learn
sklearn/tests/test_init.py
4
2258
# Basic unittests to test functioning of module's top-level import subprocess import pkgutil import pytest import sklearn from sklearn.utils.testing import assert_equal __author__ = 'Yaroslav Halchenko' __license__ = 'BSD' try: from sklearn import * # noqa _top_import_error = None except Exception as e:...
bsd-3-clause
Tomasuh/Tomasuh.github.io
files/cyclic/analyse.py
1
1922
import pandas import sqlite3 import dbcommands import numpy as np import time import matplotlib.pyplot as plt db_obj = dbcommands.the_db() posts = db_obj.fetch_posts() df = pandas.DataFrame(data=posts, columns = ["key",\ "title",\ "user",\ "date",\ "size",\ ...
mit
cwhanse/pvlib-python
pvlib/atmosphere.py
3
24256
""" The ``atmosphere`` module contains methods to calculate relative and absolute airmass and to determine pressure from altitude or vice versa. """ from warnings import warn import numpy as np import pandas as pd APPARENT_ZENITH_MODELS = ('simple', 'kasten1966', 'kastenyoung1989', 'gueyma...
bsd-3-clause
Ambuj-UF/ConCat-1.0
src/Utils/Bio/Phylo/_utils.py
1
20969
# Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com) # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. import sys # Add path to Bio sys.path.append('../..') """Utilities for handling, displa...
gpl-2.0
jpautom/scikit-learn
benchmarks/bench_plot_omp_lars.py
266
4447
"""Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle regression (:ref:`least_angle_regression`) The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function import gc import sys from time import time import numpy as np from sklearn.linear_model impo...
bsd-3-clause
FourthCohortAwesome/NightThree
exercise_gd.py
1
1821
import pandas as pd import csv def length_3(data): """ This function reads a .csv file and to determines corrections :param data: csv file :return: write a new file without missing values """ df = pd.read_csv(data) headings = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven'] row ...
mit
rochefort-lab/fissa
fissa/neuropil.py
1
9035
""" Functions for removal of neuropil from calcium signals. Authors: - Sander W Keemink <swkeemink@scimail.eu> - Scott C Lowe <scott.code.lowe@gmail.com> Created: 2015-05-15 """ import numpy as np import numpy.random as rand import sklearn.decomposition def separate( S, sep_method="nmf", n=N...
gpl-3.0
loli/sklearn-ensembletrees
benchmarks/bench_sgd_regression.py
14
4594
""" 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
jbogaardt/chainladder-python
chainladder/tails/bondy.py
1
5896
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. import numpy as np import pandas as pd from scipy.optimize import least_squares from chainladder.tails import TailBase f...
mit
meduz/scikit-learn
examples/model_selection/grid_search_text_feature_extraction.py
99
4163
""" ========================================================== Sample pipeline for text feature extraction and evaluation ========================================================== The dataset used in this example is the 20 newsgroups dataset which will be automatically downloaded and then cached and reused for the d...
bsd-3-clause
ElDeveloper/scikit-learn
examples/cluster/plot_agglomerative_clustering_metrics.py
402
4492
""" Agglomerative clustering with different metrics =============================================== Demonstrates the effect of different metrics on the hierarchical clustering. The example is engineered to show the effect of the choice of different metrics. It is applied to waveforms, which can be seen as high-dimens...
bsd-3-clause
GoogleCloudPlatform/professional-services
tools/ml-auto-eda/ml_eda/analysis/quantitative_analyzer.py
1
5502
# Copyright 2019 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
apache-2.0
gfyoung/pandas
pandas/tests/test_sorting.py
2
18315
from collections import defaultdict from datetime import datetime from itertools import product import numpy as np import pytest from pandas import DataFrame, MultiIndex, Series, array, concat, merge import pandas._testing as tm from pandas.core.algorithms import safe_sort import pandas.core.common as com from pandas...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/matplotlib/examples/misc/findobj_demo.py
1
1660
""" ============ Findobj Demo ============ Recursively find all objects that match some criteria """ import numpy as np import matplotlib.pyplot as plt import matplotlib.text as text # nodebox section if __name__ == '__builtin__': # were in nodebox import os import tempfile W = 800 inset = 20 ...
mit
dyermd/legos
marketing/temp.py
1
1914
#generate all the plots for the market project from optparse import OptionParser import matplotlib.pyplot as plt __author__ = 'mattdyer' # add labels to a plot # @param points The plot object # @param axis The axis object def autolabel(points, axis, data): # attach some text labels for i, point in enumerate...
gpl-2.0
itu-oss-project-team/oss-github-analysis-project
github_analysis_tool/analyzer/classification.py
1
6943
import collections import numpy as np import os.path from sklearn import neighbors from sklearn.metrics import confusion_matrix, accuracy_score from sklearn.model_selection import * import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) from github_analysis_tool.servic...
mit
zooniverse/aggregation
experimental/penguins/clusterAnalysis/distance_.py
2
3492
#!/usr/bin/env python __author__ = 'greghines' import numpy as np import os import sys import cPickle as pickle import math import matplotlib.pyplot as plt import pymongo import urllib import matplotlib.cbook as cbook if os.path.exists("/home/ggdhines"): sys.path.append("/home/ggdhines/PycharmProjects/reduction/ex...
apache-2.0
sstoma/CellProfiler
cellprofiler/modules/colortogray.py
2
21721
''' <b> Color to Gray</b> converts an image with three color channels to a set of individual grayscale images. <hr> This module converts RGB (Red, Green, Blue) color images to grayscale. All channels can be merged into one grayscale image (<i>Combine</i>), or each channel can be extracted into a separate grayscale im...
gpl-2.0
xavierfav/freesound-python
manager.py
1
75825
""" Upgrade of the python client for freesound Find the API documentation at http://www.freesound.org/docs/api/. This lib provides method for managing files and data with a local data storage """ import sys sys.path.append('/home/xavier/Documents/dev/freesound-python/') import copy import freesound import os import j...
mit
eramirem/astroML
book_figures/chapter9/fig_svm_diagram.py
3
2321
""" SVM Diagram ----------- Figure 9.9 Illustration of SVM. The region between the dashed lines is the margin, and the points which the dashed lines touch are called the support vectors. """ # Author: Jake VanderPlas # License: BSD # The figure produced by this code is published in the textbook # "Statistics, Data...
bsd-2-clause
zejin/water
visualizer.py
10
2005
#!/usr/bin/env python """ Visualize shallow water simulation results. NB: Requires a modern Matplotlib version; also needs either FFMPeg (for MP4) or ImageMagick (for GIF) """ import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import ma...
mit
YinongLong/scikit-learn
sklearn/mixture/dpgmm.py
5
35315
"""Bayesian Gaussian Mixture Models and Dirichlet Process Gaussian Mixture Models""" from __future__ import print_function # Author: Alexandre Passos (alexandre.tp@gmail.com) # Bertrand Thirion <bertrand.thirion@inria.fr> # # Based on mixture.py by: # Ron Weiss <ronweiss@gmail.com> # Fabian Ped...
bsd-3-clause
gengliangwang/spark
python/pyspark/pandas/tests/plot/test_frame_plot_plotly.py
1
10017
# # 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
fourpartswater/cuda-convnet2
shownet.py
180
18206
# Copyright 2014 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
apache-2.0
megahertz0/tusharedemo
kline_tushare.py
1
3639
# -*- coding: utf-8 -*- """ Created on Mon Aug 15 17:31:36 2016 @author: megahertz """ import matplotlib.pyplot as plt import matplotlib as mpl import tushare as ts import datetime import time from matplotlib.dates import DateFormatter, WeekdayLocator, DayLocator, MONDAY,YEARLY from matplotlib.finance import fetch_h...
lgpl-3.0
cmoutard/mne-python
examples/stats/plot_cluster_stats_evoked.py
18
2991
""" ======================================================= Permutation F-test on sensor data with 1D cluster level ======================================================= One tests if the evoked response is significantly different between conditions. Multiple comparison problem is addressed with cluster level permuta...
bsd-3-clause
nlhepler/idepi
idepi/feature_extraction/_pairwisesitevectorizer.py
1
3511
from numpy import zeros from sklearn.base import BaseEstimator, TransformerMixin from idepi.filters import null_filter from idepi.labeledmsa import LabeledMSA __all__ = ['PairwiseSiteVectorizer'] class PairwiseSiteVectorizer(BaseEstimator, TransformerMixin): def __init__(self, encoder, filter=null_filter, r...
gpl-3.0
mauzeh/formation-flight
validation/get_max_fuel_burn.py
1
2818
import math import lib.sim from lib.debug import print_dictionary from lib.geo.util import get_fuel_burned_during_cruise from lib.geo.util import formationburn from lib.geo.util import get_weight_ratio import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.rcParams['font.size'] = 15. matplotl...
mit
dhruv13J/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
kernc/scikit-learn
examples/covariance/plot_sparse_cov.py
300
5078
""" ====================================== Sparse inverse covariance estimation ====================================== Using the GraphLasso estimator to learn a covariance and sparse precision from a small number of samples. To estimate a probabilistic model (e.g. a Gaussian model), estimating the precision matrix, t...
bsd-3-clause
nikitasingh981/scikit-learn
doc/conf.py
22
9789
# -*- 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
alvason/probability-insighter
code/gaussian_random_distribution.py
1
10467
# coding: utf-8 # # Probability-insighter # https://github.com/alvason/probability-insighter # # Gaussian random distribution (standard normal distribution) # In[1]: ''' author: Alvason Zhenhua Li date: 03/19/2015 ''' get_ipython().magic('matplotlib inline') import numpy as np import matplotlib.pyplot as plt i...
gpl-2.0
jreback/pandas
pandas/tests/reshape/merge/test_merge_cross.py
2
2794
import pytest from pandas import DataFrame import pandas._testing as tm from pandas.core.reshape.merge import MergeError, merge @pytest.mark.parametrize( ("input_col", "output_cols"), [("b", ["a", "b"]), ("a", ["a_x", "a_y"])] ) def test_merge_cross(input_col, output_cols): # GH#5401 left = DataFrame({"a...
bsd-3-clause
hrjn/scikit-learn
examples/cluster/plot_cluster_iris.py
350
2593
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= K-means Clustering ========================================================= The plots display firstly what a K-means algorithm would yield using three clusters. It is then shown what the effect of a bad initializa...
bsd-3-clause
michigraber/scikit-learn
examples/neighbors/plot_kde_1d.py
347
5100
""" =================================== Simple 1D Kernel Density Estimation =================================== This example uses the :class:`sklearn.neighbors.KernelDensity` class to demonstrate the principles of Kernel Density Estimation in one dimension. The first plot shows one of the problems with using histogram...
bsd-3-clause
LIKAIMO/MissionPlanner
Lib/site-packages/scipy/signal/filter_design.py
53
63381
"""Filter design. """ import types import warnings import numpy from numpy import atleast_1d, poly, polyval, roots, real, asarray, allclose, \ resize, pi, absolute, logspace, r_, sqrt, tan, log10, arctan, arcsinh, \ cos, exp, cosh, arccosh, ceil, conjugate, zeros, sinh from numpy import mintypecode from scipy...
gpl-3.0
Eric89GXL/scikit-learn
examples/applications/plot_out_of_core_classification.py
3
12406
""" ====================================================== 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
JonnaStalring/AZOrange
ConfPred/conformal-master/cp/evaluation.py
1
14351
"""Evaluation module contains methods for evaluation of conformal predictors. Function :py:func:`run` produces Results of an appropriate type by using a Sampler on a given data set to split it into a training and testing set. Structure: - Sampler (sampling methods) - :py:class:`RandomSampler` - :py:...
lgpl-3.0
brain-research/mirage-rl-qprop
convert-stdout-to-csv.py
1
1440
""" Copyright 2018 Google LLC Use of this source code is governed by an MIT-style license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT. """ import os import sys import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib import colors as mcolors import a...
mit
davidgbe/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
lxybox1/MissionPlanner
Lib/site-packages/scipy/stats/distributions.py
53
207806
# Functions to implement several important functions for # various Continous and Discrete Probability Distributions # # Author: Travis Oliphant 2002-2011 with contributions from # SciPy Developers 2004-2011 # import math import warnings from copy import copy from scipy.misc import comb, derivative from s...
gpl-3.0
IndraVikas/scikit-learn
examples/linear_model/plot_sgd_comparison.py
167
1659
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
Fireblend/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
249
2211
#!/usr/bin/env python """ ============================================= Joint feature selection with multi-task Lasso ============================================= The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected features to be the same across tasks. This example simulates...
bsd-3-clause
eladnoor/equilibrator-api
pathways_cmd.py
1
1031
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 1 13:24:15 2017 @author: noore """ import argparse import logging from equilibrator_api import Pathway from matplotlib.backends.backend_pdf import PdfPages import pandas as pd if __name__ == '__main__': parser = argparse.ArgumentParser( ...
mit
costypetrisor/scikit-learn
examples/applications/plot_species_distribution_modeling.py
254
7434
""" ============================= 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
yavalvas/yav_com
build/matplotlib/lib/mpl_examples/user_interfaces/embedding_in_wx5.py
12
1586
# Used to guarantee to use at least Wx2.8 import wxversion wxversion.ensureMinimal('2.8') import wx import wx.aui import matplotlib as mpl from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar class Plot(wx.Panel): d...
mit
mikebenfield/scikit-learn
sklearn/linear_model/tests/test_huber.py
54
7619
# Authors: Manoj Kumar mks542@nyu.edu # License: BSD 3 clause import numpy as np from scipy import optimize, sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_a...
bsd-3-clause
anntzer/scikit-learn
examples/calibration/plot_calibration_curve.py
24
5902
""" ============================== Probability Calibration curves ============================== When performing classification one often wants to predict not only the class label, but also the associated probability. This probability gives some kind of confidence on the prediction. This example demonstrates how to di...
bsd-3-clause
Winand/pandas
pandas/core/dtypes/api.py
16
2399
# flake8: noqa import sys from .common import (pandas_dtype, is_dtype_equal, is_extension_type, # categorical is_categorical, is_categorical_dtype, # interval is_interva...
bsd-3-clause
wangyum/mxnet
example/kaggle-ndsb1/submission_dsb.py
52
5048
# 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 u...
apache-2.0
markovg/nest-simulator
pynest/examples/intrinsic_currents_spiking.py
13
5954
# -*- coding: utf-8 -*- # # intrinsic_currents_spiking.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 ...
gpl-2.0
gomezstevena/x-wind
src/trajectory.py
1
1976
# import matplotlib # matplotlib.use('Agg') from numpy import * from scipy.interpolate import PiecewisePolynomial class Trajectory: def __init__(self, t, u, ddt=None): assert t.ndim == 1 and t.size == u.shape[0] self.shape = u.shape[1:] data = u.reshape([t.size, 1, -1]) if ddt is no...
gpl-3.0
louispotok/pandas
pandas/core/indexes/numeric.py
4
14410
import numpy as np from pandas._libs import (index as libindex, join as libjoin) from pandas.core.dtypes.common import ( is_dtype_equal, pandas_dtype, needs_i8_conversion, is_integer_dtype, is_bool, is_bool_dtype, is_scalar) from pandas import compat from pandas.co...
bsd-3-clause
mdhaber/scipy
scipy/signal/ltisys.py
12
128865
""" ltisys -- a collection of classes and functions for modeling linear time invariant systems. """ # # Author: Travis Oliphant 2001 # # Feb 2010: Warren Weckesser # Rewrote lsim2 and added impulse2. # Apr 2011: Jeffrey Armstrong <jeff@approximatrix.com> # Added dlsim, dstep, dimpulse, cont2discrete # Aug 2013: Jua...
bsd-3-clause
Cadair/ginga
ginga/web/pgw/Plot.py
3
4306
# # Plot.py -- Plotting widget canvas wrapper. # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # from io import BytesIO from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from ...
bsd-3-clause
bharatsingh430/py-R-FCN-multiGPU
caffe/examples/web_demo/app.py
41
7793
import os import time import cPickle import datetime import logging import flask import werkzeug import optparse import tornado.wsgi import tornado.httpserver import numpy as np import pandas as pd from PIL import Image import cStringIO as StringIO import urllib import exifutil import caffe REPO_DIRNAME = os.path.abs...
mit
amolkahat/pandas
pandas/tests/indexes/datetimes/test_formats.py
5
8703
from datetime import datetime from pandas import DatetimeIndex, Series import numpy as np import dateutil.tz import pytz import pytest import pandas.util.testing as tm import pandas as pd def test_to_native_types(): index = DatetimeIndex(freq='1D', periods=3, start='2017-01-01') # First, with no arguments....
bsd-3-clause
lenovor/scikit-learn
sklearn/tests/test_metaestimators.py
226
4954
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.pipeline import Pipeline...
bsd-3-clause
draekko/androguard
elsim/elsim/elsim.py
37
16175
# This file is part of Elsim # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Elsim is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, ...
apache-2.0
iismd17/scikit-learn
examples/semi_supervised/plot_label_propagation_versus_svm_iris.py
286
2378
""" ===================================================================== Decision boundary of label propagation versus SVM on the Iris dataset ===================================================================== Comparison for decision boundary generated on iris dataset between Label Propagation and SVM. This demon...
bsd-3-clause
krez13/scikit-learn
sklearn/neighbors/regression.py
32
11019
"""Nearest Neighbor Regression""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output support by Arna...
bsd-3-clause
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/pandas/tests/tseries/test_offsets.py
6
216497
import os from distutils.version import LooseVersion from datetime import date, datetime, timedelta from dateutil.relativedelta import relativedelta import pytest from pandas.compat import range, iteritems from pandas import compat import numpy as np from pandas.compat.numpy import np_datetime64_compat from pandas....
mit
eggplantbren/ExperimentalNS
TwoScalars/DNest/postprocess.py
1
7100
# Copyright (c) 2009, 2010, 2011, 2012 Brendon J. Brewer. # # This file is part of DNest3. # # DNest3 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 ...
gpl-3.0