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 |
|---|---|---|---|---|---|
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 |
awickert/river-network-evolution | AGU2016_test1.py | 1 | 3544 | import numpy as np
from scipy.sparse import spdiags, block_diag
from scipy.sparse.linalg import spsolve, isolve
from matplotlib import pyplot as plt
import copy
import time
import ThreeChannels_generalizing
reload(ThreeChannels_generalizing)
r = ThreeChannels_generalizing.rnet()
self = r
plt.ion()
# PER RIVER #
#... | gpl-3.0 |
Zhenxingzhang/AnalyticsVidhya | LoanPrediction/scripts/xgb.py | 2 | 1801 | import pandas as pd
import numpy as np
import xgboost as xgb
train_data_df = pd.read_csv('train.csv')
test_data_df = pd.read_csv('test.csv')
train_data_df.columns = ['Gender','Married','Dependents','Education','Self_Employed','ApplicantIncome','CoapplicantIncome','LoanAmount','Loan_Amount_Term','Credit_History','Prop... | apache-2.0 |
idc9/law-net | code/stats/linear_model.py | 1 | 2062 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
def get_SLR(X, Y, to_plot=True, xlabel='', ylabel=''):
"""
Plots LS fit for Simple Linear Regression
Parameters
----------
X, Y: regression variables (lists)
Output
------
plot: scatte... | mit |
samuel1208/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 |
466152112/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 |
kiyoto/statsmodels | statsmodels/tsa/statespace/tests/test_varmax.py | 2 | 30250 | """
Tests for VARMAX models
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import pandas as pd
import os
import re
import warnings
from statsmodels.datasets import webuse
from statsmodels.tsa.statespace import varmax
from .results i... | bsd-3-clause |
dsquareindia/scikit-learn | examples/neighbors/plot_digits_kde_sampling.py | 108 | 2026 | """
=========================
Kernel Density Estimation
=========================
This example shows how kernel density estimation (KDE), a powerful
non-parametric density estimation technique, can be used to learn
a generative model for a dataset. With this generative model in place,
new samples can be drawn. These... | bsd-3-clause |
mrustl/flopy | flopy/utils/datafile.py | 1 | 17018 | """
Module to read MODFLOW output files. The module contains shared
abstract classes that should not be directly accessed.
"""
from __future__ import print_function
import os
import numpy as np
import flopy.utils
class Header(object):
"""
The header class is an abstract base class to create hea... | bsd-3-clause |
zuku1985/scikit-learn | examples/svm/plot_svm_nonlinear.py | 268 | 1091 | """
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn imp... | bsd-3-clause |
eusi/MissionPlanerHM | Lib/site-packages/numpy/lib/twodim_base.py | 70 | 23431 | """ Basic functions for manipulating 2d arrays
"""
__all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu',
'tril','vander','histogram2d','mask_indices',
'tril_indices','tril_indices_from','triu_indices','triu_indices_from',
]
from numpy.core.numeric import asanyarr... | gpl-3.0 |
raghavrv/scikit-learn | examples/covariance/plot_mahalanobis_distances.py | 33 | 6232 | r"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dis... | bsd-3-clause |
superPershing/pygrimm | temp/temp_for_3_28.py | 1 | 1466 | '''
do some clean things
this data contains dirty datas whose date is 3-22, we have to clean them.
'''
import pandas as pd
df = pd.read_csv('2017-03-28-C.csv')
df1 = pd.read_csv('2017-03-28-dM.csv')
df2 = pd.read_csv('2017-03-28-M.csv')
df3 = pd.read_csv('2017-03-28-L.csv')
df_1 = pd.read_csv('2017-03-29-C.csv')
df1_... | gpl-3.0 |
466152112/scikit-learn | sklearn/neighbors/tests/test_neighbors.py | 103 | 41083 | from itertools import product
import numpy as np
from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix,
dok_matrix, lil_matrix)
from sklearn.cross_validation import train_test_split
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | bsd-3-clause |
kashif/scikit-learn | examples/semi_supervised/plot_label_propagation_structure.py | 45 | 2433 | """
==============================================
Label Propagation learning a complex structure
==============================================
Example of LabelPropagation learning a complex internal structure
to demonstrate "manifold learning". The outer circle should be
labeled "red" and the inner circle "blue". Be... | bsd-3-clause |
sergiohgz/incubator-airflow | scripts/perf/scheduler_ops_metrics.py | 10 | 6773 | # -*- 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 this file
# to you under the Apache License, Version 2.0 (the
#... | apache-2.0 |
mxjl620/scikit-learn | benchmarks/bench_plot_omp_lars.py | 266 | 4447 | """Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
regression (:ref:`least_angle_regression`)
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model impo... | bsd-3-clause |
yukoba/sympy | examples/intermediate/sample.py | 107 | 3494 | """
Utility functions for plotting sympy functions.
See examples\mplot2d.py and examples\mplot3d.py for usable 2d and 3d
graphing functions using matplotlib.
"""
from sympy.core.sympify import sympify, SympifyError
from sympy.external import import_module
np = import_module('numpy')
def sample2d(f, x_args):
"""
... | bsd-3-clause |
ProkopHapala/SimpleSimulationEngine | python/pyRay/image.py | 1 | 1332 | #!/usr/bin/python
import os
import re
import numpy as np
import matplotlib.pyplot as plt
def getDiffuse( hitn, light_dir ):
return hitn[:,:,0]*light_dir[0] + hitn[:,:,1]*light_dir[1] + hitn[:,:,2]*light_dir[2]
def getSpecular( hitn, light_dir, rd, gloss=256.0, power=2 ):
slr = light_dir[None,None,... | mit |
resba/gnuradio | gr-digital/examples/example_costas.py | 17 | 4430 | #!/usr/bin/env python
from gnuradio import gr, digital
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
try:
import scipy
except ImportError:
print "Error: could not import scipy (http://www.scipy.org/)"
sys.exit(1)
try:
import pylab
excep... | gpl-3.0 |
nhuntwalker/astroML | book_figures/chapter6/fig_stellar_XD.py | 3 | 8233 | """
Extreme Deconvolution of Stellar Data
-------------------------------------
Figure 6.12
Extreme deconvolution applied to stellar data from SDSS Stripe 82. The top
panels compare the color distributions for a high signal-to-noise sample of
standard stars (left) with lower signal-to-noise, single epoch, data (right)... | bsd-2-clause |
mjgrav2001/scikit-learn | sklearn/decomposition/tests/test_online_lda.py | 12 | 11592 | import numpy as np
from scipy.sparse import csr_matrix
from scipy.linalg import block_diag
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from skl... | bsd-3-clause |
zfrenchee/pandas | pandas/tests/test_resample.py | 1 | 138388 | # pylint: disable=E1101
from warnings import catch_warnings
from datetime import datetime, timedelta
from functools import partial
from textwrap import dedent
from operator import methodcaller
import pytz
import pytest
import dateutil
import numpy as np
import pandas as pd
import pandas.tseries.offsets as offsets
im... | bsd-3-clause |
GGoussar/scikit-image | doc/ext/sphinx_gallery/gen_rst.py | 6 | 22697 | # -*- coding: utf-8 -*-
# Author: Óscar Nájera
# License: 3-clause BSD
"""
==================
RST file generator
==================
Generate the rst files for the examples by iterating over the python
example files.
Files that generate images should start with 'plot'
"""
# Don't use unicode_literals here (be explici... | bsd-3-clause |
EmilienDupont/cs229project | similarityItem.py | 1 | 2924 | import data
import numpy as np
import scipy.sparse
import scipy.sparse.linalg
from sklearn.preprocessing import normalize
import sys
import time
# python similarity.py ../../../../../data/train_triplets.txt 10000 ../../../../../data/eval/year1_test_triplets_visible.txt ../../../../../data/eval/year1_test_triplets_hidd... | mit |
cjayb/mne-python | tutorials/preprocessing/plot_45_projectors_background.py | 9 | 22444 | # -*- coding: utf-8 -*-
"""
.. _tut-projectors-background:
Background on projectors and projections
========================================
This tutorial provides background information on projectors and Signal Space
Projection (SSP), and covers loading and saving projectors, adding and removing
projectors from Raw ... | bsd-3-clause |
GuessWhoSamFoo/pandas | pandas/core/indexes/base.py | 1 | 184596 | from datetime import datetime, timedelta
import operator
from textwrap import dedent
import warnings
import numpy as np
from pandas._libs import (
Timedelta, algos as libalgos, index as libindex, join as libjoin, lib,
tslibs)
from pandas._libs.lib import is_datetime_array
import pandas.compat as compat
from p... | bsd-3-clause |
pnedunuri/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 |
soltys/ZUT_Algorytmy_Eksploracji_Danych | NativeBayesClassificator/app.py | 1 | 2566 | from __future__ import division
# -*- coding: utf-8 -*-
__author__ = 'Paweł Sołtysiak'
import pandas as pd
import scipy.io.arff as arff
from sklearn import cross_validation
import numpy as np
class MyBayes:
def __init__(self, laplace=False):
self.class_to_test = ''
self.all_types = []
sel... | mit |
mdeemer/XlsxWriter | examples/pandas_chart_line.py | 9 | 1739 | ##############################################################################
#
# An example of converting a Pandas dataframe to an xlsx file with a line
# chart using Pandas and XlsxWriter.
#
# Copyright 2013-2015, John McNamara, jmcnamara@cpan.org
#
import pandas as pd
import random
# Create some sample data to pl... | bsd-2-clause |
stefanv/selective-inference | selection/algorithms/tests/test_forward_step.py | 1 | 8482 | import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
from selection.algorithms.lasso import instance
from selection.algorithms.forward_step import forward_stepwise, info_crit_stop, sequential, data_carving_IC
def test_FS(k=10):
n, p = 100, 200
X = np.random.standard_normal((n,p)) + ... | bsd-3-clause |
nmartensen/pandas | pandas/tests/indexing/test_panel.py | 7 | 7477 | import pytest
from warnings import catch_warnings
import numpy as np
from pandas.util import testing as tm
from pandas import Panel, date_range, DataFrame
class TestPanel(object):
def test_iloc_getitem_panel(self):
with catch_warnings(record=True):
# GH 7189
p = Panel(np.arange(... | bsd-3-clause |
Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/numpy/lib/recfunctions.py | 148 | 35012 | """
Collection of utilities to manipulate structured arrays.
Most of these functions were initially implemented by John Hunter for
matplotlib. They have been rewritten and extended for convenience.
"""
from __future__ import division, absolute_import, print_function
import sys
import itertools
import numpy as np
im... | agpl-3.0 |
brentp/clustermodel | scripts/gen-commands.py | 1 | 2730 | """
script to generate a bunch of bash/bsub commands so we can run all possible
methods on a cluster in order to compare them.
"""
import os
import sys
import pandas as pd
import numpy as np
np.random.seed(42)
def shuffle_expr(fexpr):
"""
break the relation between expression and methylation.
"""
df =... | bsd-3-clause |
kaichogami/scikit-learn | sklearn/metrics/ranking.py | 4 | 27716 | """Metrics to assess performance on classification task given scores
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.... | bsd-3-clause |
waterponey/scikit-learn | sklearn/metrics/pairwise.py | 8 | 46732 | # -*- 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 |
mhue/scikit-learn | sklearn/tests/test_pipeline.py | 162 | 14875 | """
Test the pipeline module.
"""
import numpy as np
from scipy import sparse
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_raises, assert_raises_regex, assert_raise_message
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn... | bsd-3-clause |
LohithBlaze/scikit-learn | sklearn/neighbors/classification.py | 106 | 13987 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl>
# Multi-output support by ... | bsd-3-clause |
yonglehou/scikit-learn | sklearn/cluster/tests/test_k_means.py | 132 | 25860 | """Testing for K-means"""
import sys
import numpy as np
from scipy import sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing i... | bsd-3-clause |
TEAM-HRA/hra_suite | HRAPrograms/src/hra_programs/console/usage/schema_for_single_recording.py | 1 | 33253 | #!/usr/bin/env python
# coding: utf-8
'''
Created on Nov 26, 2013
@author: jurek
'''
import sys
import matplotlib
#matplotlib.use('GTK')
import matplotlib.pyplot as plt
import numpy as np
import pylab as pl
import Image
import matplotlib.image as mpimg
import matplotlib.gridspec as gridspec
from matplotlib.path imp... | lgpl-3.0 |
massmutual/scikit-learn | examples/svm/plot_separating_hyperplane.py | 294 | 1273 | """
=========================================
SVM: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a Support Vector Machine classifier with
linear kernel.
"""
print(__doc__)
import numpy as np
impor... | bsd-3-clause |
akunze3/pytrajectory | examples/ex7_ConstrainedInvertedPendulum.py | 1 | 2962 | '''
This example of the inverted pendulum demonstrates how to handle possible state constraints.
'''
# import all we need for solving the problem
from pytrajectory import ControlSystem
import numpy as np
from sympy import cos, sin
# first, we define the function that returns the vectorfield
def f(x,u):
x1, x2, x3... | bsd-3-clause |
Jerryzcn/Mmani | Mmani/utils/validation.py | 1 | 14104 | """Utilities for input validation"""
# Author: James McQueen.
#
# Edited the sklearn version by:
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
im... | bsd-2-clause |
brclark-usgs/flopy | examples/Testing/flopy3_CrossSectionExample.py | 3 | 3478 | import sys
import os
import platform
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors
import flopy
#Set name of MODFLOW exe
# assumes executable is in users path statement
version = 'mf2005'
exe_name = 'mf2005'
if platform.system() == 'Windows':
exe_name = 'mf2005.exe'
mfexe = exe_name... | bsd-3-clause |
JazzeYoung/VeryDeepAutoEncoder | pylearn2/models/independent_multiclass_logistic.py | 44 | 2491 | """
Multiclass-classification by taking the max over a set of one-against-rest
logistic classifiers.
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googleg... | bsd-3-clause |
elenanst/HPOlib | HPOlib/Plotting/plotParam.py | 2 | 10905 | #!/usr/bin/env python
##
# wrapping: A program making it easy to use hyperparameter
# optimization software.
# Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | gpl-3.0 |
qPCR4vir/orange3 | Orange/evaluation/clustering.py | 17 | 5430 | import numpy as np
from sklearn.metrics import silhouette_score, adjusted_mutual_info_score, silhouette_samples
from Orange.data import Table
from Orange.evaluation.testing import Results
from Orange.evaluation.scoring import Score
__all__ = ['ClusteringEvaluation']
class ClusteringResults(Results):
def __init... | bsd-2-clause |
cajal/cell_detector | aod_cells/bernoulli.py | 1 | 11712 | import os
import numpy as np
import theano as th
from matplotlib import pyplot as plt
from scipy.optimize import minimize
import theano as th
from collections import OrderedDict
from scipy.ndimage import convolve1d
floatX = th.config.floatX
T = th.tensor
import theano.tensor.nnet.conv3d2d
from scipy.special import bet... | mit |
kcavagnolo/astroML | book_figures/chapter5/fig_cauchy_mcmc.py | 3 | 4996 | """
MCMC for the Cauchy distribution
--------------------------------
Figure 5.22
Markov chain monte carlo (MCMC) estimates of the posterior pdf for parameters
describing the Cauchy distribution. The data are the same as those used in
figure 5.10: the dashed curves in the top-right panel show the results of
direct com... | bsd-2-clause |
pianomania/scikit-learn | sklearn/datasets/lfw.py | 15 | 18695 | """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 |
wlamond/scikit-learn | examples/decomposition/plot_image_denoising.py | 1 | 5957 | """
=========================================
Image denoising using dictionary learning
=========================================
An example comparing the effect of reconstructing noisy fragments
of a raccoon face image using firstly online :ref:`DictionaryLearning` and
various transform methods.
The dictionary is fi... | bsd-3-clause |
Kalinova/Dyn_models | ADC_MCMC/ADC_MCMC_linear.py | 1 | 27467 | '''
####################################################################################################
Acknowledgments to paper: Kalinova et al. 2016, MNRAS
"The inner mass distribution of late-type spiral galaxies from SAURON stellar kinematic maps".
Copyright (c) 2016, Veselina Kalinova, Dario Colombo, Erik Rosolo... | mit |
schets/scikit-learn | sklearn/utils/tests/test_murmurhash.py | 261 | 2836 | # Author: Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import numpy as np
from sklearn.externals.six import b, u
from sklearn.utils.murmurhash import murmurhash3_32
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from nose.tools import assert_equa... | bsd-3-clause |
mdespriee/spark | python/pyspark/sql/tests/test_pandas_udf_scalar.py | 4 | 34264 | #
# 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 |
chrsrds/scikit-learn | sklearn/metrics/ranking.py | 1 | 39288 | """Metrics to assess performance on classification task given scores
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.... | bsd-3-clause |
markchil/gptools | gptools/utils.py | 1 | 112260 | # Copyright 2013 Mark Chilenski
# This program is distributed under the terms of the GNU General Purpose License (GPL).
# Refer to http://www.gnu.org/licenses/gpl.txt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... | gpl-3.0 |
AlexRobson/scikit-learn | examples/decomposition/plot_image_denoising.py | 181 | 5819 | """
=========================================
Image denoising using dictionary learning
=========================================
An example comparing the effect of reconstructing noisy fragments
of the Lena image using firstly online :ref:`DictionaryLearning` and
various transform methods.
The dictionary is fitted o... | bsd-3-clause |
wwf5067/statsmodels | statsmodels/examples/ex_kernel_regression3.py | 34 | 2380 | # -*- coding: utf-8 -*-
"""script to try out Censored kernel regression
Created on Wed Jan 02 13:43:44 2013
Author: Josef Perktold
"""
from __future__ import print_function
import numpy as np
import statsmodels.nonparametric.api as nparam
if __name__ == '__main__':
np.random.seed(500)
nobs = [250, 1000][0]... | bsd-3-clause |
Bhare8972/LOFAR-LIM | LIM_scripts/porta_code.py | 1 | 5537 | #!/usr/bin/env python3
##ON APP MACHINE
#This is a module for generating python code and saving data to be transfered between computers.
#Primary purpose is to be able to make plots on a server, and be able to transfer them to personal computer and have them still be interactive
#### WARNING ####
## this code is ver... | mit |
HSC-Users/hscTools | bick/bin/showVisitsInTract.py | 2 | 9481 | #!/usr/bin/env python
import sys, os, re, math
import argparse
import numpy
import matplotlib.pyplot as pyplot
import lsst.daf.persistence as dafPersist
import lsst.afw.cameraGeom as camGeom
import lsst.afw.coord as afwCoord
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
i... | gpl-3.0 |
yangspeaking/UnbalancedDataset | unbalanced_dataset/over_sampling.py | 3 | 20339 | from __future__ import print_function
from __future__ import division
import numpy as np
from numpy.random import seed, randint
from numpy import concatenate, asarray
from random import betavariate
from collections import Counter
from .unbalanced_dataset import UnbalancedDataset
class OverSampler(UnbalancedDataset):
... | mit |
asreimer/davitpy_asr | models/raydarn/rt.py | 3 | 41400 | # Copyright (C) 2012 VT SuperDARN Lab
# Full license can be found in LICENSE.txt
"""
*********************
**Module**: models.raydarn.rt
*********************
This module runs the raytracing code
**Classes**:
* :class:`models.raydarn.rt.RtRun`: run the code
* :class:`models.raydarn.rt.Scatter`: store and proc... | gpl-3.0 |
arabenjamin/scikit-learn | sklearn/cluster/tests/test_k_means.py | 132 | 25860 | """Testing for K-means"""
import sys
import numpy as np
from scipy import sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing i... | bsd-3-clause |
yunfeilu/scikit-learn | sklearn/datasets/samples_generator.py | 103 | 56423 | """
Generate samples of synthetic data sets.
"""
# Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel,
# G. Louppe, J. Nothman
# License: BSD 3 clause
import numbers
import array
import numpy as np
from scipy import linalg
import scipy.sparse as sp
from ..preprocessing import MultiLabelBin... | bsd-3-clause |
themrmax/scikit-learn | sklearn/metrics/cluster/__init__.py | 91 | 1468 | """
The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for
cluster analysis results. There are two forms of evaluation:
- supervised, which uses a ground truth class values for each sample.
- unsupervised, which does not and measures the 'quality' of the model itself.
"""
from .supervised import ... | bsd-3-clause |
sonofeft/XYmath | xymath/examples/walking_randomly.py | 1 | 1615 | """
Example from: http://www.walkingrandomly.com/?p=5215
The author (Mike Croucher) makes initial guess of p1=1 and p2=0.2 in eqn:
p1*cos(p2*x) + p2*sin(p1*x)
and then gets:
p1 = 1.88184732
p2 = 0.70022901
with sum of squared residuals = 0.053812696547933969
1) run script and get virtually identical results
(Note... | gpl-3.0 |
sarahgrogan/scikit-learn | examples/applications/face_recognition.py | 191 | 5513 | """
===================================================
Faces recognition example using eigenfaces and SVMs
===================================================
The dataset used in this example is a preprocessed excerpt of the
"Labeled Faces in the Wild", aka LFW_:
http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2... | bsd-3-clause |
Alexoner/mooc | cs231n/2016/assignment1/cs231n/classifiers/neural_net.py | 1 | 11432 | import numpy as np
import matplotlib.pyplot as plt
class TwoLayerNet(object):
"""
A two-layer fully-connected neural network. The net has an input dimension of
N, a hidden layer dimension of H, and performs classification over C classes.
We train the network with a softmax loss function and L2 regularization ... | apache-2.0 |
vitaliykomarov/NEUCOGAR | nest/serotonin/NEST+serotonin/C/nest-2.10.0/topology/pynest/hl_api.py | 9 | 67672 | # -*- coding: utf-8 -*-
#
# hl_api.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
# (a... | gpl-2.0 |
exa-analytics/atomic | exatomic/widgets/traits.py | 2 | 5549 | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2020, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Universe trait functions
#########################
"""
##########
# traits #
##########
import numpy as np
import pandas as pd
from exatomic.base import sym2radius, sym2color
d... | apache-2.0 |
zorojean/scikit-learn | examples/mixture/plot_gmm_selection.py | 248 | 3223 | """
=================================
Gaussian Mixture Model Selection
=================================
This example shows that model selection can be performed with
Gaussian Mixture Models using information-theoretic criteria (BIC).
Model selection concerns both the covariance type
and the number of components in th... | bsd-3-clause |
yask123/scikit-learn | sklearn/cross_decomposition/pls_.py | 187 | 28507 | """
The :mod:`sklearn.pls` module implements Partial Least Squares (PLS).
"""
# Author: Edouard Duchesnay <edouard.duchesnay@cea.fr>
# License: BSD 3 clause
from ..base import BaseEstimator, RegressorMixin, TransformerMixin
from ..utils import check_array, check_consistent_length
from ..externals import six
import w... | bsd-3-clause |
hyperspy/hyperspy | hyperspy/drawing/figure.py | 2 | 5008 | # -*- coding: utf-8 -*-
# Copyright 2007-2021 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | gpl-3.0 |
jreback/pandas | pandas/tests/indexes/test_base.py | 1 | 83805 | from collections import defaultdict
from datetime import datetime, timedelta
from io import StringIO
import math
import operator
import re
import numpy as np
import pytest
from pandas._libs.tslib import Timestamp
from pandas.compat import IS64
from pandas.compat.numpy import np_datetime64_compat
from pandas.util._tes... | bsd-3-clause |
pastephens/pysal | pysal/contrib/viz/plot.py | 5 | 1179 | """
Canned Views using PySAL and Matplotlib
"""
__author__ = "Marynia Kolak <marynia.kolak@gmail.com>"
import pandas as pd
import numpy as np
import pysal as ps
import matplotlib.pyplot as plt
def mplot(m, xlabel='', ylabel='', title='', custom=(7,7)):
'''
Produce basic Moran Plot
...
Parameters
... | bsd-3-clause |
loliverhennigh/Phy-Net | systems/mechsys_fluid_flow/h5_test.py | 1 | 3379 |
import h5py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
from mpl_toolkits.mplot3d import Axes3D
import sys
show = "bounds"
if len(sys.argv) > 1:
show = sys.argv[1]
import matplotlib.image as mpimg
def divergence(velocity_field):
velocity_field_x_0 = velocity_field[0:-2,1:-1... | apache-2.0 |
jlSche/data.taipei.tagConceptionize | dataset_getter.py | 1 | 2670 | # encoding=utf8
import json
import codecs
import pandas as pd
import sys
from collections import defaultdict
df = pd.read_csv('./input.csv', encoding='big5')
df = df.drop_duplicates(subset='fieldDescription', take_last=True)
df = df[(df['category']==u'求學及進修') | (df['category']==u'交通及通訊') | (df['category']==u'生活安全及品質... | mit |
MoamerEncsConcordiaCa/tensorflow | tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_test.py | 137 | 2219 | # encoding: utf-8
# 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 r... | apache-2.0 |
ElDeveloper/scikit-learn | examples/neighbors/plot_species_kde.py | 282 | 4059 | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric... | bsd-3-clause |
mattsmart/biomodels | celltypes/cytokine/cytokine_lattice_sim.py | 1 | 4598 | import numpy as np
import os
import random
import matplotlib.pyplot as plt
from cytokine_lattice_build import build_cytokine_lattice_mono
from cytokine_settings import APP_FIELD_STRENGTH, RUNS_SUBDIR_CYTOKINES
from singlecell.singlecell_functions import state_to_label
from singlecell.singlecell_data_io import run_subd... | mit |
tectronics/ambhas | ambhas/richards.py | 3 | 58186 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 12 17:41:54 2012
@author: sat kumar tomer
@email: satkumartomer@gmail.com
@website: www.ambhas.com
"""
from __future__ import division
import numpy as np
import xlrd
from scipy.io import netcdf as nc
import datetime
import matplotlib.pyplot as plt
from BIP.Bayes.lhs impo... | lgpl-2.1 |
treverhines/RBF | docs/scripts/gproc.k.py | 1 | 1130 | '''
This script demonstrates how to define a 1D Gibb Gaussian process
which has variable lengthscales.
'''
import numpy as np
import matplotlib.pyplot as plt
from rbf.gproc import gpgibbs
np.random.seed(0)
def lengthscale(x):
# define an arbitrary lengthscale function
out = 0.25 + 0.5*np.abs(x)
return ou... | mit |
fhedberg/ardupilot | Tools/mavproxy_modules/lib/magcal_graph_ui.py | 108 | 8248 | # Copyright (C) 2016 Intel Corporation. All rights reserved.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This fi... | gpl-3.0 |
mmngreco/IneqPy | examples/alternatives_comparision.py | 1 | 5938 | import numpy as np
from pygsl import statistics as gsl_stat
from scipy import stats as sp_stat
import ineqpy as ineq
from ineqpy import _statistics as ineq_stat
# Generate random data
x, w = ineq.utils.generate_data_to_test((60,90))
# Replicating weights
x_rep, w_rep = ineq.utils.repeat_data_from_weighted(x, w)
svy =... | mit |
wazeerzulfikar/scikit-learn | examples/cluster/plot_cluster_iris.py | 4 | 2853 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
K-means Clustering
=========================================================
The plots display firstly what a K-means algorithm would yield
using three clusters. It is then shown what the effect of a bad
initializa... | bsd-3-clause |
bigdataelephants/scikit-learn | sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py | 23 | 5540 | """
Testing for the gradient boosting loss functions and initial estimators.
"""
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_equal
from nose.tools import assert_raises
from sklearn.utils import check_random_state
from ... | bsd-3-clause |
AISpace2/AISpace2 | aipython/agentEnv.py | 1 | 4827 | # agentEnv.py - Agent environment
# AIFCA Python3 code Version 0.7.1 Documentation at http://aipython.org
# Artificial Intelligence: Foundations of Computational Agents
# http://artint.info
# Copyright David L Poole and Alan K Mackworth 2017.
# This work is licensed under a Creative Commons
# Attribution-NonCommercial... | gpl-3.0 |
untom/scikit-learn | sklearn/utils/tests/test_sparsefuncs.py | 57 | 13752 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from numpy.testing import assert_array_almost_equal, assert_array_equal
from sklearn.datasets import make_classification
from sklearn.utils.sparsefuncs import (mean_variance_axis,
inplace_column_scale,
... | bsd-3-clause |
tdhopper/scikit-learn | examples/feature_stacker.py | 246 | 1906 | """
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... | bsd-3-clause |
mlyundin/scikit-learn | examples/cluster/plot_segmentation_toy.py | 258 | 3336 | """
===========================================
Spectral clustering for image segmentation
===========================================
In this example, an image with connected circles is generated and
spectral clustering is used to separate the circles.
In these settings, the :ref:`spectral_clustering` approach solve... | bsd-3-clause |
bikong2/scikit-learn | doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py | 256 | 2406 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | bsd-3-clause |
cpcloud/seaborn | seaborn/tests/test_axisgrid.py | 1 | 19469 | import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
import nose.tools as nt
import numpy.testing as npt
from .. import axisgrid as ag
from ..palettes import color_palette
from ..distributions import kdeplot
from ..linearmodels import pointplot
rs = np.random.RandomState(0)
... | bsd-3-clause |
DSLituiev/scikit-learn | sklearn/metrics/cluster/unsupervised.py | 14 | 8194 | """ Unsupervised evaluation metrics. """
# Authors: Robert Layton <robertlayton@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from ...utils import check_random_state
from ...utils import check_X_y
from ..pairwise import pairwise_distances
from ...preprocessing import LabelEncoder
def silhouette_score(X, ... | bsd-3-clause |
vigilv/scikit-learn | sklearn/ensemble/voting_classifier.py | 178 | 8006 | """
Soft Voting/Majority Rule classifier.
This module contains a Soft Voting/Majority Rule classifier for
classification estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>
#
# Licence: BSD 3 clause
import numpy as np
from ..base import BaseEstimator
f... | bsd-3-clause |
APMonitor/arduino | 5_Moving_Horizon_Estimation/2nd_order_linear/GEKKO/tclab_mhe_2nd_order_linear.py | 1 | 7280 | import numpy as np
import time
import matplotlib.pyplot as plt
import random
# get gekko package with:
# pip install gekko
from gekko import GEKKO
# get tclab package with:
# pip install tclab
from tclab import TCLab
# save txt file
def save_txt(t,Q1,Q2,T1,T2):
data = np.vstack((t,Q1,Q2,T1,T2)) #... | apache-2.0 |
girving/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py | 25 | 13554 | # 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 |
elijah513/scikit-learn | sklearn/ensemble/tests/test_weight_boosting.py | 40 | 16837 | """Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal, assert_true
from sklearn.utils.testing import assert_raises... | bsd-3-clause |
gpcarlos95/Trabajo-Final-SD | Cliente.py | 1 | 14693 | from PyQt5 import QtCore, QtGui, QtWidgets
import zmq
import json
import pandas as pd
import re
import os
import matplotlib
import matplotlib.pyplot as plt
import dropbox
import tempfile
import shutil
''' IMPORTACIÓN DE TOKEN '''
from Token_Dropbox import token
dbx = dropbox.Dropbox(token)
user = dbx.users_get_current... | gpl-3.0 |
timothydmorton/isochrones | isochrones/fit.py | 1 | 4762 | import os, sys
import pandas as pd
import numpy as np
import emcee3
from emcee3.backends import Backend, HDFBackend
class Emcee3Model(emcee3.Model):
def __init__(self, mod, *args, **kwargs):
self.mod = mod
super().__init__(*args, **kwargs)
def compute_log_prior(self, state):
state.lo... | mit |
rajat1994/scikit-learn | examples/ensemble/plot_partial_dependence.py | 249 | 4456 | """
========================
Partial Dependence Plots
========================
Partial dependence plots show the dependence between the target function [1]_
and a set of 'target' features, marginalizing over the
values of all other features (the complement features). Due to the limits
of human perception the size of t... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.