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 |
|---|---|---|---|---|---|
fyffyt/scikit-learn | examples/cluster/plot_kmeans_stability_low_dim_dense.py | 338 | 4324 | """
============================================================
Empirical evaluation of the impact of k-means initialization
============================================================
Evaluate the ability of k-means initializations strategies to make
the algorithm convergence robust as measured by the relative stan... | bsd-3-clause |
tomevans/gps | gps/example.py | 1 | 4325 | import gp_class, gp_routines, kernels
import time
import numpy as np
import matplotlib.pyplot as plt
# A simple script to illustrate the basic
# features of the gps package.
# Toy dataset:
n = 25
x = np.r_[ -5:5:1j*n ]
y = np.sin( x ) + 0.2*x
whitenoise = 0.2
e = whitenoise*np.random.randn( n )
data = y + e
# Creat... | gpl-2.0 |
selective-inference/selective-inference | doc/learning_examples/BH/logit_targets_BH_single.py | 3 | 5676 | import functools
import numpy as np
from scipy.stats import norm as ndist
import regreg.api as rr
from selection.tests.instance import gaussian_instance
from selection.learning.core import (infer_full_target,
split_sampler,
normal_sampler,
... | bsd-3-clause |
imito/odin | examples/cifar10_ivec.py | 1 | 1669 | from __future__ import print_function, division, absolute_import
import os
os.environ['ODIN'] = 'gpu,float32'
import shutil
import numpy as np
import tensorflow as tf
from odin import backend as K, nnet as N, visual as V, fuel as F
from odin.utils import batching, Progbar, get_exppath, crypto
from odin import ml
fro... | mit |
ZENGXH/scikit-learn | examples/linear_model/plot_logistic_l1_l2_sparsity.py | 384 | 2601 | """
==============================================
L1 Penalty and Sparsity in Logistic Regression
==============================================
Comparison of the sparsity (percentage of zero coefficients) of solutions when
L1 and L2 penalty are used for different values of C. We can see that large
values of C give mo... | bsd-3-clause |
vshtanko/scikit-learn | benchmarks/bench_plot_svd.py | 325 | 2899 | """Benchmarks of Singular Value Decomposition (Exact and Approximate)
The data is mostly low rank but is a fat infinite tail.
"""
import gc
from time import time
import numpy as np
from collections import defaultdict
from scipy.linalg import svd
from sklearn.utils.extmath import randomized_svd
from sklearn.datasets.s... | bsd-3-clause |
rkeisler/sehgal | sehgal.py | 1 | 3371 | import numpy as np
import ipdb
import pickle
import matplotlib.pylab as pl
pl.ion()
datadir = 'data/'
nside = 8192
def make_ksz_cutouts_for_sptsz_like_catalog():
d = load_sptsz_like_catalog()
ksz = load_ksz_uk_cmb()
cutouts = make_cutouts_from_catalog(d, ksz)
# write to fits
from astropy.io import ... | bsd-3-clause |
NewKnowledge/punk | punk/aggregator/aggregateByDateTime.py | 1 | 2577 | import pandas as pd
import numpy as np
from typing import List, NamedTuple
from .timeseries import agg_by_date
from primitive_interfaces.base import PrimitiveBase
Inputs = pd.DataFrame
Outputs = np.ndarray
Params = dict
CallMetadata = dict
class AggregateByDateTime(PrimitiveBase[Inputs, Outputs, Params]):
__auth... | mit |
Myasuka/scikit-learn | sklearn/preprocessing/tests/test_imputation.py | 213 | 11911 | import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.preprocessing.imputa... | bsd-3-clause |
kernc/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 |
simon-pepin/scikit-learn | examples/bicluster/plot_spectral_coclustering.py | 276 | 1736 | """
==============================================
A demo of the Spectral Co-Clustering algorithm
==============================================
This example demonstrates how to generate a dataset and bicluster it
using the the Spectral Co-Clustering algorithm.
The dataset is generated using the ``make_biclusters`` f... | bsd-3-clause |
tedlaz/pyted | elee/elee/parsers.py | 1 | 6604 | """
Παρσάρισμα ημερολογίου singular
"""
from . import utils as ul
from . import arthro
def check_line(line, stxt):
"""
Ελέγχει μια γραμμή κειμένου για συγκεκριμένους χαρακτήρες σε επιλεγμένα
σημεία. Άν δεν υπάρχουν οι αναμενόμενοι χαρακτήρες στις θέσεις τους
επιστρέφει False, διαφορετικά επιστρέφει Tr... | gpl-3.0 |
andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/pandas/tests/series/test_internals.py | 7 | 12848 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
from datetime import datetime
from numpy import nan
import numpy as np
from pandas import Series
from pandas.tseries.index import Timestamp
import pandas.lib as lib
from pandas.util.testing import assert_series_equal
import pandas.util.testing as tm
class TestSerie... | apache-2.0 |
trachelr/mne-python | examples/visualization/plot_clickable_image.py | 7 | 2317 | """
================================================================
Demonstration of how to use ClickableImage / generate_2d_layout.
================================================================
In this example, we open an image file, then use ClickableImage to
return 2D locations of mouse clicks (or load a file a... | bsd-3-clause |
MJuddBooth/pandas | pandas/io/excel/_xlwt.py | 1 | 4557 | import pandas._libs.json as json
from pandas.io.excel._base import ExcelWriter
from pandas.io.excel._util import _validate_freeze_panes
class _XlwtWriter(ExcelWriter):
engine = 'xlwt'
supported_extensions = ('.xls',)
def __init__(self, path, engine=None, encoding=None, mode='w',
**engin... | bsd-3-clause |
ProjectsUCSC/NLP | User Modelling/stance.py | 1 | 27172 | from lib_stance import *
#from keras.layers.merge import Concatenate
from keras.layers import Merge
import copy
from collections import Counter
from sklearn.metrics import confusion_matrix
from sklearn.metrics import f1_score
import math
word2topic = pickle.load(open("word2topic", "r"))
embedding = pickle.load(open("w... | mit |
zaxtax/scikit-learn | sklearn/datasets/tests/test_lfw.py | 55 | 7877 | """This test for the LFW require medium-size data downloading and processing
If the data has not been already downloaded by running the examples,
the tests won't run (skipped).
If the test are run, the first execution will be long (typically a bit
more than a couple of minutes) but as the dataset loader is leveraging... | bsd-3-clause |
davidgbe/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 128 | 4761 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
Cophy08/ggplot | ggplot/tests/__init__.py | 8 | 10135 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import matplotlib as mpl
import matplotlib.pyplot as plt
from nose.tools import with_setup, make_decorator, assert_true
import warnings
figsize_orig = mpl.rcParams["figure.figsize"]
def setup_package():
m... | bsd-2-clause |
andaag/scikit-learn | examples/decomposition/plot_ica_blind_source_separation.py | 349 | 2228 | """
=====================================
Blind source separation using FastICA
=====================================
An example of estimating sources from noisy data.
:ref:`ICA` is used to estimate sources given noisy measurements.
Imagine 3 instruments playing simultaneously and 3 microphones
recording the mixed si... | bsd-3-clause |
raghavrv/scikit-learn | examples/cluster/plot_agglomerative_clustering.py | 343 | 2931 | """
Agglomerative clustering with and without structure
===================================================
This example shows the effect of imposing a connectivity graph to capture
local structure in the data. The graph is simply the graph of 20 nearest
neighbors.
Two consequences of imposing a connectivity can be s... | bsd-3-clause |
pyk/rojak | rojak-analyzer/rojak_ovr.py | 4 | 16244 | # Rojak OVR
# This is enhanced version of Rojak SVM
# Rojak SVM only work for pair of candidates
# in Rojak OvR, we embrace all 13 labels
import csv
import sys
import re
import pickle
import itertools
from bs4 import BeautifulSoup
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.multiclass impo... | bsd-3-clause |
massmutual/scikit-learn | examples/mixture/plot_gmm_classifier.py | 250 | 3918 | """
==================
GMM classification
==================
Demonstration of Gaussian mixture models for classification.
See :ref:`gmm` for more information on the estimator.
Plots predicted labels on both training and held out test data using a
variety of GMM classifiers on the iris dataset.
Compares GMMs with sp... | bsd-3-clause |
rahuldhote/scikit-learn | sklearn/linear_model/tests/test_perceptron.py | 378 | 1815 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_raises
from sklearn.utils import check_random_state
from sklearn.datasets import load_iris
from sklearn.linear_model import Pe... | bsd-3-clause |
ssaeger/scikit-learn | examples/neural_networks/plot_mlp_training_curves.py | 56 | 3596 | """
========================================================
Compare Stochastic learning strategies for MLPClassifier
========================================================
This example visualizes some training loss curves for different stochastic
learning strategies, including SGD and Adam. Because of time-constrai... | bsd-3-clause |
ahnitz/mpld3 | visualize_tests.py | 15 | 8001 | """
Visualize Test Plots
This script will go through all the plots in the ``mpld3/test_plots``
directory, and save them as D3js to a single HTML file for inspection.
"""
import os
import glob
import sys
import gc
import traceback
import itertools
import json
import contextlib
import matplotlib
matplotlib.use('Agg') ... | bsd-3-clause |
mikelane/FaceRecognition | Sklearn_Face_Recognition/GradientBoosting.py | 1 | 4048 |
# coding: utf-8
# In[2]:
from datetime import datetime
import logging
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.datasets import fetch_lfw_people
from sklearn.metrics import classification_report
from sklearn.met... | mit |
OpringaoDoTurno/airflow | airflow/contrib/hooks/bigquery_hook.py | 3 | 47635 | # -*- coding: utf-8 -*-
#
# 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
... | apache-2.0 |
frank-tancf/scikit-learn | sklearn/tests/test_isotonic.py | 13 | 13122 | import warnings
import numpy as np
import pickle
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert_equal,
... | bsd-3-clause |
kprestel/PyInvestment | pytech/decorators/decorators.py | 2 | 4087 | from functools import wraps
import pandas as pd
from arctic.chunkstore.chunkstore import ChunkStore
import pytech.utils as utils
from pytech.mongo import ARCTIC_STORE, BarStore
from pytech.utils.exceptions import InvalidStoreError, PyInvestmentKeyError
from pandas.tseries.offsets import BDay
from pytech.data._holders... | mit |
vortex-ape/scikit-learn | sklearn/discriminant_analysis.py | 4 | 27767 | """
Linear Discriminant Analysis and Quadratic Discriminant Analysis
"""
# Authors: Clemens Brunner
# Martin Billinger
# Matthieu Perrot
# Mathieu Blondel
# License: BSD 3-Clause
from __future__ import print_function
import warnings
import numpy as np
from .utils import deprecated
from sci... | bsd-3-clause |
fire-rs-laas/fire-rs-saop | python/fire_rs/geodata/display.py | 1 | 19756 | # Copyright (c) 2017, CNRS-LAAS
# 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
# list of conditions and the f... | bsd-2-clause |
PTDreamer/dRonin | python/ins/compare.py | 11 | 5497 | from cins import CINS
from pyins import PyINS
import unittest
from sympy import symbols, lambdify, sqrt
from sympy import MatrixSymbol, Matrix
from numpy import cos, sin, power
from sympy.matrices import *
from quaternions import *
import numpy
import math
import ins
VISUALIZE = False
class CompareFunctions(unittest... | gpl-3.0 |
samzhang111/scikit-learn | examples/manifold/plot_manifold_sphere.py | 258 | 5101 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=============================================
Manifold Learning methods on a severed sphere
=============================================
An application of the different :ref:`manifold` techniques
on a spherical data-set. Here one can see the use of
dimensionality reducti... | bsd-3-clause |
Erotemic/hotspotter | hstpl/mask_creator.py | 1 | 9263 | """
Interactive tool to draw mask on an image or image-like array.
Adapted from matplotlib/examples/event_handling/poly_editor.py
Jan 9 2014: taken from: https://gist.github.com/tonysyu/3090704
"""
from __future__ import division, print_function
import matplotlib
matplotlib.use('Qt4Agg')
import matplotlib.pyplot as pl... | apache-2.0 |
rodluger/planetplanet | planetplanet/photo/eyeball.py | 1 | 22416 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
eyeball.py |github|
-------------------
Code for plotting and visualizing "eyeball" planets.
.. role:: raw-html(raw)
:format: html
.. |github| replace:: :raw-html:`<a href = "https://github.com/rodluger/planetplanet/blob/master/planetplanet/photo/eyebal... | gpl-3.0 |
degoldschmidt/ribeirolab-codeconversion | python/flyPAD/fastrms.py | 1 | 2967 | import numpy as np
def fastrms(x, window = 5, dim = -1, ampl = 0):
"""
FASTRMS Instantaneous root-mean-square (RMS) power via convolution. (Translated from MATLAB script by Scott McKinney, 2011)
Input Parameters:
x: input signal (array-like)
window: length of LENGTH(WINDOW)-point rect... | gpl-3.0 |
aavanian/bokeh | bokeh/sampledata/tests/test_autompg.py | 2 | 2520 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | bsd-3-clause |
kiryx/pagmo | PyGMO/examples/benchmark_racing.py | 8 | 8309 | from PyGMO import *
import numpy as np
import matplotlib.pyplot as plt
import copy
# stochastic_type = 'NOISY'
stochastic_type = 'ROBUST'
base_problem = problem.ackley(10)
class post_eval:
"""
Obtain the post-evaluated fitness via repeated averaing over different seeds.
"""
def __init__(self, post... | gpl-3.0 |
schets/scikit-learn | examples/covariance/plot_outlier_detection.py | 235 | 3891 | """
==========================================
Outlier detection with several methods.
==========================================
When the amount of contamination is known, this example illustrates two
different ways of performing :ref:`outlier_detection`:
- based on a robust estimator of covariance, which is assumin... | bsd-3-clause |
par2/lamana-test | lamana/utils/references.py | 1 | 5777 | #------------------------------------------------------------------------------
class Reference(object):
'''A nonfunctional class containing urls for supporting code.'''
# ----- --------- -------------
# (001) imp.relaod http://stackoverflow.com/questions... | bsd-3-clause |
JeffreyFish/DocWebTool | DocTracking.py | 2 | 9018 | #!/usr/bin/env python
# -*- Coding: UTF-8 -*-
#------------------------------------
#--Author: Lychee Li
#--CreationDate: 2017/10/18
#--RevisedDate: 2017/10/27
#--RevisedDate: 2018/03/12
#------------------------------------
import datetime
import pyodbc
import common
import pandas as pd
# 读取SQL代码
with... | gpl-3.0 |
AdrieleD/gr-mac1 | python/qa_dqcsk_mapper_fc.py | 4 | 4241 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Felix Wunsch, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT) <wunsch.felix@googlemail.com>.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | gpl-3.0 |
DTU-ELMA/European_Dataset | Scripts/Build_Capacity_Layouts/2-Build_capacity_layouts_ECMWF.py | 1 | 1570 | import numpy as np
import pandas as pd
metadatadir = '../../Data/Metadata/'
nodeorder = np.load(metadatadir + 'nodeorder.npy')
windarea = np.load(metadatadir + 'Node_area_wind_onshore_ECMWF.npy') + \
np.load(metadatadir + 'Node_area_wind_offshore_ECMWF.npy')
solararea = np.load(metadatadir + 'Node_area_PV_ECMWF.... | apache-2.0 |
YinongLong/scikit-learn | examples/model_selection/grid_search_digits.py | 33 | 2764 | """
============================================================
Parameter estimation using grid search with cross-validation
============================================================
This examples shows how a classifier is optimized by cross-validation,
which is done using the :class:`sklearn.model_selection.GridS... | bsd-3-clause |
dopplershift/MetPy | src/metpy/units.py | 1 | 9002 | # Copyright (c) 2015,2017,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
r"""Module to provide unit support.
This makes use of the :mod:`pint` library and sets up the default settings
for good temperature support.
Attributes
----------
units :... | bsd-3-clause |
ssaeger/scikit-learn | benchmarks/bench_isotonic.py | 38 | 3047 | """
Benchmarks of isotonic regression performance.
We generate a synthetic dataset of size 10^n, for n in [min, max], and
examine the time taken to run isotonic regression over the dataset.
The timings are then output to stdout, or visualized on a log-log scale
with matplotlib.
This allows the scaling of the algorit... | bsd-3-clause |
poeticcapybara/pythalesians | pythalesians/timeseries/calcs/timeseriestimezone.py | 1 | 4543 | __author__ = 'saeedamen' # Saeed Amen / saeed@thalesians.com
#
# Copyright 2015 Thalesians Ltd. - http//www.thalesians.com / @thalesians
#
# 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://... | apache-2.0 |
NorfolkDataSci/presentations | 2018-01_chatbot/serverless-chatbots-workshop-master/LambdaFunctions/nlp/nltk/parse/dependencygraph.py | 7 | 31002 | # Natural Language Toolkit: Dependency Grammars
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Jason Narad <jason.narad@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (modifications)
#
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
#
"""
Tools for reading and writing dependency tree... | mit |
yejingfu/samples | tensorflow/pyplot05.py | 1 | 2102 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import re
small = np.array([2561,2472,2544,2548,2576,2262,2540,2570,2546,2570,2574,2552,2546,2614,2600,2526,2578,2550,2630,2580,2598,2580,2634,2556,2588,2580,2584,2618,2616,2594,2530,2586,2602,2596,2544,2550,2568,2580,2540,2560,2560,2580,2598,2... | mit |
Meisterschueler/ogn-python | app/main/matplotlib_service.py | 2 | 1400 | from app import db
from app.model import DirectionStatistic
import random
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
def create_range_figure2(sender_id):
fig = Figure()
axis = fig.add_subplot(1, 1, 1)
xs = range(100)
ys = [random.randint(1, 50) for x in xs]... | agpl-3.0 |
356255531/SpikingDeepRLControl | code/EnvBo/Q-Learning/Testing_Arm_1point/testing.py | 1 | 4647 | #!/usr/bin/python
import matplotlib
matplotlib.backend = 'Qt4Agg'
import matplotlib.pyplot as plt
import numpy as np
np.set_printoptions(precision=4)
import os
import sys
import threading
import time
from collections import deque
# import own modules
import agents
import goals
import q_networks
ARM... | gpl-3.0 |
cngo-github/nupic | examples/opf/tools/testDiagnostics.py | 58 | 1606 | import numpy as np
def printMatrix(inputs, spOutput):
''' (i,j)th cell of the diff matrix will have the number of inputs for which the input and output
pattern differ by i bits and the cells activated differ at j places.
Parameters:
--------------------------------------------------------------------
input... | agpl-3.0 |
ilyes14/scikit-learn | sklearn/tests/test_naive_bayes.py | 70 | 17509 | import pickle
from io import BytesIO
import numpy as np
import scipy.sparse
from sklearn.datasets import load_digits, load_iris
from sklearn.cross_validation import cross_val_score, train_test_split
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.te... | bsd-3-clause |
henridwyer/scikit-learn | sklearn/utils/tests/test_testing.py | 144 | 4121 | import warnings
import unittest
import sys
from nose.tools import assert_raises
from sklearn.utils.testing import (
_assert_less,
_assert_greater,
assert_less_equal,
assert_greater_equal,
assert_warns,
assert_no_warnings,
assert_equal,
set_random_state,
assert_raise_message)
from ... | bsd-3-clause |
mdigiorgio/lisa | libs/utils/energy_model.py | 1 | 36419 | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2016, ARM Limited and contributors.
#
# 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
#
# ... | apache-2.0 |
dpaiton/OpenPV | pv-core/analysis/python/plot_amoeba_response.py | 1 | 4052 | """
Make a histogram of normally distributed random numbers and plot the
analytic PDF over it
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib.cm as cm
import matplotlib.image as mpimg
import PVReadWeights as rw
import PVReadSparse as rs
import math
"""... | epl-1.0 |
rseubert/scikit-learn | examples/covariance/plot_robust_vs_empirical_covariance.py | 248 | 6359 | r"""
=======================================
Robust vs Empirical covariance estimate
=======================================
The usual covariance maximum likelihood estimate is very sensitive to the
presence of outliers in the data set. In such a case, it would be better to
use a robust estimator of covariance to guar... | bsd-3-clause |
Tong-Chen/scikit-learn | examples/mixture/plot_gmm_sin.py | 12 | 2726 | """
=================================
Gaussian Mixture Model Sine Curve
=================================
This example highlights the advantages of the Dirichlet Process:
complexity control and dealing with sparse data. The dataset is formed
by 100 points loosely spaced following a noisy sine curve. The fit by
the GMM... | bsd-3-clause |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/pyplots/pyplot_annotate.py | 1 | 1163 | """
===============
Pyplot Annotate
===============
"""
import numpy as np
import matplotlib.pyplot as plt
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 600)
plt.cla()
plt.clf()
plt.close('all')
def tempim... | mit |
wxgeo/geophar | wxgeometrie/mathlib/tests/test_parsers.py | 1 | 12300 | # -*- coding: utf-8 -*-
#from tools.testlib import *
import re
from pytest import XFAIL
from wxgeometrie.mathlib import universal_functions
from wxgeometrie.mathlib.parsers import (traduire_formule, NBR, NBR_SIGNE, VAR,
VAR_NOT_ATTR, NBR_OR_VAR, _arguments_latex,
... | gpl-2.0 |
aflaxman/scikit-learn | examples/neighbors/plot_digits_kde_sampling.py | 50 | 2007 | """
=========================
Kernel Density Estimation
=========================
This example shows how kernel density estimation (KDE), a powerful
non-parametric density estimation technique, can be used to learn
a generative model for a dataset. With this generative model in place,
new samples can be drawn. These... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py | 1 | 25266 | """
An experimental support for curvilinear grid.
"""
from itertools import chain
from grid_finder import GridFinder
from axislines import \
AxisArtistHelper, GridHelperBase
from axis_artist import AxisArtist
from matplotlib.transforms import Affine2D, IdentityTransform
import numpy as np
from matplotlib.path... | gpl-2.0 |
jcchin/MagnePlane | src/hyperloop/Python/OldMagnePlaneCode/tube_cost.py | 4 | 4899 | # import libraries
from math import pi, sin
import matplotlib.pyplot as plt
from openmdao.core.component import Component
class TubeCost(Component):
def __init__(self):
super(TubeCost, self).__init__()
self.add_param('cmt', 1.2, desc='cost of materials', units='1/kg')
self.add_param('cshi... | apache-2.0 |
sssllliang/BuildingMachineLearningSystemsWithPython | ch09/utils.py | 24 | 5568 | # 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
import os
import sys
from matplotlib import pylab
import numpy as np
DATA_DIR = os.path.join(
os.... | mit |
skywalkerytx/oracle | src/main/python/stats.py | 1 | 2546 | # coding=utf-8
import psycopg2
import numpy as np
import matplotlib.pyplot as plt
con = psycopg2.connect(database = 'nova',user = 'nova',password = 'emeth')
cur = con.cursor()
extra = "and k>%s and raw.date >='2016-03-01'"
X = np.arange(10,80,1)
sr = np.zeros(len(X))
recall = np.zeros(len(X))
count = 0
for lower_... | mit |
jason-z-hang/airflow | setup.py | 1 | 3185 | from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
# Kept manually in sync with airflow.__version__
version = '1.5.2'
class Tox(TestCommand):
user_options = [('tox-args=', None, "Arguments to pass to tox")]
def initialize_options(self):
Test... | apache-2.0 |
lbishal/scikit-learn | sklearn/decomposition/tests/test_factor_analysis.py | 34 | 3060 | # Author: Christian Osendorfer <osendorf@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Licence: BSD3
import numpy as np
from sklearn.utils.testing import assert_warns
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing im... | bsd-3-clause |
belltailjp/scikit-learn | examples/ensemble/plot_gradient_boosting_quantile.py | 392 | 2114 | """
=====================================================
Prediction Intervals for Gradient Boosting Regression
=====================================================
This example shows how quantile regression can be used
to create prediction intervals.
"""
import numpy as np
import matplotlib.pyplot as plt
from skle... | bsd-3-clause |
msebire/intellij-community | python/helpers/pycharm_matplotlib_backend/backend_interagg.py | 4 | 3100 | import base64
import matplotlib
import os
import sys
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import FigureManagerBase, ShowBase
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from datalore.display import display
PY3 = sys.version_info[... | apache-2.0 |
pratapvardhan/pandas | pandas/tests/extension/category/test_categorical.py | 2 | 5378 | import string
import pytest
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
from pandas import Categorical
from pandas.tests.extension import base
def make_data():
return np.random.choice(list(string.ascii_letters), size=100)
@pytest.fixture
def dtype():
return Categor... | bsd-3-clause |
CallaJun/hackprince | indico/matplotlib/text.py | 10 | 73585 | """
Classes for including text in a figure.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from six.moves import zip
import math
import warnings
import numpy as np
from matplotlib import cbook
from matplotlib import rcParams
import matplot... | lgpl-3.0 |
bert9bert/statsmodels | statsmodels/tsa/statespace/tools.py | 1 | 67506 | """
Statespace Tools
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from scipy.linalg import solve_sylvester
import pandas as pd
from statsmodels.tools.data import _is_using_pandas
import warnings
compatibility_mode = False
has_tr... | bsd-3-clause |
pompiduskus/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_scalability.py | 225 | 5719 | """
============================================
Scalability of Approximate Nearest Neighbors
============================================
This example studies the scalability profile of approximate 10-neighbors
queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200``
when varying the number of sa... | bsd-3-clause |
r-mart/scikit-learn | doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py | 256 | 2406 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | bsd-3-clause |
rohit21122012/DCASE2013 | runs/2013/xgboost100/src/evaluation.py | 38 | 42838 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import numpy
import math
from sklearn import metrics
class DCASE2016_SceneClassification_Metrics():
"""DCASE 2016 scene classification metrics
Examples
--------
>>> dcase2016_scene_metric = DCASE2016_SceneClassification_Metrics(class_list=... | mit |
eadgarchen/tensorflow | tensorflow/python/estimator/inputs/queues/feeding_functions.py | 10 | 18972 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
fbagirov/scikit-learn | examples/neighbors/plot_regression.py | 349 | 1402 | """
============================
Nearest Neighbors regression
============================
Demonstrate the resolution of a regression problem
using a k-Nearest Neighbor and the interpolation of the
target using both barycenter and constant weights.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@... | bsd-3-clause |
acdh-oeaw/dig_ed_cat | charts/ml_views.py | 1 | 1520 | import collections
import json
import pandas as pd
import numpy as np
from django.shortcuts import render
from django.http import JsonResponse
from collections import Counter
from sklearn.cluster import KMeans
from django.contrib.contenttypes.models import ContentType
from browsing.views import serialize
from editions.... | mit |
ngoix/OCRF | examples/semi_supervised/plot_label_propagation_structure.py | 45 | 2433 | """
==============================================
Label Propagation learning a complex structure
==============================================
Example of LabelPropagation learning a complex internal structure
to demonstrate "manifold learning". The outer circle should be
labeled "red" and the inner circle "blue". Be... | bsd-3-clause |
mfergie/human-hive | humanhive/swarm.py | 1 | 12847 | """Module for managing swarm positions"""
import math
import numpy as np
from sklearn.metrics.pairwise import rbf_kernel
class CosSinSwarm:
"""
A toy module for doing 2 channel volumes using cos/sin functions.
"""
def __init__(self, sample_rate):
self.sample_rate = sample_rate
self.sta... | bsd-2-clause |
krosenfeld/scatterbrane | docs/_code/time_variability.py | 1 | 3849 | '''
Generate a time series incorporating the motion of the screen across the source.
This script may take a long time to run. I suggest you read through it first and
adjust the num_samples variable to check out its performance.
'''
import numpy as np
from scipy.ndimage import imread
import time
import matplotlib.pyplot... | mit |
cactusbin/nyt | matplotlib/examples/user_interfaces/svg_tooltip.py | 6 | 3492 | """
SVG tooltip example
===================
This example shows how to create a tooltip that will show up when
hovering over a matplotlib patch.
Although it is possible to create the tooltip from CSS or javascript,
here we create it in matplotlib and simply toggle its visibility on
when hovering over the patch. Th... | unlicense |
rhyolight/NAB | nab/runner.py | 2 | 10315 | # ----------------------------------------------------------------------
# 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 program is free software: you can redistribute it and/... | agpl-3.0 |
tdhopper/scikit-learn | sklearn/externals/joblib/parallel.py | 79 | 35628 | """
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
from __future__ import division
import os
import sys
import gc
import warnings
from math import sqrt
import functools
import time
import thr... | bsd-3-clause |
jmschrei/scikit-learn | examples/feature_selection/plot_feature_selection.py | 95 | 2847 | """
===============================
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 |
fcchou/CS229-project | learning/final5.py | 1 | 2764 | import sys
sys.path.append('../')
from jos_learn.features import FeatureExtract
import numpy as np
import matplotlib.pyplot as plt
import sklearn.cross_validation as cv
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import LogisticRegression
from sklearn.svm import LinearSVC, SVC
from sklearn.... | apache-2.0 |
xubenben/scikit-learn | examples/decomposition/plot_incremental_pca.py | 244 | 1878 | """
===============
Incremental PCA
===============
Incremental principal component analysis (IPCA) is typically used as a
replacement for principal component analysis (PCA) when the dataset to be
decomposed is too large to fit in memory. IPCA builds a low-rank approximation
for the input data using an amount of memo... | bsd-3-clause |
petosegan/scikit-learn | sklearn/utils/extmath.py | 142 | 21102 | """
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# License: BSD 3 clause
from __future__ import division
from functools import partial
import ... | bsd-3-clause |
tsennikova/scientists-analysis | preprocessing/time_series_normalization.py | 1 | 4192 | '''
Created on 19 Jul 2016
@author: sennikta
'''
import os
from sklearn import preprocessing
import numpy as np
from os import listdir
import calendar
import collections
import csv
from itertools import islice
import pandas as pd
np.set_printoptions(formatter={'float': lambda x: "{0:0.3f}".format(x)}... | mit |
MohammedWasim/scikit-learn | sklearn/preprocessing/label.py | 137 | 27165 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
shanot/imp | modules/pmi/pyext/src/representation.py | 1 | 111198 | #!/usr/bin/env python
"""@namespace IMP.pmi.representation
Representation of the system.
"""
from __future__ import print_function
import IMP
import IMP.core
import IMP.algebra
import IMP.atom
import IMP.display
import IMP.isd
import IMP.pmi
import IMP.pmi.tools
import IMP.pmi.output
import IMP.rmf
import IMP.pmi.... | gpl-3.0 |
lewismc/topik | topik/models/model_base.py | 1 | 3158 | from abc import ABCMeta, abstractmethod
import logging
import json
import pandas as pd
from six import with_metaclass
# doctest-only imports
from topik.preprocessing import preprocess
from topik.readers import read_input
from topik.tests import test_data_path
from topik.intermediaries.persistence import Persistor
re... | bsd-3-clause |
rosswhitfield/mantid | Framework/PythonInterface/mantid/plots/mantidimage.py | 3 | 2051 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
impo... | gpl-3.0 |
dongjoon-hyun/spark | python/pyspark/pandas/tests/test_sql.py | 15 | 1979 | #
# 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 |
DGrady/pandas | asv_bench/benchmarks/stat_ops.py | 7 | 6106 | from .pandas_vb_common import *
def _set_use_bottleneck_False():
try:
pd.options.compute.use_bottleneck = False
except:
from pandas.core import nanops
nanops._USE_BOTTLENECK = False
class FrameOps(object):
goal_time = 0.2
param_names = ['op', 'use_bottleneck', 'dtype', 'axis... | bsd-3-clause |
alongwithyou/auto-sklearn | test/models/test_cv_evaluator.py | 5 | 7929 | import copy
import functools
import os
import unittest
import numpy as np
from numpy.linalg import LinAlgError
from autosklearn.data.competition_data_manager import CompetitionDataManager
from autosklearn.models.cv_evaluator import CVEvaluator
from autosklearn.models.paramsklearn import get_configuration_space
from P... | bsd-3-clause |
dolphyin/cs194-16-data_manatees | classificationSpecific/run_train2.py | 4 | 4651 | import numpy as np
from sklearn import svm
from sklearn import linear_model
from sklearn import cluster
from sklearn import neighbors
from sklearn import preprocessing
from sklearn import tree
from sklearn import ensemble
from sklearn import cross_validation
import time, pdb
import train
data_path = "./joined_matrix.... | apache-2.0 |
gjermv/potato | sccs/gpx/tcxtricks.py | 1 | 4297 | '''
Created on 7 Apr 2016
@author: gjermund.vingerhagen
'''
from lxml import etree as etree
import utmconverter as utm
import algos as algos
import gpxtricks
import pandas as pd
from datetime import datetime as dt
from datetime import timedelta as dtt
from matplotlib import pyplot as plt
import time
im... | gpl-2.0 |
kanhua/pypvcell | lab/SMARTS/smarts_df_util.py | 1 | 4419 | import numpy as np
import pandas as pd
import os
from SMARTS.smarts import get_clear_sky
from pvlib.tracking import singleaxis
def load_smarts_df(h5_data_files, add_dhi=True):
"""
Load SMARTS generated DataFrame from different files and combine them into a single DataFrame
:param h5_data_files:
:retur... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.