repo_name stringlengths 7 90 | path stringlengths 5 191 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 976 581k | license stringclasses 15
values |
|---|---|---|---|---|---|
zuku1985/scikit-learn | sklearn/tests/test_naive_bayes.py | 72 | 19944 | import pickle
from io import BytesIO
import numpy as np
import scipy.sparse
from sklearn.datasets import load_digits, load_iris
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert... | bsd-3-clause |
rmcgibbo/scipy | scipy/signal/ltisys.py | 38 | 76123 | """
ltisys -- a collection of classes and functions for modeling linear
time invariant systems.
"""
from __future__ import division, print_function, absolute_import
#
# Author: Travis Oliphant 2001
#
# Feb 2010: Warren Weckesser
# Rewrote lsim2 and added impulse2.
# Aug 2013: Juan Luis Cano
# Rewrote abcd_normaliz... | bsd-3-clause |
jmuhlich/indra | models/ras_220_genes/check_cached_dois.py | 1 | 5714 | import csv
import pickle
from collections import Counter
import plot_formatting as pf
from matplotlib import pyplot as plt
from texttable import Texttable
pf.set_fig_params()
pmid_map = {}
with open('pmid_pmcid_doi_map.txt') as f:
csvreader = csv.reader(f, delimiter='\t')
for row in csvreader:
doi = ... | bsd-2-clause |
xuewei4d/scikit-learn | sklearn/decomposition/tests/test_truncated_svd.py | 11 | 7203 | """Test truncated SVD transformer."""
import numpy as np
import scipy.sparse as sp
import pytest
from sklearn.decomposition import TruncatedSVD, PCA
from sklearn.utils import check_random_state
from sklearn.utils._testing import assert_array_less, assert_allclose
SVD_SOLVERS = ['arpack', 'randomized']
@pytest.fix... | bsd-3-clause |
wkfwkf/statsmodels | statsmodels/datasets/fertility/data.py | 26 | 2511 | #! /usr/bin/env python
"""World Bank Fertility Data."""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This data is distributed according to the World Bank terms of use. See SOURCE."""
TITLE = """World Bank Fertility Data"""
SOURCE = """
This data has been acquired from
The World Bank: Fertility rat... | bsd-3-clause |
napjon/moocs_solution | Data_Science/lesson_3/gradient_descent/gradient_descent.py | 1 | 2429 | import numpy
import pandas
def normalize_features(array):
"""
Normalize the features in our data set.
"""
array_normalized = (array - array.mean())/array.std()
mu = array.mean()
sigma = array.std()
return array_normalized, mu, sigma
def compute_cost(features, values, theta):
"""
... | mit |
CroatianMeteorNetwork/CMN-codes | triangulation/FF_bin_suite.py | 1 | 49348 | # coding=utf-8
# Copyright 2014 Denis Vida, denis.vida@gmail.com
# The FF_bin_suite 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, version 2.
# The FF_bin_suite is distributed in the hope that it will be
# ... | gpl-2.0 |
bobbymckinney/hall_measurement | program_roomtemp/RT_HallEffectGUIv1.py | 1 | 92196 | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Created: 2015-03-31
@author: Bobby McKinney (bobbymckinney@gmail.com)
__Title__ : voltagepanel
Description:
Comments:
"""
import os
import sys
import wx
from wx.lib.pubsub import pub # For communicating b/w the thread and the GUI
import matplotlib
matplotlib.interactive(... | gpl-3.0 |
rvraghav93/scikit-learn | sklearn/metrics/__init__.py | 8 | 3701 | """
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... | bsd-3-clause |
ufbmi/onefl-deduper | scripts/extract_existing_linkage_data.py | 1 | 4873 | #!/usr/bin/env python
"""
Goal: Extract existing linkage data from the database
Usage:
$ python extract_existing_linkage_data.py
or
$ python extract_existing_linkage_data.py -lnk (extract linked rows only)
@authors:
Andrei Sura <sura.andrei@gmail.com>
"""
# flake8: noqa
import argparse
import os
impor... | mit |
huongttlan/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 |
ningchi/scikit-learn | examples/linear_model/plot_ransac.py | 250 | 1673 | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | bsd-3-clause |
TomAugspurger/pandas | pandas/compat/numpy/__init__.py | 1 | 1834 | """ support numpy compatibility across versions """
from distutils.version import LooseVersion
import re
import numpy as np
# numpy versioning
_np_version = np.__version__
_nlv = LooseVersion(_np_version)
_np_version_under1p16 = _nlv < LooseVersion("1.16")
_np_version_under1p17 = _nlv < LooseVersion("1.17")
_np_vers... | bsd-3-clause |
jblackburne/scikit-learn | examples/missing_values.py | 71 | 3055 | """
======================================================
Imputing missing values before building an estimator
======================================================
This example shows that imputing the missing values can give better results
than discarding the samples containing any missing value.
Imputing does not ... | bsd-3-clause |
AlexRobson/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 |
mattgiguere/doglodge | code/document_classification_20newsgroups1.py | 14 | 10406 | """
======================================================
Classification of text documents using sparse features
======================================================
This is an example showing how scikit-learn can be used to classify documents
by topics using a bag-of-words approach. This example uses a scipy.spars... | mit |
yavalvas/yav_com | build/matplotlib/lib/matplotlib/_mathtext_data.py | 11 | 90077 | """
font data tables for truetype and afm computer modern fonts
"""
# this dict maps symbol names to fontnames, glyphindex. To get the
# glyph index from the character code, you have to use get_charmap
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import ... | mit |
smartscheduling/scikit-learn-categorical-tree | examples/applications/plot_model_complexity_influence.py | 323 | 6372 | """
==========================
Model Complexity Influence
==========================
Demonstrate how model complexity influences both prediction accuracy and
computational performance.
The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for
regression (resp. classification).
For each class of models we m... | bsd-3-clause |
madsmpedersen/MMPE | io/mysql.py | 1 | 8906 | '''
Created on 27/06/2013
@author: Mads M. Pedersen (mmpe@dtu.dk)
usage:
with MySqlReader(server="10.40.20.10", database="poseidon", username='mmpe', password='password') as reader:
print (reader.tables())
'''
from mmpe.functions.deep_coding import to_str
from mmpe.functions.timing import print_time
import war... | apache-2.0 |
lbishal/scikit-learn | sklearn/cluster/tests/test_hierarchical.py | 230 | 19795 | """
Several basic tests for hierarchical clustering procedures
"""
# Authors: Vincent Michel, 2010, Gael Varoquaux 2012,
# Matteo Visconti di Oleggio Castello 2014
# License: BSD 3 clause
from tempfile import mkdtemp
import shutil
from functools import partial
import numpy as np
from scipy import sparse
from... | bsd-3-clause |
iismd17/scikit-learn | examples/linear_model/plot_ols_ridge_variance.py | 387 | 2060 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... | bsd-3-clause |
mehdidc/scikit-learn | sklearn/manifold/locally_linear.py | 21 | 24928 | """Locally Linear Embedding"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) INRIA 2011
import numpy as np
from scipy.linalg import eigh, svd, qr, solve
from scipy.sparse import eye, csr_matrix
from ..base import B... | bsd-3-clause |
sinhrks/scikit-learn | sklearn/tests/test_metaestimators.py | 57 | 4958 | """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 |
BiaDarkia/scikit-learn | examples/ensemble/plot_gradient_boosting_regularization.py | 68 | 2848 | """
================================
Gradient Boosting regularization
================================
Illustration of the effect of different regularization strategies
for Gradient Boosting. The example is taken from Hastie et al 2009 [1]_.
The loss function used is binomial deviance. Regularization via
shrinkage (`... | bsd-3-clause |
sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axis3d.py | 9 | 17055 | #!/usr/bin/python
# axis3d.py, original mplot3d version by John Porter
# Created: 23 Sep 2005
# Parts rewritten by Reinier Heeres <reinier@heeres.eu>
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import math
import copy
from matplotlib import... | mit |
humdings/zipline | zipline/examples/momentum_pipeline.py | 7 | 2696 | """
A simple Pipeline algorithm that longs the top 3 stocks by RSI and shorts
the bottom 3 each day.
"""
from six import viewkeys
from zipline.api import (
attach_pipeline,
date_rules,
order_target_percent,
pipeline_output,
record,
schedule_function,
)
from zipline.pipeline import Pipeline
from ... | apache-2.0 |
vybstat/scikit-learn | benchmarks/bench_multilabel_metrics.py | 276 | 7138 | #!/usr/bin/env python
"""
A comparison of multilabel target formats and metrics over them
"""
from __future__ import division
from __future__ import print_function
from timeit import timeit
from functools import partial
import itertools
import argparse
import sys
import matplotlib.pyplot as plt
import scipy.sparse as... | bsd-3-clause |
altair-viz/altair | altair/vegalite/v4/schema/channels.py | 1 | 300285 | # The contents of this file are automatically written by
# tools/generate_schema_wrapper.py. Do not modify directly.
from . import core
import pandas as pd
from altair.utils.schemapi import Undefined
from altair.utils import parse_shorthand
class FieldChannelMixin(object):
def to_dict(self, validate=True, ignore... | bsd-3-clause |
RobertABT/heightmap | build/matplotlib/lib/matplotlib/tests/test_triangulation.py | 2 | 37456 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
import matplotlib.delaunay as mdel
from nose.tools import assert_equal
from numpy.testing import assert_array_equal, assert_array_almost_equal,\
assert_array_less
from matplotlib.testing.decorators import image_comparison
import matplo... | mit |
johnmwalters/ThinkStats2 | code/hinc.py | 67 | 1494 | """This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import numpy as np
import pandas
import thinkplot
import thinkstats2
def Clean(s):... | gpl-3.0 |
ContinuumIO/blaze | blaze/expr/collections.py | 3 | 26662 | from __future__ import absolute_import, division, print_function
import numbers
import numpy as np
from functools import partial
from itertools import chain
import datashape
from datashape import (
DataShape,
Fixed,
Option,
Record,
Unit,
Var,
dshape,
object_,
promote,
var,
)
fr... | bsd-3-clause |
mdigiorgio/lisa | libs/utils/perf_analysis.py | 2 | 6952 | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, 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 |
kipohl/ncanda-data-integration | scripts/reporting/generate_adni_phantom_plots.py | 2 | 2042 | #!/usr/bin/env python
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
"""
Generate a plot of the SNR across NCANDA sites.
"""
__author__ = "Nolan Nichols"
import os
import glob
import dateutil
import pandas as pd
import lxml.etree as etree... | bsd-3-clause |
beni55/hyperopt | hyperopt/tests/test_tpe.py | 7 | 23399 | from functools import partial
import os
import unittest
import nose
import numpy as np
try:
import matplotlib.pyplot as plt
except ImportError:
pass
from hyperopt import pyll
from hyperopt.pyll import scope
from hyperopt import Trials
from hyperopt.base import miscs_to_idxs_vals, STATUS_OK
from hyperopt i... | bsd-3-clause |
ch3ll0v3k/scikit-learn | sklearn/neighbors/tests/test_kd_tree.py | 129 | 7848 | import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors.kd_tree import (KDTree, NeighborsHeap,
simultaneous_sort, kernel_norm,
nodeheap_sort, DTYPE, ITYPE)
from sklearn.neighbors.dist_metrics import Dista... | bsd-3-clause |
sheridancbio/cbioportal | core/src/main/scripts/downloadChromosomeSizes.py | 5 | 1043 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 11 14:40:04 2020
@author: Sander Rodenburg, The Hyve
"""
from pandas import DataFrame, read_csv
import json
from sys import argv, exit
if len(argv) == 1:
outfile = 'importer/chromosome_sizes.json'
elif len(argv) == 2:
outfile = argv[1]
els... | agpl-3.0 |
louisLouL/pair_trading | capstone_env/lib/python3.6/site-packages/pandas/core/series.py | 6 | 99587 | """
Data structure for 1-dimensional cross-sectional and time series data
"""
from __future__ import division
# pylint: disable=E1101,E1103
# pylint: disable=W0703,W0622,W0613,W0201
import types
import warnings
from textwrap import dedent
from numpy import nan, ndarray
import numpy as np
import numpy.ma as ma
from ... | mit |
camroach87/pr1c3_f0r3c457 | tests/exploreData.py | 1 | 3484 | # Title: Explore Data
# Description: A little script to figure out how to use python and also what the data looks like.
__author__ = "Cameron Roach"
#import csv as csv
import pandas as pd
import numpy as np
import pylab as P
import matplotlib.pyplot as plt
plt.style.use('ggplot')
from datetime import datetime
# Load... | mit |
fbagirov/scikit-learn | sklearn/covariance/tests/test_covariance.py | 142 | 11068 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_alm... | bsd-3-clause |
pnedunuri/scikit-learn | sklearn/linear_model/bayes.py | 220 | 15248 | """
Various bayesian regression
"""
from __future__ import print_function
# Authors: V. Michel, F. Pedregosa, A. Gramfort
# License: BSD 3 clause
from math import log
import numpy as np
from scipy import linalg
from .base import LinearModel
from ..base import RegressorMixin
from ..utils.extmath import fast_logdet, p... | bsd-3-clause |
mtat76/atm-py | atmPy/for_removal/POPS/serial.py | 6 | 1715 | import numpy as np
import pandas as pd
from atmPy.atmos import timeseries
from atmPy.aerosols.size_distr import sizedistribution
from atmPy.for_removal.POPS import calibration
from atmPy.tools import time_tools
def read_radiosonde_csv(fname, cal):
"""reads a csv file and returns a TimeSeries
Par... | mit |
bharcode/MachineLearning | commons_ml/Multinomial_Logistic_regression/Scripts/multinomial_logistic_regression.py | 2 | 3985 | #!/usr/bin/env python
# multinomial_logistic_regression.py
# Author : Saimadhu Polamuri
# Date: 05-May-2017
# About: Multinomial logistic regression model implementation
import pandas as pd
import numpy as np
from sklearn import linear_model
from sklearn import metrics
from sklearn.cross_validation import train_test_s... | gpl-2.0 |
hzh8311/project | ptsemseg/loggers.py | 1 | 4366 | # A simple torch style logger
# (C) Wei YANG 2017
from __future__ import absolute_import
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
__all__ = ['Logger', 'LoggerMonitor', 'savefig']
def savefig(fname, dpi=None):
dpi = 150 if dpi == None else dpi
plt.savefig(fname, dpi=dpi)
def pl... | mit |
ampproject/amp-github-apps | project-metrics/metrics_service/metric_plot.py | 1 | 2601 | import datetime
import logging
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
from typing import Sequence, Tuple
import io
from database import db
from database import models
from metrics import base as base_metric
class MetricHistoryPlotter(object):
"""Plots metric results over the... | apache-2.0 |
mjgrav2001/scikit-learn | sklearn/utils/tests/test_linear_assignment.py | 421 | 1349 | # Author: Brian M. Clapper, G Varoquaux
# License: BSD
import numpy as np
# XXX we should be testing the public API here
from sklearn.utils.linear_assignment_ import _hungarian
def test_hungarian():
matrices = [
# Square
([[400, 150, 400],
[400, 450, 600],
[300, 225, 300]],
... | bsd-3-clause |
madelynfreed/rlundo | venv/lib/python2.7/site-packages/IPython/core/tests/refbug.py | 28 | 1543 | """Minimal script to reproduce our nasty reference counting bug.
The problem is related to https://github.com/ipython/ipython/issues/141
The original fix for that appeared to work, but John D. Hunter found a
matplotlib example which, when run twice in a row, would break. The problem
were references held by open figu... | gpl-3.0 |
adamrvfisher/TechnicalAnalysisLibrary | ModADXAdviceOptimizer.py | 1 | 2129 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 12 20:05:59 2017
@author: AmatVictoriaCuramIII
"""
import numpy as np
import pandas as pd
import time as t
import random as rand
iterations = range(0,1900000)
s = pd.read_pickle('RUTModADXAGGAdviceColumn94_07')
s = s.drop('Regime',1)
s = s.drop('Strategy',1... | apache-2.0 |
fw1121/bcbio-nextgen | scripts/utils/analyze_complexity_by_starts.py | 11 | 2952 | import argparse
import os
from bcbio.rnaseq import qc
from collections import Counter
import bcbio.bam as bam
import bcbio.utils as utils
from itertools import ifilter
import bcbio.pipeline.datadict as dd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def count_duplicate_starts(bam_file, sam... | mit |
ch3ll0v3k/scikit-learn | examples/classification/plot_digits_classification.py | 289 | 2397 | """
================================
Recognizing hand-written digits
================================
An example showing how the scikit-learn can be used to recognize images of
hand-written digits.
This example is commented in the
:ref:`tutorial section of the user manual <introduction>`.
"""
print(__doc__)
# Autho... | bsd-3-clause |
tseaver/gcloud-python | monitoring/tests/unit/test__dataframe.py | 3 | 8363 | # Copyright 2016 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, s... | apache-2.0 |
lin-credible/scikit-learn | sklearn/cluster/birch.py | 207 | 22706 | # Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Joel Nothman <joel.nothman@gmail.com>
# License: BSD 3 clause
from __future__ import division
import warnings
import numpy as np
from scipy import sparse
from math import sqrt
fro... | bsd-3-clause |
bibsian/database-development | test/logiclayer/datalayer/scratch.py | 1 | 3190 | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import (
select, update, MetaData, create_engine, Table, column)
from sqlalchemy.orm import sessionmaker, relationship
import pandas as pd
import pprint as pp
engine = create_engine(
'postgresql+psycopg2://lter:bigdata@45.55.241.186/popler... | mit |
snowdj/research_public | template_algorithms/long_short_equity_template_non_price_factor.py | 2 | 10446 | """This algorithm demonstrates the concept of long-short equity.
It combines two fundamental factors and a sentiment factor to rank equities in our universe.
It then longs the top of the ranking and shorts the bottom.
For information on long-short equity strategies, please see the corresponding lecture on our lecture... | apache-2.0 |
rishikksh20/scikit-learn | doc/sphinxext/sphinx_gallery/notebook.py | 25 | 6032 | # -*- coding: utf-8 -*-
r"""
============================
Parser for Jupyter notebooks
============================
Class that holds the Jupyter notebook information
"""
# Author: Óscar Nájera
# License: 3-clause BSD
from __future__ import division, absolute_import, print_function
from functools import partial
impor... | bsd-3-clause |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/widgets/menu.py | 1 | 4958 | """
====
Menu
====
"""
from __future__ import division, print_function
import numpy as np
import matplotlib
import matplotlib.colors as colors
import matplotlib.patches as patches
import matplotlib.mathtext as mathtext
import matplotlib.pyplot as plt
import matplotlib.artist as artist
import matplotlib.image as image
... | mit |
grain2011/vislab | vislab/datasets/imagenet.py | 4 | 3924 | """
ImageNet classification and detection challenges.
Everything loaded from files, and images distributed with dataset.
"""
import os
import pandas as pd
import glob
import scipy.io
import networkx as nx
import numpy as np
import multiprocessing
import vislab
from vislab.datasets.pascal import load_annotation_files
... | bsd-2-clause |
bestwpw/BDA_py_demos | demos_ch6/demo6_3.py | 19 | 1544 | """Bayesian Data Analysis, 3rd ed
Chapter 6, demo 3
Posterior predictive checking
Light speed example with a poorly chosen test statistic
"""
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
# edit default plot settings (colours from colorbrewer2.org)
plt.rc('font', size=14)
plt.rc... | gpl-3.0 |
PrincessMadMath/LOG8415-Advanced_Cloud | TP1/Sources/plot_disk.py | 1 | 1261 | import matplotlib.pyplot as pyplot
import numpy
# inspired by http://people.duke.edu/~ccc14/pcfb/numpympl/MatplotlibBarPlots.html
xTickMarks = ["azure A1", "azure A4", "amazon T2", "amazon C4", "amazon M4", "amazon R4"]
N = 6
disk_cached_reads = [3966.54, 4329.98, 9974.22, 11489.85, 9990.05, 9950.078]
disk_buffered_d... | mit |
tomasreimers/tensorflow-emscripten | tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py | 12 | 15286 | # 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 |
nikitasingh981/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 |
mschmidt87/nest-simulator | extras/ConnPlotter/colormaps.py | 21 | 6941 | # -*- coding: utf-8 -*-
#
# colormaps.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 the License, or
#... | gpl-2.0 |
hammerlab/immuno_research | Mar18_no_mincount.py | 1 | 3792 | # Copyright (c) 2014. Mount Sinai School of Medicine
#
# 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 o... | gpl-2.0 |
RJTK/dwglasso_cweeds | src/conf.py | 1 | 1694 | '''
This is the config file for the code in src/. Essentially it
holds things like file and variable names.
'''
# The folder locations of the below files are specified by the
# cookie cutter data science format and are hardcoded into the code.
# I'm not entirely sure that that was the best way to go about it,
# but t... | mit |
cwu2011/scikit-learn | examples/feature_selection/plot_rfe_with_cross_validation.py | 226 | 1384 | """
===================================================
Recursive feature elimination with cross-validation
===================================================
A recursive feature elimination example with automatic tuning of the
number of features selected with cross-validation.
"""
print(__doc__)
import matplotlib.p... | bsd-3-clause |
TaikiGoto/master | ch06/overfit_dropout.py | 3 | 1542 | # coding: utf-8
import os
import sys
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
import matplotlib.pyplot as plt
from dataset.mnist import load_mnist
from common.multi_layer_net_extend import MultiLayerNetExtend
from common.trainer import Trainer
(x_train, t_train), (x_test, t_test) = lo... | mit |
shahankhatch/scikit-learn | sklearn/tests/test_common.py | 70 | 7717 | """
General tests for all estimators in sklearn.
"""
# Authors: Andreas Mueller <amueller@ais.uni-bonn.de>
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
from __future__ import print_function
import os
import warnings
import sys
import pkgutil
from sklearn.externals.six import PY3
fr... | bsd-3-clause |
adykstra/mne-python | examples/decoding/plot_decoding_spatio_temporal_source.py | 5 | 4725 | """
.. _tut_dec_st_source:
==========================
Decoding source space data
==========================
Decoding to MEG data in source space on the left cortical surface. Here
univariate feature selection is employed for speed purposes to confine the
classification to a small number of potentially relevant featur... | bsd-3-clause |
hh-italian-group/hh-bbtautau | Studies/python/MassWindow.py | 1 | 5204 | import math
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import find_peaks
import ROOT
ROOT.gInterpreter.ProcessLine("""
using LorentzVectorXYZ = ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>;
using LorentzVectorM = ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>>;
using Lo... | gpl-2.0 |
PmagPy/PmagPy | programs/plot_magmap_basemap.py | 2 | 3937 | #!/usr/bin/env python
# define some variables
from __future__ import print_function
from builtins import str
import numpy as np
import sys
import matplotlib
if matplotlib.get_backend() != "TKAgg":
matplotlib.use("TKAgg")
import pylab as plt
from pylab import meshgrid
import pmagpy.pmag as pmag
has_basemap, Basemap ... | bsd-3-clause |
iulian787/spack | var/spack/repos/builtin/packages/py-umi-tools/package.py | 5 | 1429 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyUmiTools(PythonPackage):
"""Tools for handling Unique Molecular Identifiers in NGS data ... | lgpl-2.1 |
cngo-github/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/transforms.py | 69 | 75638 | """
matplotlib includes a framework for arbitrary geometric
transformations that is used determine the final position of all
elements drawn on the canvas.
Transforms are composed into trees of :class:`TransformNode` objects
whose actual value depends on their children. When the contents of
children change, their pare... | agpl-3.0 |
shiaki/iterative-modelling | src/cps_plot.py | 1 | 10023 |
import numpy as np
import adapt_hist
import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
import matplotlib.colorbar as cbar
from mpl_toolkits.axes_grid1 import make_axes_locatable
valfc_num = lambda idx, arg: float(idx.size)
valfc_mean = lambda idx, arg: np.mean(arg[idx])
valfc_std = lambda idx, arg:... | bsd-3-clause |
mattilyra/scikit-learn | examples/linear_model/plot_lasso_model_selection.py | 311 | 5431 | """
===================================================
Lasso model selection: Cross-Validation / AIC / BIC
===================================================
Use the Akaike information criterion (AIC), the Bayes Information
criterion (BIC) and cross-validation to select an optimal value
of the regularization paramet... | bsd-3-clause |
fabianp/scikit-learn | examples/ensemble/plot_gradient_boosting_regression.py | 227 | 2520 | """
============================
Gradient Boosting regression
============================
Demonstrate Gradient Boosting on the Boston housing dataset.
This example fits a Gradient Boosting model with least squares loss and
500 regression trees of depth 4.
"""
print(__doc__)
# Author: Peter Prettenhofer <peter.prett... | bsd-3-clause |
mbakker7/timml | timml/linesink.py | 1 | 48454 | import numpy as np
import matplotlib.pyplot as plt
import inspect # Used for storing the input
from .element import Element
from .equation import HeadEquation, PotentialEquation
from .besselaesnumba import besselaesnumba
besselaesnumba.initialize()
try:
from .src import besselaesnew
besselaesnew.besselaesnew.i... | mit |
hanyassasa87/ns3-802.11ad | src/flow-monitor/examples/wifi-olsr-flowmon.py | 2 | 7536 | # -*- Mode: Python; -*-
# Copyright (c) 2009 INESC Porto
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
#... | gpl-2.0 |
brev/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/finance.py | 69 | 20558 | """
A collection of modules for collecting, analyzing and plotting
financial data. User contributions welcome!
"""
#from __future__ import division
import os, time, warnings
from urllib import urlopen
try:
from hashlib import md5
except ImportError:
from md5 import md5 #Deprecated in 2.5
try: import dateti... | agpl-3.0 |
ewmoore/numpy | numpy/linalg/linalg.py | 1 | 62914 | """Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | bsd-3-clause |
Midafi/scikit-image | doc/examples/plot_tinting_grayscale_images.py | 3 | 5338 | """
=========================
Tinting gray-scale images
=========================
It can be useful to artificially tint an image with some color, either to
highlight particular regions of an image or maybe just to liven up a grayscale
image. This example demonstrates image-tinting by scaling RGB values and by
adjustin... | bsd-3-clause |
bnaul/scikit-learn | sklearn/_build_utils/min_dependencies.py | 2 | 2230 | """All minimum dependencies for scikit-learn."""
import platform
import argparse
# numpy scipy and cython should by in sync with pyproject.toml
if platform.python_implementation() == 'PyPy':
SCIPY_MIN_VERSION = '1.1.0'
NUMPY_MIN_VERSION = '1.14.0'
else:
SCIPY_MIN_VERSION = '0.19.1'
NUMPY_MIN_VERSION =... | bsd-3-clause |
SHTOOLS/SHTOOLS | pyshtools/shclasses/slepiancoeffs.py | 2 | 13000 | """
Class for Slepian expansion coefficients.
"""
import numpy as _np
import copy as _copy
from .. import shtools as _shtools
from .shcoeffs import SHCoeffs
from .shgrid import SHGrid
__all__ = ['SlepianCoeffs']
class SlepianCoeffs(object):
"""
Class for Slepian expansion coefficients.
The Slepia... | bsd-3-clause |
alexandrebarachant/Grasp-and-lift-EEG-challenge | ensembling/WeightedMean.py | 4 | 3347 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 14:12:12 2015.
@author: rc, alex
"""
import numpy as np
from collections import OrderedDict
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.metrics import roc_auc_score
from hyperopt import fmin, tpe, hp
from progressbar import Bar, ETA, Percentag... | bsd-3-clause |
lancezlin/ml_template_py | lib/python2.7/site-packages/IPython/core/shellapp.py | 7 | 16199 | # encoding: utf-8
"""
A mixin for :class:`~IPython.core.application.Application` classes that
launch InteractiveShell instances, load extensions, etc.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import absolute_import
from __future__ import ... | mit |
seymour1/Kaggle | caterpillar-tube-pricing/xgboost-222.py | 1 | 4519 | #forked from Gilberto Titericz Junior
import pandas as pd
import numpy as np
from sklearn import ensemble, preprocessing
import xgboost as xgb
# load training and test datasets
train = pd.read_csv('data/train_set.csv', parse_dates=[2,])
test = pd.read_csv('data/test_set.csv', parse_dates=[3,])
tube_data = pd.read_cs... | bsd-3-clause |
Solid-Mechanics/matplotlib-4-abaqus | matplotlib/legend.py | 4 | 37050 | """
The legend module defines the Legend class, which is responsible for
drawing legends associated with axes and/or figures.
The Legend class can be considered as a container of legend handles
and legend texts. Creation of corresponding legend handles from the
plot elements in the axes or figures (e.g., lines, patche... | mit |
arhik/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qt4agg.py | 70 | 4985 | """
Render to qt from agg
"""
from __future__ import division
import os, sys
import matplotlib
from matplotlib.figure import Figure
from backend_agg import FigureCanvasAgg
from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
show, draw_if_interactive, backend_version, \
NavigationToolba... | agpl-3.0 |
saketkc/statsmodels | statsmodels/tsa/base/tests/test_datetools.py | 28 | 5620 | from datetime import datetime
import numpy.testing as npt
from statsmodels.tsa.base.datetools import (_date_from_idx,
_idx_from_dates, date_parser, date_range_str, dates_from_str,
dates_from_range, _infer_freq, _freq_to_pandas)
from pandas import DatetimeIndex, PeriodIndex
def test_date... | bsd-3-clause |
xhochy/arrow | python/pyarrow/parquet.py | 1 | 74846 | # 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 |
xavierwu/scikit-learn | sklearn/metrics/tests/test_pairwise.py | 71 | 25104 | import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | bsd-3-clause |
niltonlk/nest-simulator | pynest/nest/raster_plot.py | 15 | 9348 | # -*- coding: utf-8 -*-
#
# raster_plot.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 the License, or... | gpl-2.0 |
shoyer/xarray | xarray/coding/cftimeindex.py | 1 | 25724 | """DatetimeIndex analog for cftime.datetime objects"""
# The pandas.Index subclass defined here was copied and adapted for
# use with cftime.datetime objects based on the source code defining
# pandas.DatetimeIndex.
# For reference, here is a copy of the pandas copyright notice:
# (c) 2011-2012, Lambda Foundry, Inc. ... | apache-2.0 |
zrhans/python | exemplos/Examples.lnk/bokeh/plotting/server/elements.py | 2 | 1506 | # The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
import pandas as pd
from bokeh.plotting import *
from bokeh.sampledata import periodic_table
elements = periodic_table.elements
elements = elements[elements["atomic number"] <= 82]
elements = elements[~pd.isnull(elements["melting... | gpl-2.0 |
glouppe/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 |
trungnt13/scikit-learn | examples/bicluster/bicluster_newsgroups.py | 162 | 7103 | """
================================================================
Biclustering documents with the Spectral Co-clustering algorithm
================================================================
This example demonstrates the Spectral Co-clustering algorithm on the
twenty newsgroups dataset. The 'comp.os.ms-windows... | bsd-3-clause |
dhruv13J/scikit-learn | sklearn/feature_selection/variance_threshold.py | 238 | 2594 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: 3-clause BSD
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstim... | bsd-3-clause |
fredhusser/scikit-learn | sklearn/tests/test_kernel_approximation.py | 244 | 7588 | import numpy as np
from scipy.sparse import csr_matrix
from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true
from sklearn.utils.testing import assert_not_equal
from sklearn.utils.testing import assert_array_almost_equal, assert_raises
from sklearn.utils.testing import assert_less_equal
from ... | bsd-3-clause |
dsquareindia/scikit-learn | examples/svm/plot_svm_kernels.py | 96 | 2019 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
SVM-Kernels
=========================================================
Three different types of SVM-Kernels are displayed below.
The polynomial and RBF are especially useful when the
data-points are not linearly sep... | bsd-3-clause |
Groovy-Dragon/tcRIP | ML_Li_AA.py | 1 | 10440 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 9 16:28:16 2017
@author: lewismoffat
"""
#==============================================================================
# IMPORTS
#==============================================================================
import dataProcessing as dp
import sklearn as sk
import nu... | mit |
dpshelio/scikit-image | doc/examples/plot_rank_mean.py | 17 | 1499 | """
============
Mean filters
============
This example compares the following mean filters of the rank filter package:
* **local mean**: all pixels belonging to the structuring element to compute
average gray level.
* **percentile mean**: only use values between percentiles p0 and p1
(here 10% and 90%).
* *... | bsd-3-clause |
WangSii/python | python.py | 1 | 2880 | import random
import matplotlib.pyplot as plt
import time
def sujishengcheng(jieshu): #数据生成。输入阶数,返回相应大小的矩3
shuzu=[]
i=0
a=0
while(i<jieshu):
a=0
linshi=[]
while(a<jieshu):
linshi.append(round(random.randint(0,1)))
a=a+1
shuzu.append(linshi)
i=... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.