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 |
|---|---|---|---|---|---|
xzh86/scikit-learn | sklearn/neighbors/nearest_centroid.py | 199 | 7249 | # -*- coding: utf-8 -*-
"""
Nearest Centroid Classification
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse as sp
from ..base import BaseEstimator, ClassifierMixin
from ..met... | bsd-3-clause |
peterfpeterson/mantid | Testing/PerformanceTests/make_report.py | 3 | 3243 | #!/usr/bin/env python
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 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 - Identi... | gpl-3.0 |
seanli9jan/tensorflow | tensorflow/python/client/notebook.py | 61 | 4779 | # Copyright 2015 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 |
pigna90/lastfm_network_analysis | src/community_discovery.py | 1 | 12604 | from Demon import Demon
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
import matplotlib.colors as colors
import networkx as nx
import os
from itertools import product
import seaborn as sns
import pandas as pd
import community
from sklearn.preprocessing import normalize
##
# Print a bar... | gpl-3.0 |
hips/autograd | examples/black_box_svi.py | 3 | 3136 | from __future__ import absolute_import
from __future__ import print_function
import matplotlib.pyplot as plt
import autograd.numpy as np
import autograd.numpy.random as npr
import autograd.scipy.stats.multivariate_normal as mvn
import autograd.scipy.stats.norm as norm
from autograd import grad
from autograd.misc.opti... | mit |
nitin-cherian/LifeLongLearning | Python/PythonProgrammingLanguage/Encapsulation/encap_env/lib/python3.5/site-packages/IPython/core/display.py | 2 | 43675 | # -*- coding: utf-8 -*-
"""Top-level display functions for displaying object in different formats."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
try:
from base64 import encodebytes as base64_encode
except ImportError:
from base64 import encodestring a... | mit |
guptachetan1997/Episodes | tvshow/utils/dataset_builder.py | 1 | 2971 | import requests
from bs4 import BeautifulSoup
import random
from urllib.parse import quote
import time
import pandas as pd
user_agents = [
'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11',
'Opera/9.25 (Windows NT 5.1; U; en)',
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT... | mit |
vortex-ape/scikit-learn | sklearn/setup.py | 14 | 3236 | import os
from os.path import join
import warnings
from sklearn._build_utils import maybe_cythonize_extensions
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFoundError
import numpy
lib... | bsd-3-clause |
mberent/tweets-storm | src/main/resources/splitsentence.py | 1 | 7233 | from sklearn.feature_extraction.text import CountVectorizer
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses thi... | apache-2.0 |
petosegan/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 |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/linear_model/tests/test_logistic.py | 5 | 49337 | import numpy as np
import scipy.sparse as sp
from scipy import linalg, optimize, sparse
from sklearn.datasets import load_iris, make_classification
from sklearn.metrics import log_loss
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import LabelEncoder
from sklearn.utils import compute_cl... | mit |
mlyundin/scikit-learn | examples/cluster/plot_dbscan.py | 346 | 2479 | # -*- coding: utf-8 -*-
"""
===================================
Demo of DBSCAN clustering algorithm
===================================
Finds core samples of high density and expands clusters from them.
"""
print(__doc__)
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn... | bsd-3-clause |
subodhchhabra/pandashells | pandashells/bin/p_rand.py | 3 | 5729 | #! /usr/bin/env python
# standard library imports
import argparse
import textwrap
import sys # NOQA importing sys so I can mock sys.argv in tests
from pandashells.lib import module_checker_lib, arg_lib
module_checker_lib.check_for_modules(['pandas'])
from pandashells.lib import io_lib
import pandas as pd
import n... | bsd-2-clause |
dandanvidi/capacity-usage | scripts/thermal_stability.py | 3 | 1877 | import pandas as pd
from capacity_usage import CAPACITY_USAGE
import matplotlib.pyplot as plt
from scipy.stats import pearsonr, spearmanr
import seaborn as sns
from cobra.manipulation.modify import revert_to_reversible
from itertools import product
flux = pd.DataFrame.from_csv("../data/mmol_gCDW_h.csv")
copies_fL = pd... | mit |
ngoix/OCRF | examples/svm/plot_separating_hyperplane_unbalanced.py | 329 | 1850 | """
=================================================
SVM: Separating hyperplane for unbalanced classes
=================================================
Find the optimal separating hyperplane using an SVC for classes that
are unbalanced.
We first find the separating plane with a plain SVC and then plot
(dashed) the ... | bsd-3-clause |
BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/tools/rplot.py | 2 | 30022 | import random
import warnings
from copy import deepcopy
from pandas.core.common import _values_from_object
import numpy as np
from pandas.compat import range, zip
#
# TODO:
# * Make sure legends work properly
#
warnings.warn("\n"
"The rplot trellis plotting interface is deprecated and will be "
... | mit |
massmutual/scikit-learn | examples/model_selection/plot_precision_recall.py | 249 | 6150 | """
================
Precision-Recall
================
Example of Precision-Recall metric to evaluate classifier output quality.
In information retrieval, precision is a measure of result relevancy, while
recall is a measure of how many truly relevant results are returned. A high
area under the curve represents both ... | bsd-3-clause |
cl4rke/scikit-learn | sklearn/linear_model/randomized_l1.py | 95 | 23365 | """
Randomized Lasso/Logistic: feature selection based on Lasso and
sparse Logistic Regression
"""
# Author: Gael Varoquaux, Alexandre Gramfort
#
# License: BSD 3 clause
import itertools
from abc import ABCMeta, abstractmethod
import warnings
import numpy as np
from scipy.sparse import issparse
from scipy import spar... | bsd-3-clause |
Averroes/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 |
voxlol/scikit-learn | sklearn/metrics/cluster/tests/test_unsupervised.py | 230 | 2823 | import numpy as np
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn.metrics.cluster.unsupervised import silhouette_score
from sklearn.metrics import pairwise_distances
from sklearn.utils.testing import assert_false, assert_almost_equal
from sklearn.utils.testing import assert_raises_regexp... | bsd-3-clause |
xgds/xgds_instrument | xgds_instrument/views.py | 1 | 6157 | # __BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance... | apache-2.0 |
datacommonsorg/data | scripts/us_census/geojsons_low_res/plotter.py | 1 | 2623 | # Copyright 2020 Google LLC
#
# 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, ... | apache-2.0 |
gkulkarni/JetMorphology | jet_unqualmasses.py | 1 | 3657 | """
File: jet_unequalmasses.py
Jet morphology from a BH binary that is in the GW-dominated phase of
its inspiral (Figures 4). BH masses are not assumed to be equal.
"""
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['font.serif'] = 'cm'
mpl.rcParams[... | mit |
pkruskal/scikit-learn | sklearn/cluster/tests/test_spectral.py | 262 | 7954 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
eyadsibai/rep | tests/test_factory_regression.py | 4 | 3005 | from __future__ import division, print_function, absolute_import
from sklearn.ensemble import RandomForestRegressor, AdaBoostRegressor
from sklearn.metrics.metrics import mean_squared_error
import numpy
from rep.data import LabeledDataStorage
from rep.metaml import RegressorsFactory
from six.moves import cPickle
from... | apache-2.0 |
binghongcha08/pyQMD | GWP/2D/1.0.9/c.py | 28 | 1767 | ##!/usr/bin/python
import numpy as np
import pylab as plt
import seaborn as sns
sns.set_context('poster')
#with open("traj.dat") as f:
# data = f.read()
#
# data = data.split('\n')
#
# x = [row.split(' ')[0] for row in data]
# y = [row.split(' ')[1] for row in data]
#
# fig = plt.figure()
#
# ax1 ... | gpl-3.0 |
justinfinkle/pydiffexp | pydiffexp/pipeline.py | 1 | 21056 | import multiprocessing as mp
import os
import sys
import warnings
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
from pydiffexp import DEAnalysis, DEPlot, pairwise_corr
from pydiffexp.gnw import GnwNetResults, GnwSimResults, draw_results, get_graph
from scipy import stats
... | gpl-3.0 |
jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/dask/array/percentile.py | 3 | 6288 | from __future__ import absolute_import, division, print_function
from itertools import count
from functools import wraps
from collections import Iterator
import numpy as np
from toolz import merge, merge_sorted
from .core import Array
from ..base import tokenize
@wraps(np.percentile)
def _percentile(a, q, interpol... | mit |
vberaudi/scipy | scipy/cluster/tests/test_hierarchy.py | 26 | 35153 | #! /usr/bin/env python
#
# Author: Damian Eads
# Date: April 17, 2008
#
# Copyright (C) 2008 Damian Eads
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copy... | bsd-3-clause |
jat255/hyperspyUI | hyperspyui/plugins/segmentation.py | 3 | 4922 | # -*- coding: utf-8 -*-
# Copyright 2014-2016 The HyperSpyUI developers
#
# This file is part of HyperSpyUI.
#
# HyperSpyUI 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
#... | gpl-3.0 |
gef756/statsmodels | statsmodels/sandbox/examples/thirdparty/ex_ratereturn.py | 33 | 4394 | # -*- coding: utf-8 -*-
"""Playing with correlation of DJ-30 stock returns
this uses pickled data that needs to be created with findow.py
to see graphs, uncomment plt.show()
Created on Sat Jan 30 16:30:18 2010
Author: josef-pktd
"""
import numpy as np
import matplotlib.finance as fin
import matplotlib.pyplot as plt... | bsd-3-clause |
fbagirov/scikit-learn | examples/ensemble/plot_voting_probas.py | 316 | 2824 | """
===========================================================
Plot class probabilities calculated by the VotingClassifier
===========================================================
Plot the class probabilities of the first sample in a toy dataset
predicted by three different classifiers and averaged by the
`VotingC... | bsd-3-clause |
DmitryYurov/BornAgain | dev-tools/analyze/lines_of_code.py | 3 | 1459 | """
Creates picture with number of lines of code.
Usage: python3 lines_of_code.py
The command should be executed in the directory where lines_of_code.py is located
(i.e. in <BornAgain>/dev-tools/analyze)
"""
import sys
if sys.version_info < (3, 0):
exit("Requires python3, exiting ...")
import os
from baloc import ... | gpl-3.0 |
ClimbsRocks/scikit-learn | benchmarks/bench_covertype.py | 57 | 7378 | """
===========================
Covertype dataset benchmark
===========================
Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART
(decision tree), RandomForest and Extra-Trees on the forest covertype dataset
of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ... | bsd-3-clause |
winklerand/pandas | pandas/tests/series/test_timeseries.py | 1 | 32325 | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import pytest
import numpy as np
from datetime import datetime, timedelta, time
import pandas as pd
import pandas.util.testing as tm
from pandas._libs.tslib import iNaT
from pandas.compat import lrange, StringIO, product
from pandas.core.indexes.timedeltas import Time... | bsd-3-clause |
wanggang3333/scikit-learn | benchmarks/bench_tree.py | 297 | 3617 | """
To run this, you'll need to have installed.
* scikit-learn
Does two benchmarks
First, we fix a training set, increase the number of
samples to classify and plot number of classified samples as a
function of time.
In the second benchmark, we increase the number of dimensions of the
training set, classify a sam... | bsd-3-clause |
ctogle/grapeipm_support | wu_locate.py | 1 | 5419 | #!/usr/bin/python2.7
import argparse,contextlib,io,sys,os,json,time,pdb
import matplotlib.pyplot as plt
import wu_gather
baseurl_lonlat = 'http://api.wunderground.com/api/%s/geolookup/q/%s,%s.json'
make_url_lonlat = lambda u,x,y : baseurl_lonlat % (u,x,y)
# added this function cause it looks like Wunderground defies ... | mit |
exepulveda/swfc | python/clustering_pca_2d.py | 1 | 3175 | import numpy as np
import pickle
import logging
import argparse
import csv
import matplotlib as mpl
mpl.use('agg')
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.metrics import silhouette_score
from cluster_utils import create_cl... | gpl-3.0 |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/testing/jpl_units/Epoch.py | 6 | 7147 | #===========================================================================
#
# Epoch
#
#===========================================================================
"""Epoch module."""
#===========================================================================
# Place all imports after here.
#
from __future__ impo... | mit |
potash/scikit-learn | examples/semi_supervised/plot_label_propagation_structure.py | 55 | 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 |
xzh86/scikit-learn | sklearn/feature_extraction/tests/test_dict_vectorizer.py | 276 | 3790 | # Authors: Lars Buitinck <L.J.Buitinck@uva.nl>
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from random import Random
import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_equal
from sklearn.utils.testing import (assert_equal, assert_in,
... | bsd-3-clause |
cl4rke/scikit-learn | sklearn/datasets/lfw.py | 38 | 19042 | """Loader for the Labeled Faces in the Wild (LFW) dataset
This dataset is a collection of JPEG pictures of famous people collected
over the internet, all details are available on the official website:
http://vis-www.cs.umass.edu/lfw/
Each picture is centered on a single face. The typical task is called
Face Veri... | bsd-3-clause |
ky822/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 |
jmschrei/scikit-learn | sklearn/model_selection/tests/test_search.py | 20 | 30855 | """Test the search module"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from itertools import chain, product
import pickle
import sys
import numpy as np
import scipy.sparse as sp
from sklearn.utils.fixes import ... | bsd-3-clause |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/pandas/io/stata.py | 7 | 82769 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | gpl-3.0 |
pravsripad/jumeg | examples/causality/plot_inter_and_intra_lobe_causality.py | 2 | 3317 | """
Group a causality matrix by lobes and plot the resulting
inter- and intra-lobe causality.
Author: Christian Kiefer <ch.kiefer@fz-juelich.de>
"""
import os
import os.path as op
import matplotlib.pyplot as plt
import mne
import numpy as np
from jumeg.connectivity.con_utils import group_con_matrix_by_lobe
from jum... | bsd-3-clause |
ai-se/XTREE | src/Planners/XTREE/methods1.py | 1 | 2615 | #! /Users/rkrsn/anaconda/bin/python
from pdb import set_trace
from os import environ, getcwd
from os import walk
from os.path import expanduser
from pdb import set_trace
import sys
# Update PYTHONPATH
HOME = expanduser('~')
axe = HOME + '/git/axe/axe/' # AXE
pystat = HOME + '/git/pystats/' # PySTAT
cwd = getcwd() #... | mit |
mne-tools/mne-tools.github.io | 0.15/_downloads/plot_visualize_evoked.py | 1 | 9914 | """
.. _tut_viz_evoked:
=====================
Visualize Evoked data
=====================
In this tutorial we focus on plotting functions of :class:`mne.Evoked`.
"""
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
# sphinx_gallery_thumbnail_number = 9
############################... | bsd-3-clause |
nelango/ViralityAnalysis | model/lib/sklearn/metrics/__init__.py | 214 | 3440 | """
The :mod:`sklearn.metrics` module includes score functions, performance metrics
and pairwise metrics and distance computations.
"""
from .ranking import auc
from .ranking import average_precision_score
from .ranking import coverage_error
from .ranking import label_ranking_average_precision_score
from .ranking imp... | mit |
jlegendary/scikit-learn | examples/linear_model/plot_lasso_and_elasticnet.py | 249 | 1982 | """
========================================
Lasso and Elastic Net for Sparse Signals
========================================
Estimates Lasso and Elastic-Net regression models on a manually generated
sparse signal corrupted with an additive noise. Estimated coefficients are
compared with the ground-truth.
"""
print(... | bsd-3-clause |
zrhans/pythonanywhere | .virtualenvs/django19/lib/python3.4/site-packages/matplotlib/backends/backend_template.py | 8 | 9384 | """
This is a fully functional do nothing backend to provide a template to
backend writers. It is fully functional in that you can select it as
a backend with
import matplotlib
matplotlib.use('Template')
and your matplotlib scripts will (should!) run without error, though
no output is produced. This provides a ... | apache-2.0 |
icdishb/scikit-learn | sklearn/datasets/tests/test_20news.py | 42 | 2416 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
winklerand/pandas | pandas/tests/indexes/timedeltas/test_partial_slicing.py | 7 | 3216 | import pytest
import numpy as np
import pandas.util.testing as tm
import pandas as pd
from pandas import Series, timedelta_range, Timedelta
from pandas.util.testing import assert_series_equal
class TestSlicing(object):
def test_slice_keeps_name(self):
# GH4226
dr = pd.timedelta_range('1d', '5d',... | bsd-3-clause |
victor-prado/broker-manager | environment/lib/python3.5/site-packages/pandas/tseries/tests/test_bin_groupby.py | 7 | 5012 | # -*- coding: utf-8 -*-
from numpy import nan
import numpy as np
from pandas.types.common import _ensure_int64
from pandas import Index, isnull
from pandas.util.testing import assert_almost_equal
import pandas.util.testing as tm
import pandas.lib as lib
import pandas.algos as algos
def test_series_grouper():
fr... | mit |
dhwang99/statistics_introduction | hypothetical_test/test_contain.py | 1 | 2067 | #encoding: utf8
import numpy as np
from scipy.misc import comb
from scipy.stats import norm
import matplotlib.pyplot as plt
import pdb
'''
容量和alpha, beta都有关, 和delta有关。一般delta取一个sigma
err1 = alpha = 0.1
err2 = beta = 0.2
正态样本容量,用来控制第二类错误(这么说还好不对)
delta 默认为一个标准差
Phi((c - mu0)*sqrt(n)/sigma) <= (1-alpha)
c <= ppf(1-... | gpl-3.0 |
iismd17/scikit-learn | examples/decomposition/plot_ica_vs_pca.py | 306 | 3329 | """
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... | bsd-3-clause |
CallaJun/hackprince | indico/matplotlib/backends/backend_qt5.py | 10 | 29378 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import os
import re
import signal
import sys
from six import unichr
import matplotlib
from matplotlib.cbook import is_string_like
from matplotlib.backend_bases import FigureManagerBase
from matplot... | lgpl-3.0 |
linkedin/naarad | src/naarad/metrics/jmeter_metric.py | 1 | 15687 | # coding=utf-8
"""
Copyright 2013 LinkedIn Corp. 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 l... | apache-2.0 |
tensorflow/models | official/vision/detection/utils/object_detection/visualization_utils.py | 1 | 28994 | # Copyright 2021 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 |
SotolitoLabs/cockpit | bots/learn/cluster.py | 3 | 11778 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Cockpit.
#
# Copyright (C) 2017 Slavek Kabrda
#
# Cockpit 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 2.1 of the... | lgpl-2.1 |
ilo10/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 |
nborwankar/opendatasci | notebooks/kmeans.py | 4 | 1967 | # supporting lib for kmeans clustering
# Nitin Borwankar
# Open Data Science Training
import numpy as np
from scipy.cluster.vq import kmeans,vq
from scipy.spatial.distance import cdist
import matplotlib.pyplot as plt
def load_data(fName = '../datasets/UN4col.csv'):
fp = open(fName)
XX = np.loadtxt(fp)
fp.close... | bsd-2-clause |
bsipocz/astroML | examples/datasets/plot_sdss_spectrum.py | 5 | 1247 | """
SDSS Spectrum Example
---------------------
This example shows how to fetch and plot a spectrum from the SDSS database
using the plate, MJD, and fiber numbers. The code below sends a query to
the SDSS server for the given plate, fiber, and mjd, downloads the spectrum,
and plots the result.
"""
# Author: Jake Vande... | bsd-2-clause |
etkirsch/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 |
q1ang/scikit-learn | examples/model_selection/plot_validation_curve.py | 229 | 1823 | """
==========================
Plotting Validation Curves
==========================
In this plot you can see the training scores and validation scores of an SVM
for different values of the kernel parameter gamma. For very low values of
gamma, you can see that both the training score and the validation score are
low. ... | bsd-3-clause |
LohithBlaze/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py | 254 | 2795 | """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 |
cdd1969/pygwa | lib/functions/interpolate.py | 1 | 7114 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
def createInterpolationRanges(df, columnName, interpolateMargin=100, log=False):
u""" Function checks data for missing values. From the missing-data indices
it will try to create so called 'missing data index regions' based on
... | gpl-2.0 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/pandas/tests/io/parser/na_values.py | 6 | 10526 | # -*- coding: utf-8 -*-
"""
Tests that NA values are properly handled during
parsing for all of the parsers defined in parsers.py
"""
import numpy as np
from numpy import nan
import pandas.io.parsers as parsers
import pandas.util.testing as tm
from pandas import DataFrame, Index, MultiIndex
from pandas.compat impor... | mit |
eg-zhang/scikit-learn | examples/linear_model/plot_bayesian_ridge.py | 248 | 2588 | """
=========================
Bayesian Ridge Regression
=========================
Computes a Bayesian Ridge Regression on a synthetic dataset.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the coefficient
weights are slightly shift... | bsd-3-clause |
wkentaro/fcn | examples/apc2016/datasets/mit_benchmark.py | 1 | 3797 | import itertools
import os
import os.path as osp
import chainer
import numpy as np
import scipy.misc
from sklearn.model_selection import train_test_split
from base import APC2016DatasetBase
def ids_from_scene_dir(scene_dir, empty_scene_dir):
for i_frame in itertools.count():
empty_file = osp.join(
... | mit |
hdmetor/scikit-learn | benchmarks/bench_plot_approximate_neighbors.py | 85 | 6377 | """
Benchmark for approximate nearest neighbor search using
locality sensitive hashing forest.
There are two types of benchmarks.
First, accuracy of LSHForest queries are measured for various
hyper-parameters and index sizes.
Second, speed up of LSHForest queries compared to brute force
method in exact nearest neigh... | bsd-3-clause |
Yu-Group/scikit-learn-sandbox | benchmarks/deleteme/py_irf_benchmarks.py | 1 | 14042 | # iRF benchmarks
import numpy as np
import time
from copy import deepcopy
import matplotlib.pyplot as plt
import os
import yaml
from sklearn import tree
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from IPython.display import display, Image
from sklearn.dat... | mit |
bitforks/freetype-py | examples/glyph-vector.py | 3 | 2915 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# ---------------------------------------------------------------... | bsd-3-clause |
mpritham/prophet | docs/conf.py | 2 | 8901 | # -*- coding: utf-8 -*-
#
# Prophet documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 19 05:52:00 2014.
#
# 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.
#
# A... | bsd-3-clause |
iut-ibk/DynaMind-Sewer | scripts/Sewer/clustering.py | 1 | 2985 | # -*- coding: utf-8 -*-
"""
@file
@author Chrisitan Urich <christian.urich@gmail.com>
@version 1.0
@section LICENSE
This file is part of DynaMind
Copyright (C) 2012 Christian Urich
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as publishe... | gpl-2.0 |
aminert/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 |
murali-munna/scikit-learn | sklearn/decomposition/tests/test_dict_learning.py | 85 | 8565 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises... | bsd-3-clause |
Wonjuseo/Project101 | 2/2-2. FrozenLake2.py | 1 | 2022 | import gym
import numpy as np
import matplotlib.pyplot as plt
from gym.envs.registration import register
import random as pr
import tensorflow as tf
def rargmax(vector):
# random argmax
m = np.max(vector)
indices = np.nonzero(vector == m)[0]
return pr.choice(indices)
# Reward Update Q
# Algorithm
# Fo... | apache-2.0 |
sirfoga/hal | hal/data/matrix.py | 2 | 3170 | #!/usr/bin/env python
# coding: utf-8
"""Functions to deal with matrices"""
from sklearn.preprocessing import LabelEncoder
from hal.maths.utils import divide
class Matrix:
"""Table of data"""
def __init__(self, matrix):
self.matrix = matrix
def precision(self):
"""Calculates precision... | apache-2.0 |
low-sky/colira | bayes/hold/bayes_ratio_galrad.py | 1 | 6905 | #!/usr/bin/env python
import scipy.stats
import numpy as np
import astropy.io.fits as fits
import emcee
import matplotlib.pyplot as p
from matplotlib import rc
from astropy.table import Table, Column
rc('text',usetex=True)
execfile('logprob.py')
s = fits.getdata('colira.fits')
hdr = fits.getheader('colira.fits')
Gal... | gpl-2.0 |
sounay/flaminggo-test | onadata/apps/viewer/tests/test_export_list.py | 5 | 8203 | import os
from django.core.urlresolvers import reverse
from onadata.apps.main.tests.test_base import TestBase
from onadata.apps.viewer.models.export import Export
from onadata.apps.main.models.meta_data import MetaData
from onadata.apps.viewer.views import export_list
class TestExportList(TestBase):
def setUp(... | bsd-2-clause |
tomsilver/NAB | tests/integration/false_positive_test.py | 1 | 5890 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | gpl-3.0 |
mjsauvinen/P4UL | pyAnalyze/richardsonProfiles.py | 1 | 3268 | #!/usr/bin/env python3
import sys
import numpy as np
import argparse
import matplotlib.pyplot as plt
from plotTools import addToPlot
from netcdfTools import netcdfDataset, readVariableFromDataset
from analysisTools import sensibleIds, groundOffset
from utilities import filesFromList
'''
Description: A script to perfor... | mit |
ucbtrans/sumo-project | examples/timingPlan_simulation/Throughput/plots4pravin/Deceleration_4.5/Manual/tau_plots.py | 1 | 3677 | import sys
import optparse
import subprocess
import random
import pdb
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({'font.size': 20})
import math
import numpy as np
import scipy.io
a2_10 = np.loadtxt('2min3RCT_taus_a1.0',dtype=int)
t2_10 = np.loadtxt('2min3RCT_taus_time_a1.0',dtype=int... | bsd-2-clause |
argriffing/cvxpy | doc/sphinxext/docscrape_sphinx.py | 154 | 7759 | import re, inspect, textwrap, pydoc
import sphinx
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config={}):
self.use_plots = config.get('use_plots', False)
NumpyDocString.__init__(self, docstring, config=config)
... | gpl-3.0 |
cavestruz/L500analysis | plotting/profiles/T_Vr_evolution/Tnt_Vr_evolution/plot_Tnt_Vr_r200m.py | 1 | 2927 | from L500analysis.data_io.get_cluster_data import GetClusterData
from L500analysis.utils.utils import aexp2redshift
from L500analysis.plotting.tools.figure_formatting import *
from L500analysis.plotting.profiles.tools.profiles_percentile \
import *
from L500analysis.utils.constants import rbins, linear_rbins
from d... | mit |
JackKelly/neuralnilm_prototype | scripts/e515.py | 2 | 6699 | from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectiona... | mit |
yudingding6197/fin_script | debug/my_stock.py | 1 | 3092 | #!/usr/bin/env python
import asyncio
import pandas as pd
import tushare as ts
import requests
from collections import deque
from aiohttp import ClientSession
import json
import re
import sqlite3
ori_url = 'http://web.ifzq.gtimg.cn/appstock/app/fqkline/get?_var=kline_dayqfq2017¶m=%s,day,2017-01-01,20... | gpl-2.0 |
hoburg/gpkit | gpkit/tests/t_examples.py | 1 | 10586 | """Unit testing of tests in docs/source/examples"""
import unittest
import os
import pickle
import numpy as np
from gpkit import settings, Model, Variable
from gpkit.tests.helpers import generate_example_tests
from gpkit.small_scripts import mag
from gpkit.small_classes import Quantity
from gpkit.constraints.loose imp... | mit |
adamrvfisher/TechnicalAnalysisLibrary | RMultipleTracker.py | 1 | 13087 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 11 09:04:55 2018
@author: AmatVictoriaCuramIII
"""
#R Multiple Documentation; Trade Tracking
import numpy as np
import random as rand
import pandas as pd
import time as t
from DatabaseGrabber import DatabaseGrabber
from YahooGrabber import YahooGrabber
##... | apache-2.0 |
morgenst/PyAnalysisTools | PyAnalysisTools/AnalysisTools/MLHelper.py | 1 | 19393 | from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import pickle
import sys
import numpy as np
import pandas as pd
import root_numpy
from builtins import object
from builtins import range
try:
from imblearn import over_sampling
except ImportErro... | mit |
depet/scikit-learn | examples/linear_model/plot_sgd_weighted_classes.py | 9 | 1431 | """
================================================
SGD: Separating hyperplane with weighted classes
================================================
Fit linear SVMs with and without class weighting.
Allows to handle problems with unbalanced classes.
"""
print(__doc__)
import numpy as np
import pylab as pl
from skl... | bsd-3-clause |
TakayukiSakai/tensorflow | tensorflow/contrib/learn/python/learn/estimators/base.py | 1 | 18801 | # 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 |
calum-chamberlain/EQcorrscan | eqcorrscan/tests/install_test.py | 2 | 1067 | """Script to test if all dependencies are installed and running for the \
EQcorrscan package.
"""
import unittest
class TestImport(unittest.TestCase):
def test_import(self):
import sys
if sys.version_info.major == 2:
sys.path.insert(0, '/usr/lib/pyshared/python2.7')
# Insert pa... | gpl-3.0 |
chaluemwut/fbserver | venv/lib/python2.7/site-packages/sklearn/tests/test_lda.py | 14 | 2947 | import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_true
from sklearn import lda
# Data is just... | apache-2.0 |
sinhrks/scikit-learn | examples/linear_model/plot_logistic_multinomial.py | 24 | 2480 | """
====================================================
Plot multinomial and One-vs-Rest Logistic Regression
====================================================
Plot decision surface of multinomial and One-vs-Rest Logistic Regression.
The hyperplanes corresponding to the three One-vs-Rest (OVR) classifiers
are repre... | bsd-3-clause |
xzh86/scikit-learn | sklearn/utils/tests/test_random.py | 230 | 7344 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.misc import comb as combinations
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import sample_without_replacement
from sklearn.utils.random import random_choice_csc
from sklearn.utils.testing import ... | bsd-3-clause |
maropu/spark | python/pyspark/pandas/frame.py | 1 | 427279 | #
# 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 |
vikingMei/mxnet | python/mxnet/model.py | 13 | 41314 | # 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 |
pylhc/PyLHC | tests/unit/test_forced_da_analysis.py | 1 | 2469 | from pathlib import Path
import matplotlib
import pytest
from pylhc.forced_da_analysis import main as fda_analysis
# Forcing non-interactive Agg backend so rendering is done similarly across platforms during tests
matplotlib.use("Agg")
INPUT = Path(__file__).parent.parent / "inputs"
@pytest.mark.cern_network
clas... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.