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 |
|---|---|---|---|---|---|
moutai/scikit-learn | sklearn/linear_model/tests/test_logistic.py | 9 | 39730 | import numpy as np
import scipy.sparse as sp
from scipy import linalg, optimize, sparse
from sklearn.utils.testing import assert_almost_equal
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.util... | bsd-3-clause |
afantrim/epitope_mapping | src/SequentialPairs/PrecisionRecall.py | 1 | 1907 | #!/Users/student/anaconda/bin/python
'''
.. module:: PrecisionRecall
:platform: Unix, Windows
:synopsis: Makes a precision recall plot from the true and false positives.
.. moduleauthor:: Amelia F. Antrim <amelia.f.antrim@gmail.com>
'''
import numpy as np
import pylab as pl
from sklearn import metrics
class ... | gpl-2.0 |
cython-testbed/pandas | pandas/core/api.py | 2 | 2583 |
# pylint: disable=W0614,W0401,W0611
# flake8: noqa
import numpy as np
from pandas.core.algorithms import factorize, unique, value_counts
from pandas.core.dtypes.missing import isna, isnull, notna, notnull
from pandas.core.arrays import Categorical
from pandas.core.groupby import Grouper
from pandas.io.formats.format... | bsd-3-clause |
jlegendary/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 |
dhermes/google-cloud-python | bigquery/setup.py | 2 | 2938 | # Copyright 2018 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 |
LUTAN/tensorflow | tensorflow/examples/tutorials/word2vec/word2vec_basic.py | 28 | 9485 | # 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 |
YihaoLu/statsmodels | statsmodels/miscmodels/try_mlecov.py | 33 | 7414 | '''Multivariate Normal Model with full covariance matrix
toeplitz structure is not exploited, need cholesky or inv for toeplitz
Author: josef-pktd
'''
from __future__ import print_function
import numpy as np
#from scipy import special #, stats
from scipy import linalg
from scipy.linalg import norm, toeplitz
import ... | bsd-3-clause |
simon-pepin/scikit-learn | examples/applications/plot_outlier_detection_housing.py | 243 | 5577 | """
====================================
Outlier detection on a real data set
====================================
This example illustrates the need for robust covariance estimation
on a real data set. It is useful both for outlier detection and for
a better understanding of the data structure.
We selected two sets o... | bsd-3-clause |
mraspaud/dask | dask/array/percentile.py | 2 | 6272 | from __future__ import absolute_import, division, print_function
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
from .. import sharedict
@wraps(np.percentile)
def _percentile(a, q, interpolati... | bsd-3-clause |
Asiant/trump | trump/indexing.py | 1 | 7132 | import inspect
import sys
import pandas as pd
pdDatetimeIndex = pd.tseries.index.DatetimeIndex
pdInt64Index = pd.core.index.Int64Index
pdCoreIndex = pd.core.index.Index
from sqlalchemy import DateTime, Integer, String
import datetime as dt
class IndexImplementer(object):
"""
IndexImplementer is the base r... | bsd-3-clause |
keras-team/keras-io | examples/generative/dcgan_overriding_train_step.py | 1 | 6691 | """
Title: DCGAN to generate face images
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2019/04/29
Last modified: 2021/01/01
Description: A simple DCGAN trained using `fit()` by overriding `train_step` on CelebA images.
"""
"""
## Setup
"""
import tensorflow as tf
from tensorflow import keras
from tens... | apache-2.0 |
dmonllao/moodleinspire-python-backend | moodleinspire/chart.py | 1 | 2542 | """Charts module"""
import os
import numpy as np
from sklearn.learning_curve import learning_curve
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
class LearningCurve(object):
"""scikit-learn Learning curve class"""
def __init__(self, dirname):
self.dirname = dirname
... | gpl-3.0 |
DStauffman/dstauffman | dstauffman/plotting/plotting.py | 1 | 28638 | r"""
Defines useful plotting utilities.
Notes
-----
#. Written by David C. Stauffer in March 2015.
"""
#%% Imports
from __future__ import annotations
import datetime
import doctest
import logging
from pathlib import Path
from typing import List, Optional, Tuple, TypeVar, Union
import unittest
from dstauffman import... | lgpl-3.0 |
quheng/scikit-learn | examples/manifold/plot_compare_methods.py | 259 | 4031 | """
=========================================
Comparison of Manifold Learning methods
=========================================
An illustration of dimensionality reduction on the S-curve dataset
with various manifold learning methods.
For a discussion and comparison of these algorithms, see the
:ref:`manifold module... | bsd-3-clause |
cdawei/digbeta | dchen/music/src/PLGEN2_rank.py | 2 | 2136 | import os
import sys
import gzip
import time
import numpy as np
import pickle as pkl
from sklearn.metrics import roc_auc_score
from MTR import MTR
if len(sys.argv) != 7:
print('Usage: python', sys.argv[0],
'WORK_DIR DATASET C1 C2 C3 TRAIN_DEV(Y/N)')
sys.exit(0)
else:
work_dir = sys.argv[1]
... | gpl-3.0 |
shaneknapp/spark | python/pyspark/worker.py | 13 | 28222 | #
# 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 |
simontorres/goodman | goodman_pipeline/spectroscopy/redspec.py | 1 | 22670 | #!/usr/bin/env python2
# -*- coding: utf8 -*-
"""Pipeline for Goodman High Troughput Spectrograph spectra Extraction.
This program finds reduced images, i.e. trimmed, bias subtracted, flat fielded,
etc. that match the ``<pattern>`` in the source folder, then classify them in
two groups: Science or Lamps. For science i... | bsd-3-clause |
zrhans/python | exemplos/Examples.lnk/bokeh/glyphs/anscombe.py | 6 | 2961 | from __future__ import print_function
import numpy as np
import pandas as pd
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle, Line
from bokeh.models import (
ColumnDataSource, Grid, GridPlot, LinearAxis, Plot, Range1d
)... | gpl-2.0 |
TomAugspurger/pandas | pandas/tests/extension/base/getitem.py | 1 | 14195 | import numpy as np
import pytest
import pandas as pd
from .base import BaseExtensionTests
class BaseGetitemTests(BaseExtensionTests):
"""Tests for ExtensionArray.__getitem__."""
def test_iloc_series(self, data):
ser = pd.Series(data)
result = ser.iloc[:4]
expected = pd.Series(data[:... | bsd-3-clause |
chantera/blstm-cws | app/libs/tools.py | 1 | 13027 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from collections.abc import Iterable, Iterator, Sequence
from operator import itemgetter
import re
import numpy as np
class Tokenizer(metaclass=ABCMeta):
@abstractmethod
def tokenize(self, document):
raise NotImpl... | mit |
github4ry/pathomx | pathomx/plugins/spectra/spectra_exclude.py | 2 | 1688 | import numpy as np
import pandas as pd
if input_data is None:
raise Exception('No input data')
if type(input_data.columns) == pd.Index or type(input_data.columns) == pd.Float64Index:
scale = input_data.columns.values.tolist()
elif type(input_data.columns) == pd.MultiIndex:
for cn in ['ppm', 'Scale', 'Labe... | gpl-3.0 |
sunshinelover/chanlun | vn.trader/ctaAlgo/strategyAtrRsi.py | 1 | 10872 | # encoding: UTF-8
"""
一个ATR-RSI指标结合的交易策略,适合用在股指的1分钟和5分钟线上。
注意事项:
1. 作者不对交易盈利做任何保证,策略代码仅供参考
2. 本策略需要用到talib,没有安装的用户请先参考www.vnpy.org上的教程安装
3. 将IF0000_1min.csv用ctaHistoryData.py导入MongoDB后,直接运行本文件即可回测策略
"""
from ctaBase import *
from ctaTemplate import CtaTemplate
import talib
import numpy as np
###################... | mit |
andrebrener/crypto_predictor | get_coin_names.py | 1 | 1925 | # =============================================================================
# File: get_coin_names.py
# Author: Andre Brener
# Created: 17 Jun 2017
# Last Modified: 23 Sep 2017
# Description: description
# =============================================================================
import r... | mit |
WangWenjun559/Weiss | summary/sumy/sklearn/feature_selection/tests/test_feature_select.py | 143 | 22295 | """
Todo: cross-check the F-value with stats model
"""
from __future__ import division
import itertools
import warnings
import numpy as np
from scipy import stats, sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_raises... | apache-2.0 |
frank-tancf/scikit-learn | sklearn/cluster/birch.py | 18 | 22732 | # 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 |
andnovar/ggplot | ggplot/stats/stat_function.py | 12 | 4439 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import pandas as pd
from ggplot.utils import make_iterable_ntimes
from ggplot.utils.exceptions import GgplotError
from .stat import stat
class stat_function(stat):
"""
Superimpose a... | bsd-2-clause |
ky822/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 |
CINPLA/expipe-dev | python-neo/examples/generated_data.py | 5 | 4828 | # -*- coding: utf-8 -*-
"""
This is an example for creating simple plots from various Neo structures.
It includes a function that generates toy data.
"""
from __future__ import division # Use same division in Python 2 and 3
import numpy as np
import quantities as pq
from matplotlib import pyplot as plt
import neo
... | gpl-3.0 |
francis-liberty/kaggle | BioResponse/Benchmarks/svm_benchmark.py | 1 | 1268 | #!/usr/bin/env python
from sklearn import svm
from sklearn import cross_validation
import evalfun
import numpy as np
def main():
# train = csv_io.read_data("../Data/train.csv")
# target = [x[0] for x in train]
# train = [x[1:] for x in train]
# test = csv_io.read_data("../Data/test.csv")
dataset = np... | gpl-2.0 |
soulmachine/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 |
swkrueger/Thrifty | thrifty/detect_analysis.py | 1 | 31004 | """Like detect.py, but plots stuff."""
from __future__ import division
from __future__ import print_function
import argparse
import sys
import re
from collections import namedtuple
from matplotlib.backend_bases import key_press_handler
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from ... | gpl-3.0 |
robbymeals/scikit-learn | sklearn/metrics/pairwise.py | 104 | 42995 | # -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Robert Layton <robertlayton@gmail.com>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Philippe Gervais <philippe.gervais@inria.fr>
# Lars Buitinck ... | bsd-3-clause |
drusk/pml | pml/utils/pandas_util.py | 1 | 3729 | # Copyright (C) 2012 David Rusk
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distr... | mit |
mugizico/scikit-learn | examples/decomposition/plot_pca_3d.py | 354 | 2432 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Principal components analysis (PCA)
=========================================================
These figures aid in illustrating how a point cloud
can be very flat in one direction--which is where PCA
comes in to ch... | bsd-3-clause |
bthirion/scikit-learn | sklearn/datasets/svmlight_format.py | 41 | 16768 | """This module implements a loader and dumper for the svmlight format
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable to
predict.
This format is used as the... | bsd-3-clause |
sanjayankur31/nest-simulator | pynest/examples/vinit_example.py | 8 | 3081 | # -*- coding: utf-8 -*-
#
# vinit_example.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, ... | gpl-2.0 |
volk0ff/fred | graph/fred_graph.py | 1 | 1442 | import requests
import pandas as pd
import os
def fred_grapher(search_text):
url = 'http://api.stlouisfed.org/fred/series/search'
request_params = {'search_text': search_text,
'api_key':'82101274da6dbda5de2d568e76b9d6a4',
'file_type':'json',
'limit':'10', #default value of number of search results ... | mit |
nomadcube/scikit-learn | sklearn/utils/tests/test_utils.py | 215 | 8100 | import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import pinv2
from itertools import chain
from sklearn.utils.testing import (assert_equal, assert_raises, assert_true,
assert_almost_equal, assert_array_equal,
SkipTest, ... | bsd-3-clause |
nmayorov/scikit-learn | examples/covariance/plot_sparse_cov.py | 300 | 5078 | """
======================================
Sparse inverse covariance estimation
======================================
Using the GraphLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matrix, t... | bsd-3-clause |
bbfamily/abu | abupy/UmpBu/ABuUmpMainBase.py | 1 | 72264 | # -*- encoding:utf-8 -*-
"""
主裁基础实现模块
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import copy
from abc import abstractmethod
import math
from ..MarketBu import ABuMarketDrawing
from ..CoreBu import ABuEnv
import logging
import matplo... | gpl-3.0 |
MBARIMike/stoqs | stoqs/contrib/analysis/classify.py | 3 | 21623 | #!/usr/bin/env python
"""
Script to execute steps in the classification of measurements including:
1. Labeling specific MeasuredParameters
2. Tagging MeasuredParameters based on a model
Mike McCann
MBARI 16 June 2014
"""
import os
import sys
# Insert Django App directory (parent of config) into python path
sys.pat... | gpl-3.0 |
conversationai/wikidetox | experimental/conversation_go_awry/get_annotation_data/get_annotation_test_data.py | 1 | 8076 | """
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | apache-2.0 |
wzbozon/statsmodels | statsmodels/tsa/filters/tests/test_filters.py | 27 | 41409 | from datetime import datetime
import numpy as np
from numpy.testing import (assert_almost_equal, assert_equal, assert_allclose,
assert_raises, assert_)
from numpy import array, column_stack
from statsmodels.datasets import macrodata
from statsmodels.tsa.base.datetools import dates_from_range
... | bsd-3-clause |
hooram/ownphotos-backend | api/bench.py | 1 | 10303 | from api.models import Photo, Face, AlbumDate, Person
from django.db.models import Prefetch
from api.serializers_serpy import AlbumDateListWithPhotoHashSerializer as AlbumDateListWithPhotoHashSerializerSerpy
from api.serializers import AlbumDateListWithPhotoHashSerializer as AlbumDateListWithPhotoHashSerializer
import... | mit |
wmvanvliet/mne-python | mne/stats/tests/test_cluster_level.py | 8 | 30263 | # Authors: Eric Larson <larson.eric.d@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
from functools import partial
import os
import numpy as np
from scipy import sparse, linalg, stats
from numpy.testing import (assert_equal, assert_array_equal,
... | bsd-3-clause |
3manuek/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 |
ibm-research-ireland/sparkoscope | python/setup.py | 10 | 9500 | #!/usr/bin/env python
#
# 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 "Li... | apache-2.0 |
linebp/pandas | pandas/tests/scalar/test_timestamp.py | 3 | 56106 | """ test the scalar Timestamp """
import sys
import pytz
import pytest
import dateutil
import operator
import calendar
import numpy as np
from dateutil.tz import tzutc
from pytz import timezone, utc
from datetime import datetime, timedelta
from distutils.version import LooseVersion
from pytz.exceptions import Ambiguo... | bsd-3-clause |
xavierwu/scikit-learn | sklearn/utils/tests/test_utils.py | 215 | 8100 | import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import pinv2
from itertools import chain
from sklearn.utils.testing import (assert_equal, assert_raises, assert_true,
assert_almost_equal, assert_array_equal,
SkipTest, ... | bsd-3-clause |
oemof/oemof_examples | oemof_examples/oemof.solph/v0.4.x/basic_example/basic_example_tuple_as_label.py | 1 | 10532 | # -*- coding: utf-8 -*-
"""
General description
-------------------
You should have understood the basic_example to understand this one.
This is an example to show how the label attribute can be used with tuples to
manage the results of large energy system. Even though, the feature is
introduced in a small example i... | gpl-3.0 |
abhishekkrthakur/scikit-learn | examples/mixture/plot_gmm.py | 248 | 2817 | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two Gaussians with EM
and variational Dirichlet process.
Both models have access to five components with which to fit the
data. Note that the EM model will necessari... | bsd-3-clause |
wanggang3333/scikit-learn | examples/cluster/plot_affinity_propagation.py | 349 | 2304 | """
=================================================
Demo of affinity propagation clustering algorithm
=================================================
Reference:
Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages
Between Data Points", Science Feb. 2007
"""
print(__doc__)
from sklearn.cluster impor... | bsd-3-clause |
mikaem/spectralDNS | sandbox/cheb_biharmonic.py | 2 | 5718 | from numpy.polynomial import chebyshev as n_cheb
from sympy import chebyshevt, Symbol, sin, cos, pi, exp, lambdify, sqrt as Sqrt
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import solve_banded, lu_factor, lu_solve
from scipy.sparse import diags
import scipy.sparse.linalg as la
from spectralDNS.... | gpl-3.0 |
mcdeaton13/dynamic | Data/Calibration/DepreciationParameters/Program/data_class.py | 2 | 3852 | '''
-------------------------------------------------------------------------------
Last updated 3/19/2015
-------------------------------------------------------------------------------
This py-file defines objects that will be used to keep track of all the data
pertinent to depreciation rates. Specifically, these... | mit |
ben-hopps/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/pyplot.py | 69 | 77521 | import sys
import matplotlib
from matplotlib import _pylab_helpers, interactive
from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike
from matplotlib.figure import Figure, figaspect
from matplotlib.backend_bases import FigureCanvasBase
from matplotlib.image import imread as _imread
from matplotl... | agpl-3.0 |
saketkc/statsmodels | statsmodels/distributions/empirical_distribution.py | 11 | 5045 | """
Empirical CDF Functions
"""
import numpy as np
from scipy.interpolate import interp1d
def _conf_set(F, alpha=.05):
r"""
Constructs a Dvoretzky-Kiefer-Wolfowitz confidence band for the eCDF.
Parameters
----------
F : array-like
The empirical distributions
alpha : float
Set a... | bsd-3-clause |
makism/dyfunconn | examples/python_comodulogram.py | 1 | 2452 |
# coding: utf-8
# In[1]:
#get_ipython().magic(u'matplotlib inline')
# In[2]:
import os
import numpy as np
np.set_printoptions(precision=3, linewidth=250)
import scipy as sp
from scipy import signal, io
import pandas as pd
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
import matplotlib.... | bsd-3-clause |
zegnus/self-driving-car-machine-learning | p05-vehicle-detection/lesson_functions.py | 2 | 11796 | from classes import *
import matplotlib.image as mpimg
import numpy as np
import cv2
from skimage.feature import hog
def add_heat(heatmap, bbox_list):
# Iterate through list of bboxes
for box in bbox_list:
# Add += 1 for all pixels inside each bbox
# Assuming each "box" takes the form ((x1, y1... | mit |
jasonabele/gnuradio | gr-utils/src/python/gr_plot_psd.py | 5 | 11977 | #!/usr/bin/env python
#
# Copyright 2007,2008 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your opt... | gpl-3.0 |
ilo10/scikit-learn | sklearn/kernel_ridge.py | 155 | 6545 | """Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <mathieu@mblondel.org>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from .base import BaseEstimator, RegressorMixin
from .metrics.pairwise import pairwise... | bsd-3-clause |
soulmachine/scikit-learn | sklearn/cluster/mean_shift_.py | 15 | 12344 | """Mean shift clustering algorithm.
Mean shift clustering aims to discover *blobs* in a smooth density of
samples. It is a centroid based algorithm, which works by updating candidates
for centroids to be the mean of the points within a given region. These
candidates are then filtered in a post-processing stage to elim... | bsd-3-clause |
igara432/lightfm | tests/utils.py | 11 | 2205 | import numpy as np
from sklearn.metrics import roc_auc_score
def precision_at_k(model, ground_truth, k, user_features=None, item_features=None):
"""
Measure precision at k for model and ground truth.
Arguments:
- lightFM instance model
- sparse matrix ground_truth (no_users, no_items)
- int ... | apache-2.0 |
MatthieuBizien/scikit-learn | sklearn/ensemble/tests/test_iforest.py | 9 | 6928 | """
Testing for Isolation Forest algorithm (sklearn.ensemble.iforest).
"""
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.u... | bsd-3-clause |
kcavagnolo/astroML | book_figures/chapter7/fig_spec_examples.py | 3 | 2725 | """
SDSS spectra Examples
---------------------
Figure 7.1
A sample of 15 galaxy spectra selected from the SDSS spectroscopic data set
(see Section 1.5.5). These spectra span a range of galaxy types, from
star-forming to passive galaxies. Each spectrum has been shifted to its rest
frame and covers the wavelength inter... | bsd-2-clause |
kubeflow/kfp-tekton | samples/titanic-ml-dataset/titanic-ml.py | 1 | 40561 | import json
import kfp.dsl as _kfp_dsl
import kfp.components as _kfp_components
from collections import OrderedDict
from kubernetes import client as k8s_client
def loaddata():
from kale.common import mlmdutils as _kale_mlmdutils
_kale_mlmdutils.init_metadata()
_kale_block1 = '''
import numpy as np
... | apache-2.0 |
TomAugspurger/pandas | pandas/tests/indexes/timedeltas/test_scalar_compat.py | 1 | 4482 | """
Tests for TimedeltaIndex methods behaving like their Timedelta counterparts
"""
import numpy as np
import pytest
import pandas as pd
from pandas import Index, Series, Timedelta, TimedeltaIndex, timedelta_range
import pandas._testing as tm
class TestVectorizedTimedelta:
def test_tdi_total_seconds(self):
... | bsd-3-clause |
kumkee/SURF2016 | src/marketdata/pricematrices.py | 1 | 4922 | import globalpricematrix as gpm
import numpy as np
FAKE_DEFLATION_FACTOR = 1.5
MIN_NUM_PERIOD = 3
class PriceMatrices(gpm.GlobalPriceMatrix):
def __init__(self, start = gpm.YEAR, end = gpm.NOW, period = gpm.HALF_HOUR, csv = None, coin_filter = 0.2, \
window_size = 30, train_portion = 0... | gpl-3.0 |
kdebrab/pandas | pandas/io/clipboard/clipboards.py | 7 | 4244 | import subprocess
from .exceptions import PyperclipException
from pandas.compat import PY2, text_type
EXCEPT_MSG = """
Pyperclip could not find a copy/paste mechanism for your system.
For more information, please visit https://pyperclip.readthedocs.org """
def init_osx_clipboard():
def copy_osx(text):
... | bsd-3-clause |
chbrown/tsa | tsa/analyses/hashtag_replacement.py | 1 | 5994 | from collections import Counter
import numpy as np
from viz.geom import hist
import pandas as pd
from sklearn import cross_validation, metrics
from sklearn import linear_model
from sklearn.feature_extraction.text import CountVectorizer
from tsa.lib import cache
from tsa.lib.itertools import Quota
from tsa.science ... | mit |
0x0all/scikit-learn | sklearn/metrics/tests/test_regression.py | 31 | 3010 | from __future__ import division, print_function
import numpy as np
from itertools import product
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.metri... | bsd-3-clause |
rseubert/scikit-learn | sklearn/preprocessing/data.py | 4 | 39855 | # 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>
# License: BSD 3 clause
from itertools import chain, combinations
import numbers
import numpy as np
f... | bsd-3-clause |
pratapvardhan/scikit-learn | sklearn/feature_selection/tests/test_base.py | 143 | 3670 | import numpy as np
from scipy import sparse as sp
from nose.tools import assert_raises, assert_equal
from numpy.testing import assert_array_equal
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.utils import check_array
class StepSelector(SelectorMixin, Ba... | bsd-3-clause |
siutanwong/scikit-learn | examples/cluster/plot_kmeans_assumptions.py | 270 | 2040 | """
====================================
Demonstration of k-means assumptions
====================================
This example is meant to illustrate situations where k-means will produce
unintuitive and possibly unexpected clusters. In the first three plots, the
input data does not conform to some implicit assumptio... | bsd-3-clause |
PythonCharmers/bokeh | bokeh/sampledata/periodic_table.py | 45 | 1542 | '''
This module provides the periodic table as a data set. It exposes an attribute 'elements'
which is a pandas dataframe with the following fields
elements['atomic Number'] (units: g/cm^3)
elements['symbol']
elements['name']
elements['atomic mass'] (units: amu)
elements['CPK'] ... | bsd-3-clause |
bsipocz/statsmodels | statsmodels/examples/tut_ols_ancova.py | 33 | 2455 | '''Examples OLS
Note: uncomment plt.show() to display graphs
Summary:
========
Relevant part of construction of design matrix
xg includes group numbers/labels,
x1 is continuous explanatory variable
>>> dummy = (xg[:,None] == np.unique(xg)).astype(float)
>>> X = np.c_[x1, dummy[:,1:], np.ones(nsample)]
Estimate the... | bsd-3-clause |
Tobychev/tardis | tardis/atomic.py | 2 | 25864 | # atomic model
import os
import logging
import cPickle as pickle
from collections import OrderedDict
import h5py
import numpy as np
import pandas as pd
from scipy import interpolate
from astropy import table, units, constants
from pandas import DataFrame
class AtomDataNotPreparedError(Exception):
pass
logger ... | bsd-3-clause |
ywcui1990/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/delaunay/interpolate.py | 73 | 7068 | import numpy as np
from matplotlib._delaunay import compute_planes, linear_interpolate_grid, nn_interpolate_grid
from matplotlib._delaunay import nn_interpolate_unstructured
__all__ = ['LinearInterpolator', 'NNInterpolator']
def slice2gridspec(key):
"""Convert a 2-tuple of slices to start,stop,steps for x and y.... | agpl-3.0 |
ThomasBrouwer/BNMTF | experiments/experiments_gdsc/convergence/nmtf_vb.py | 1 | 61894 | """
Run NMTF VB on the Sanger dataset.
We can plot the MSE, R2 and Rp as it converges, on the entire dataset.
We give flat priors (1/10).
"""
import sys, os
project_location = os.path.dirname(__file__)+"/../../../../"
sys.path.append(project_location)
from BNMTF.code.models.bnmtf_vb_optimised import bnmtf_vb_optimi... | apache-2.0 |
codyhan94/epidemic-graph-inference | scripts/learnedunlearned.py | 1 | 3508 | """This is a general file used to test the basic functionality of our system"""
from __future__ import print_function
from pdb import set_trace
import networkx as nx
import matplotlib.pyplot as plt
import math
import numpy as np
import sys
import os
sys.path.append(os.getcwd())
# CONSTANTS
graphfile = "data/gnp.gra... | mit |
rhyolight/nupic.research | projects/sequence_prediction/continuous_sequence/data/processNN5dataset.py | 13 | 1874 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 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 progra... | gpl-3.0 |
Ziqi-Li/bknqgis | pandas/pandas/tests/groupby/test_counting.py | 10 | 6573 | # -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
from pandas import (DataFrame, Series, MultiIndex)
from pandas.util.testing import assert_series_equal
from pandas.compat import (range, product as cart_product)
class TestCounting(object):
def test_cumcount(self):
df = Da... | gpl-2.0 |
pbrusco/ml-eeg | ml/results_processing.py | 1 | 3411 | # coding: utf-8
import numpy as np
from sklearn import metrics
from . import utils
import pandas
def calculate_measures(results, measures):
processed_result = {}
supports = []
for (measure_name, measure_function) in measures:
measure_result, pvalue, support = apply_measure(results, measure_func... | gpl-3.0 |
chrjxj/zipline | zipline/examples/buyapple.py | 11 | 2079 | #!/usr/bin/env python
#
# Copyright 2014 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | apache-2.0 |
hammerlab/mhcflurry | mhcflurry/select_pan_allele_models_command.py | 1 | 12421 | """
Model select class1 pan-allele models.
APPROACH: For each training fold, we select at least min and at most max models
(where min and max are set by the --{min/max}-models-per-fold argument) using a
step-up (forward) selection procedure. The final ensemble is the union of all
selected models across all folds.
"""
... | apache-2.0 |
LGZ-T/llvm-pred | scripts/drawline.py | 4 | 1283 | #!/usr/bin/python3
import argparse
from os import mkdir,path
from matplotlib import pyplot as plt
import re
def parse_one_line(line):
ar=line.split('\t')
isConstant=ar[0][:8]=='Constant'
end=ar[0].find(')')
count=int(ar[0][9:end])
#remove last \n
compact=tuple(ar[1].split(',')[:-1])
x=0
... | gpl-3.0 |
ndingwall/scikit-learn | examples/calibration/plot_calibration_curve.py | 24 | 5902 | """
==============================
Probability Calibration curves
==============================
When performing classification one often wants to predict not only the class
label, but also the associated probability. This probability gives some
kind of confidence on the prediction. This example demonstrates how to di... | bsd-3-clause |
wogsland/QSTK | Bin/Data_CSV.py | 5 | 3301 | #File to read the data from mysql and push into CSV.
# Python imports
import datetime as dt
import csv
import copy
import os
import pickle
# 3rd party imports
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# QSTK imports
from QSTK.qstkutil import qsdateutil as du
import QSTK.qstkutil.DataEvol... | bsd-3-clause |
reuk/wayverb | bin/fitted_boundary/graphs.py | 2 | 1624 | #!/usr/local/bin/python
import numpy as np
import matplotlib
render = True
if render:
matplotlib.use('pgf')
import matplotlib.pyplot as plt
import scipy.signal as signal
import json
import os.path
from paths import *
USE_DB_AXES = True
CUTOFF = 0.196
def a2db(a):
return 20 * np.log10(a)
def frequency_plot... | gpl-2.0 |
leylabmpi/pyTecanFluent | pyTecanFluent/Map2Robot.py | 1 | 30410 | from __future__ import print_function
# import
## batteries
import os
import re
import sys
import argparse
import functools
from itertools import product,cycle
## 3rd party
import numpy as np
import pandas as pd
## package
from pyTecanFluent import Utils
from pyTecanFluent import Fluent
from pyTecanFluent import Labwar... | mit |
acrsilva/animated-zZz-machine | pruebas/clustering.py | 1 | 1151 | """
# -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
from scipy.cluster.hierarchy import dendrogram, linkage
import numpy as np
from scipy.cluster.hierarchy import cophenet
from scipy.spatial.distance import pdist
csv = np.genfromtxt ('../data.csv', delimiter=",")
a = csv[:300,8]
b = csv[:300,26]
X = np.... | lgpl-3.0 |
calebfoss/tensorflow | tensorflow/examples/learn/multiple_gpu.py | 11 | 3086 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 |
ShawnMurd/MetPy | src/metpy/plots/declarative.py | 1 | 59000 | # Copyright (c) 2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Declarative plotting tools."""
from datetime import datetime, timedelta
try:
import cartopy.crs as ccrs
DEFAULT_LAT_LON = ccrs.PlateCarree()
except ImportError:
... | bsd-3-clause |
fabioticconi/scikit-learn | sklearn/feature_selection/tests/test_base.py | 143 | 3670 | import numpy as np
from scipy import sparse as sp
from nose.tools import assert_raises, assert_equal
from numpy.testing import assert_array_equal
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.utils import check_array
class StepSelector(SelectorMixin, Ba... | bsd-3-clause |
beepee14/scikit-learn | examples/semi_supervised/plot_label_propagation_structure.py | 247 | 2432 | """
==============================================
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 |
wschenck/nest-simulator | pynest/examples/intrinsic_currents_subthreshold.py | 12 | 8348 | # -*- coding: utf-8 -*-
#
# intrinsic_currents_subthreshold.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 ... | gpl-2.0 |
baliga-lab/cmonkey2 | test/datamatrix_test.py | 1 | 23380 | """datamatrix_test.py - test classes for datamatrix module
This file is part of cMonkey Python. Please see README and LICENSE for
more information and licensing details.
"""
import unittest
import copy
import cmonkey.datamatrix as dm
import numpy as np
import cmonkey.util as util
import os
import pandas
class DataMa... | lgpl-3.0 |
DonBeo/statsmodels | statsmodels/graphics/correlation.py | 7 | 7705 | '''correlation plots
Author: Josef Perktold
License: BSD-3
example for usage with different options in
statsmodels\sandbox\examples\thirdparty\ex_ratereturn.py
'''
import numpy as np
from . import utils
def plot_corr(dcorr, xnames=None, ynames=None, title=None, normcolor=False,
ax=None, cmap='RdYlBu... | bsd-3-clause |
rhyswhitley/flux_learner | src/learn_fluxnet.py | 1 | 1398 | #!/usr/bin/env python3
import os
import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.pipeline import make_pipeline
from sklearn.tree import DecisionTreeRegressor
from sklearn.cross_val... | cc0-1.0 |
Achuth17/scikit-learn | sklearn/externals/joblib/parallel.py | 29 | 28665 | """
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
import os
import sys
import gc
import warnings
from collections import Sized
from math import sqrt
import functools
import time
import thread... | bsd-3-clause |
rexshihaoren/scikit-learn | sklearn/ensemble/weight_boosting.py | 30 | 40648 | """Weight Boosting
This module contains weight boosting estimators for both classification and
regression.
The module structure is the following:
- The ``BaseWeightBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regression and classification
only differ from each ot... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.